CheckPointFirewall_v2

Use this integration to read information and send commands to the Check Point Firewall server.

IT Services · Check Point Firewall

Details

IDCheckPointFirewall_v2
ProviderCheckPoint Software Technologies
CategoryIT Services
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Supported ModulesAgentix XSIAM EDR Cortex Cloud Cloud Runtime Security

README

Overview


Integration Overview Manage Check Point Firewall. Read information and to send commands to the Check Point Firewall server.
This integration was integrated and tested with version R80.30 of CheckPoint SmartConsole.

Product Name: Check Point Firewall
Product Type: Network Security
Product Version: R80.30

How to configure the integration

In the Smart Console, enable the web api: Management & SettingBladesManagement API, Advanced SettingAll IP address

Enable sftp on your server Check Point guide to walk you through: https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk82281

Parameter Description Required
server Server URL (e.g. example.net or 8.8.8.8) True
port Server Port (e.g. 4434) True
domain Domain (used in Multi Domain Server) False
username Username True
insecure Trust any certificate (not secure) False
proxy Use system proxy settings False

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

checkpoint-host-list


Show all host objects

Base Command

checkpoint-host-list

Input

Argument Name Description Required
limit The maximum number of results to return. Optional
offset The number of results to initially skip. Optional
session_id The session ID with which to execute the command. Optional
details_level The level of detail for the results. Possible values are “standard”, “full”, or “uid”. Optional
domains_to_process A comma-separated list of domains to process the commands on. Cannot be used with details-level set to full. Must be run from the System Domain only with ignore-warnings set to true. Possible values are: “CURRENT_DOMAIN”, “ALL_DOMAINS_ON_THIS_SERVER”. Optional

Context Output

Path Type Description
CheckPoint.Host.name String Object name.
CheckPoint.Host.uid String Object UID.
CheckPoint.Host.type String Object type.
CheckPoint.Host.ipv4 String IPv4 address of the host.
CheckPoint.Host.ipv6 String IPv6 address of the host.
CheckPoint.Host.domain-name String Domain name.
CheckPoint.Host.domain-uid String Domain UID.
CheckPoint.Host.domain-type String Domain type.
CheckPoint.Host.color String Color of the object.

Command Example

!checkpoint-host-list limit=5

Context Example

{
    "CheckPoint": {
        "Host": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": "18.88.8.7",
                "ipv6-address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                "last-modifier": null,
                "name": "18.88.8.7",
                "read-only": null,
                "type": "host",
                "uid": "f083d3ce-8e95-460f-a386-0bc4eca1214a"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": "18.88.8.8",
                "ipv6-address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                "last-modifier": null,
                "name": "18.88.8.8",
                "read-only": null,
                "type": "host",
                "uid": "b032c0a7-096c-4b27-9a09-8d9437312135"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": "192.168.30.2",
                "ipv6-address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                "last-modifier": null,
                "name": "192.168.30.2",
                "read-only": null,
                "type": "host",
                "uid": "5bd98c85-f848-45ab-aa4c-c729fb8b1723"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": "200.200.200.112",
                "ipv6-address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                "last-modifier": null,
                "name": "200.200.200.112",
                "read-only": null,
                "type": "host",
                "uid": "23c4b2cf-0adc-4282-8f15-262cfec7f5f5"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": "192.192.10.10",
                "ipv6-address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
                "last-modifier": null,
                "name": "Demisto - 2096",
                "read-only": null,
                "type": "host",
                "uid": "cded0c90-3402-4766-ad1b-adaf972b254f"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all hosts

name uid type ipv4-address ipv6-address
18.88.8.7 f083d3ce-8e95-460f-a386-0bc4eca1214a host 18.88.8.7 2001:0db8:85a3:0000:0000:8a2e:0370:7334
18.88.8.8 b032c0a7-096c-4b27-9a09-8d9437312135 host 18.88.8.8 2001:0db8:85a3:0000:0000:8a2e:0370:7334
192.168.30.2 5bd98c85-f848-45ab-aa4c-c729fb8b1723 host 192.168.30.2 2001:0db8:85a3:0000:0000:8a2e:0370:7334
200.200.200.112 23c4b2cf-0adc-4282-8f15-262cfec7f5f5 host 200.200.200.112 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Demisto - 2096 cded0c90-3402-4766-ad1b-adaf972b254f host 192.192.10.10 2001:0db8:85a3:0000:0000:8a2e:0370:7334

checkpoint-host-get


get all data of a given host

Base Command

checkpoint-host-get

Input

Argument Name Description Required
identifier The unique identifier (UID) or name of the object to get data for. Required
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for the results. Possible values are “standard”, “full”, or “uid”. Optional

Context Output

Path Type Description
CheckPoint.Host.name String Host name.
CheckPoint.Host.uid String Object UID.
CheckPoint.Host.type String Object type.
CheckPoint.Host.domain-name String Domain name.
CheckPoint.Host.domain-uid String Domain UID.
CheckPoint.Host.ipv4-address String Host IPv4 address.
CheckPoint.Host.ipv6-address String IP address.
CheckPoint.Host.read-only Boolean Indicates if the object is read-only.
CheckPoint.Host.creator String The creator of the object.
CheckPoint.Host.last-modifier String The user that last modified the object.
CheckPoint.Host.groups-name String The name of the group object linked to the current host object.
CheckPoint.Host.groups-uid Unknown The UID of the group object linked to the current host object.
CheckPoint.Host.color String Color of the object.
CheckPoint.Host.comments String Comments string.
CheckPoint.Host.tags Unknown Collection of tag objects associated with the host.
CheckPoint.Host.nat-auto-rule Boolean Whether NAT automatic rules are enabled.
CheckPoint.Host.nat-method String NAT method (hide or static).
CheckPoint.Host.nat-ipv4-address String NAT IPv4 address.
CheckPoint.Host.nat-install-on String Gateway for NAT rule installation.
CheckPoint.Host.nat-hide-behind String Hide behind method (gateway or ip-address).
CheckPoint.Host.interfaces Unknown Host interfaces.

Command Example

!checkpoint-host-get identifier=host_test

Context Example

{
    "CheckPoint": {
        "Host": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "ipv4-address": "1.1.1.1",
            "last-modifier": "adminsh",
            "name": "host_test",
            "read-only": false,
            "type": "host",
            "uid": "11c194c4-db5f-46de-a9e2-95b8e858b98f"
        }
    }
}

Human Readable Output

CheckPoint data of host object host_test

name uid type ipv4-address domain-name domain-uid read-only creator last-modifier
host_test 11c194c4-db5f-46de-a9e2-95b8e858b98f host 1.1.1.1 SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde false adminsh adminsh

checkpoint-host-add


Add new host

Base Command

checkpoint-host-add

Input

Argument Name Description Required
name A comma-separated list of names for the new hosts. Required
ip_address A comma-separated list of IP addresses for the new hosts. Required
groups A comma-separated list of group identifiers. Optional
session_id Executes the command with the specified session ID. Required
ignore_warnings Whether to ignore warnings when adding a host. Optional
ignore_errors Whether to ignore errors when adding a host. Optional
comments Comment string. Optional
nat_auto_rule Required only when any nat_* argument is provided; otherwise omitted. Optional
color Object color. Optional
nat_method NAT method. Optional
nat_ip The IPv4 address. This parameter is not required if nat_method is set to “hide” and nat_hide_behind is set to “gateway”. Optional
nat_install_on Gateway for NAT rule. Optional
nat_hide_behind The hide behind method. This parameter value must not be provided if nat_method is set to “static”. Optional
interfaces_name The name of the network interface. Optional
interfaces_subnet The IPv4 subnet mask of the interface. Optional
interfaces_mask_length The IPv4 network mask length. Required only when defining interfaces (when any interfaces_* arg is provided). Optional
tags A comma-separated list of tags to assign. Optional

Context Output

Path Type Description
CheckPoint.Host.name String Object name.
CheckPoint.Host.uid String Object UID.
CheckPoint.Host.type String Object type.
CheckPoint.Host.domain-name String Domain name.
CheckPoint.Host.domain-uid String Domain UID.
CheckPoint.Host.domain-type String Domain type.
CheckPoint.Host.creator String The creator of the object.
CheckPoint.Host.last-modifier String The user that last modified the object.
CheckPoint.Host.ipv4-address String Host IPv4 address.
CheckPoint.Host.ipv6-address String Host IPv6 address.
CheckPoint.Host.read-only String Indicates if the object is read-only.
CheckPoint.Host.groups String Collection of group identifiers.
CheckPoint.Host.color String Color of the object.
CheckPoint.Host.comments String Comments string.
CheckPoint.Host.tags Unknown Collection of tag objects associated with the host.
CheckPoint.Host.nat-auto-rule Boolean Whether NAT automatic rules are enabled.
CheckPoint.Host.nat-method String NAT method (hide or static).
CheckPoint.Host.nat-ipv4-address String NAT IPv4 address.
CheckPoint.Host.nat-install-on String Gateway for NAT rule installation.
CheckPoint.Host.nat-hide-behind String Hide behind method (gateway or ip-address).
CheckPoint.Host.interfaces Unknown Host interfaces.

Command Example

!checkpoint-host-add name=test_host_1 ip_address=18.18.18.18 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Host": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "ipv4-address": "18.18.18.18",
            "ipv6-address": null,
            "last-modifier": "adminsh",
            "name": "test_host_1",
            "read-only": true,
            "type": "host",
            "uid": "7290f66a-fdd4-40fb-a639-774e3f387113"
        }
    }
}

Human Readable Output

CheckPoint data for adding host

name uid type domain-name domain-uid creator last-modifier ipv4-address read-only
test_host_1 7290f66a-fdd4-40fb-a639-774e3f387113 host SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh adminsh 18.18.18.18 true

checkpoint-host-update


update host changes

Base Command

checkpoint-host-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
ip_address IPv4 or IPv6 address. Optional
new_name New name of the object. Optional
comments Comments string. Optional
ignore_warnings Whether to ignore warnings when applying the updates. Can be “True” or “False”. Default is “False”. Optional
ignore_errors Whether to ignore errors when applying the updates. Can be “True” or “False”. Default is “False”. Optional
groups A comma-separated list of group identifiers. Optional
session_id Executes the command with the specified session ID. Required
nat_auto_rule Required only when any nat_* argument is provided; otherwise omitted. Optional
color Object color. Optional
nat_method NAT method. Optional
nat_ip The IPv4 address. This parameter must not be provided if nat_method is set to “hide” and nat_hide_behind is set to “gateway”. Optional
nat_install_on The gateway for the NAT rule. Optional
nat_hide_behind The hide behind method. This parameter must not be provided if nat_method is set to “static”. Optional
interfaces_name The name of the network interface. Required only when defining interfaces (when any interfaces_* arg is provided). Optional
interfaces_subnet The IPv4 subnet of the interface. Required only when defining interfaces (when any interfaces_* arg is provided). Optional
interfaces_mask_length The IPv4 network mask length. Required only when defining interfaces (when any interfaces_* arg is provided). Optional
tags A comma-separated list of tags to assign. Optional

Context Output

Path Type Description
CheckPoint.Host.name String Object name.
CheckPoint.Host.uid String Object UID.
CheckPoint.Host.type String Object type.
CheckPoint.Host.domain-name String Domain name.
CheckPoint.Host.domain-uid String Domain UID.
CheckPoint.Host.domain-type String Domain type.
CheckPoint.Host.creator String The creator of the object.
CheckPoint.Host.last-modifier String The user that last modified the object.
CheckPoint.Host.ipv4-address String Host IPv4 address.
CheckPoint.Host.read-only Boolean Indicates if the object is read-only.
CheckPoint.Host.group-name String The name of the group object linked to the host.
CheckPoint.Host.group-uid String The UID of the group object linked to the host.
CheckPoint.Host.color String Color of the object.
CheckPoint.Host.comments String Comments string.
CheckPoint.Host.tags Unknown Collection of tag objects associated with the host.
CheckPoint.Host.nat-auto-rule Boolean Whether NAT automatic rules are enabled.
CheckPoint.Host.nat-method String NAT method (hide or static).
CheckPoint.Host.nat-ipv4-address String NAT IPv4 address.
CheckPoint.Host.nat-install-on String Gateway for NAT rule installation.
CheckPoint.Host.nat-hide-behind String Hide behind method (gateway or ip-address).
CheckPoint.Host.interfaces Unknown Host interfaces.

Command Example

!checkpoint-host-update identifier=host_test session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Host": {
            "comments": "",
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "ipv4-address": "1.1.1.1",
            "last-modifier": "adminsh",
            "name": "host_test",
            "read-only": false,
            "type": "host",
            "uid": "11c194c4-db5f-46de-a9e2-95b8e858b98f"
        }
    }
}

Human Readable Output

CheckPoint data for updating a host

name uid type domain-name domain-uid creator ipv4-address last-modifier read-only
host_test 11c194c4-db5f-46de-a9e2-95b8e858b98f host SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh 1.1.1.1 adminsh false

checkpoint-host-delete


delete host

Base Command

checkpoint-host-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.Host.message String operation status

Command Example

!checkpoint-host-delete identifier=host_test session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Host": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint data for deleting host_test

message
OK

checkpoint-group-list


Show a list of all groups

Base Command

checkpoint-group-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for the results. Optional
domains_to_process A comma-separated list of domains to process the commands on. Optional
filter 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. Optional

Context Output

Path Type Description
CheckPoint.Group.name String Object name.
CheckPoint.Group.uid String Object UID.
CheckPoint.Group.type String Object type.
CheckPoint.Group.domain-name String Domain name.
CheckPoint.Group.domain-uid String Domain UID.
CheckPoint.Group.domain-type String Domain type.
CheckPoint.Group.color String Color of the object.
CheckPoint.Group.comments String Comments string.
CheckPoint.Group.tags Unknown Collection of tag objects associated with the group.

Command Example

!checkpoint-group-list limit=5

Context Example

{
    "CheckPoint": {
        "Group": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "bensar",
                "read-only": null,
                "type": "group",
                "uid": "fe26adc1-c0e1-4424-9a9e-f74f511a7f28"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "group10",
                "read-only": null,
                "type": "group",
                "uid": "cf069504-5ea5-4eb2-9b97-ccdc500db118"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "group9",
                "read-only": null,
                "type": "group",
                "uid": "c4635886-15c9-4416-8160-5c70d68462cd"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "group_test",
                "read-only": null,
                "type": "group",
                "uid": "35a46b01-47f5-496f-9329-d55c7d2ab083"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "Group_test_for_demisto",
                "read-only": null,
                "type": "group",
                "uid": "1deaead0-136c-4791-8d58-9229c143b8c5"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all groups

name uid type
bensar fe26adc1-c0e1-4424-9a9e-f74f511a7f28 group
group10 cf069504-5ea5-4eb2-9b97-ccdc500db118 group
group9 c4635886-15c9-4416-8160-5c70d68462cd group
group_test 35a46b01-47f5-496f-9329-d55c7d2ab083 group
Group_test_for_demisto 1deaead0-136c-4791-8d58-9229c143b8c5 group

checkpoint-group-get


Get all data of a given group

Base Command

checkpoint-group-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for the results. Optional

Context Output

Path Type Description
CheckPoint.Group.name String Object name.
CheckPoint.Group.uid String Object UID.
CheckPoint.Group.type String Object type.
CheckPoint.Group.domain-name String Domain name.
CheckPoint.Group.domain-uid String Domain UID.
CheckPoint.Group.domain-type String Domain type.
CheckPoint.Group.creator String The creator of the object.
CheckPoint.Group.last-modifier String The user that last modified the object.
CheckPoint.Group.read-only Boolean Indicates if the object is read-only.
CheckPoint.Group.ipv4-address string Group IPv4 addresses.
CheckPoint.Group.ipv6-address string Group IPv6 addresses.
CheckPoint.Group.groups Unknown Collection of group identifiers.
CheckPoint.Group.members.member-ipv4-address string Group members IPv4 addresses.
CheckPoint.Group.members.member-ipv6-address string Group members IPv6 addresses.
CheckPoint.Group.members.member-domain-name string Group members domain name.
CheckPoint.Group.members.member-domain-uid string Group members domain UID.
CheckPoint.Group.members.member-domain-type string Group members domain type.
CheckPoint.Group.members.member-name string Group member name.
CheckPoint.Group.members.member-uid string Group member UID.
CheckPoint.Group.members.member-type string Group member type.

Command Example

!checkpoint-group-get identifier=group_test

Context Example

{
    "CheckPoint": {
        "Group": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "ipv4-address": null,
            "last-modifier": "adminsh",
            "name": "group_test",
            "read-only": false,
            "type": "group",
            "uid": "35a46b01-47f5-496f-9329-d55c7d2ab083"
        }
    }
}

Human Readable Output

CheckPoint for group_test group

name uid type domain-name domain-uid read-only creator last-modifier
group_test 35a46b01-47f5-496f-9329-d55c7d2ab083 group SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde false adminsh adminsh

checkpoint-group-add


add a group

Base Command

checkpoint-group-add

Input

Argument Name Description Required
name A comma-separated list of object names. Must be unique in the domain. Required
session_id Executes the command with the specified session ID. Required
members A comma-separated list of group identifiers (names or UIDs). Optional
comments The comment string. Optional
color Possible values: 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. Default: black. Optional
tags A comma-separated list of tags to assign. Optional
ignore_warnings Apply changes, ignoring warnings. Optional
ignore_errors Apply changes, ignoring errors. Optional

Context Output

Path Type Description
CheckPoint.Group.name String Object name.
CheckPoint.Group.uid String Object UID.
CheckPoint.Group.type Unknown Object type.
CheckPoint.Group.domain-name String Domain name.
CheckPoint.Group.domain-uid String Domain UID.
CheckPoint.Group.domain-type String Domain type.
CheckPoint.Group.creator String The creator of the object.
CheckPoint.Group.last-modifier String The user that last modified the object.
CheckPoint.Group.read-only Boolean Indicates if the object is read-only.
CheckPoint.Group.groups-name Unknown Groups name.
CheckPoint.Group.color String Color of the object.
CheckPoint.Group.comments String Comments string.
CheckPoint.Group.tags Unknown Collection of tag objects associated with the group.

Command Example

!checkpoint-group-add name=test_group_1 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Group": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "last-modifier": "adminsh",
            "name": "test_group_1",
            "type": "group",
            "uid": "11e751da-a0e7-499a-bcde-5bc638c73fb5"
        }
    }
}

Human Readable Output

CheckPoint data for adding Group

creator domain-name domain-uid last-modifier name type uid
adminsh SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh test_group_1 group 11e751da-a0e7-499a-bcde-5bc638c73fb5

checkpoint-group-update


update group object

Base Command

checkpoint-group-update

Input

| Argument Name | Description | Required |
| — | — | — |
| identifier | Object unique identifier (UID) or name. | Required |
| new_name | New name of the object. | Optional |
| comments | The update comments. | Optional |
| ignore_warnings | Whether to ignore warnings when applying the updates. Can be “True” or “False”. Default is “True”. | Optional |
| ignore_errors | Whether to ignore errors when applying the updates. Can be “True” or “False”. Default is “False”.
Note: you won’t be able to publish such these changes.
If the ignore-warnings flag was omitted, warnings will also be ignored. | Optional |
| session_id | Executes the command with the specified session ID. | Required |
| members | A comma-separated list of network objects identified by the name or UID. | Optional |
| action | The action that should be taken towards the values. | Optional |
| color | Possible values: 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. Default: black. | Optional |
| tags | A comma-separated list of updated tags. | Optional |
| details_level | The level of detail for the results. Possible values are “standard”, “full”, or “uid”. | Optional |

Context Output

Path Type Description
CheckPoint.Group.name String Object name.
CheckPoint.Group.uid String Object UID.
CheckPoint.Group.type String Object type.
CheckPoint.Group.domain-name String Domain name.
CheckPoint.Group.domain-uid String Domain UID.
CheckPoint.Group.domain-type String Domain type.
CheckPoint.Group.creator String The creator of the object.
CheckPoint.Group.last-modifier String The user that last modified the object.
CheckPoint.Group.read-only Boolean Indicates if the object is read-only.
CheckPoint.Group.color String Color of the object.
CheckPoint.Group.comments String Comments string.
CheckPoint.Group.tags Unknown Collection of tag objects associated with the group.

Command Example

!checkpoint-group-update identifier=group_test session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Group": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "last-modifier": "adminsh",
            "name": "group_test",
            "read-only": false,
            "type": "group",
            "uid": "35a46b01-47f5-496f-9329-d55c7d2ab083"
        }
    }
}

Human Readable Output

CheckPoint data for updating a group

name uid type domain-name domain-uid creator last-modifier read-only
group_test 35a46b01-47f5-496f-9329-d55c7d2ab083 group SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh adminsh false

checkpoint-group-delete


delete a group object

Base Command

checkpoint-group-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.Group.message String Operation massege

Command Example

!checkpoint-group-delete identifier=group_test session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Group": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint data for deleting group_test

message
OK

checkpoint-address-range-list


List all address range objects

Base Command

checkpoint-address-range-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for the results. Possible values are “standard”, “full”, or “uid”. Optional
domains_to_process A comma-separated list of domains to process the commands on. Optional

Context Output

Path Type Description
CheckPoint.AddressRange.name String Object name.
CheckPoint.AddressRange.uid String Object UID.
CheckPoint.AddressRange.type String Object type.
CheckPoint.AddressRange.domain-name String Domain name.
CheckPoint.AddressRange.domain-uid String Domain UID.
CheckPoint.AddressRange.domain-type String Domain type.

Command Example

!checkpoint-address-range-list limit=5

Context Example

{
    "CheckPoint": {
        "AddressRange": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "address_range_1",
                "read-only": null,
                "type": "address-range",
                "uid": "d4543195-8744-4592-906e-1cdcd534a564"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "address_range_test",
                "read-only": null,
                "type": "address-range",
                "uid": "26887214-d639-4acd-ab48-508d900cdfc2"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "address_range_test_1",
                "read-only": null,
                "type": "address-range",
                "uid": "46800cfe-e3ff-4101-867c-27772ade9d72"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "All_Internet",
                "read-only": null,
                "type": "address-range",
                "uid": "f90e0a2b-f166-427a-b47f-a107b6fe43b9"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "LocalMachine_Loopback",
                "read-only": null,
                "type": "address-range",
                "uid": "5d3b2752-4072-41e1-9aa0-488813b02a40"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all address ranges

name uid type
address_range_1 d4543195-8744-4592-906e-1cdcd534a564 address-range
address_range_test 26887214-d639-4acd-ab48-508d900cdfc2 address-range
address_range_test_1 46800cfe-e3ff-4101-867c-27772ade9d72 address-range
All_Internet f90e0a2b-f166-427a-b47f-a107b6fe43b9 address-range
LocalMachine_Loopback 5d3b2752-4072-41e1-9aa0-488813b02a40 address-range

checkpoint-address-range-add


Add address range object

Base Command

checkpoint-address-range-add

Input

| Argument Name | Description | Required |
| — | — | — |
| name | Name for the new address range object. | Required |
| ip_address_first | First IP address in the range. | Required |
| ip_address_last | Last IP address in the range. | Required |
| set_if_exists | Whether to update objects with the same identifier. Can be “true” or “false”. Default is “false”. | Optional |
| ignore_warnings | Whether to ignore warnings when applying the updates. Can be “True” or “False”. Default is “True”. | Optional |
| ignore_errors | Whether to ignore errors when applying the updates. Can be “True” or “False”. Default is “False”.
Note: you won’t be able to publish such these changes.
If the ignore-warnings flag was omitted, warnings will also be ignored. | Optional |
| session_id | Executes the command with the specified session ID. | Required |
| groups | A comma-separated list of group identifiers. | Optional |
| comments | Comment string. | Optional |
| color | Object color. | Optional |
| nat_auto_rule | Required only when any nat_* argument is provided; otherwise omitted. | Optional |
| nat_method | NAT method. | Optional |
| nat_ip | The IPv4 address. This parameter value must not be provided if nat_method is set to “hide” and nat_hide_behind is set to “gateway”. | Optional |
| nat_install_on | The gateway for the NAT rule. | Optional |
| nat_hide_behind | The hide behind method. This parameter value must not be provided if nat_method is set to “static”. | Optional |
| tags | A comma-separated list of tags to assign. | Optional |

Context Output

Path Type Description
CheckPoint.AddressRange.name String Object name.
CheckPoint.AddressRange.uid String Object UID.
CheckPoint.AddressRange.type String Object type.
CheckPoint.AddressRange.domain-name String Domain name.
CheckPoint.AddressRange.domain-uid String Domain UID.
CheckPoint.AddressRange.domain-type String Domain type.
CheckPoint.AddressRange.ipv4-address-first String First IPv4 address in the range.
CheckPoint.AddressRange.ipv4-address-last String Last IPv4 address in the range.
CheckPoint.AddressRange.ipv6-address-first String First IPv6 address in the range.
CheckPoint.AddressRange.ipv6-address-last String Last IPv6 address in the range.
CheckPoint.AddressRange.read-only Boolean Indicates if the object is read-only.
CheckPoint.AddressRange.creator String The creator of the object.
CheckPoint.AddressRange.last-modifier String Indicates the user that last modified the object.
CheckPoint.AddressRange.groups String Name of the group object.
CheckPoint.AddressRange.color String Color of the object.
CheckPoint.AddressRange.comments String Comments string.
CheckPoint.AddressRange.tags Unknown Collection of tag objects associated with the address range.
CheckPoint.AddressRange.nat-auto-rule Boolean Whether NAT automatic rules are enabled.
CheckPoint.AddressRange.nat-method String NAT method (hide or static).
CheckPoint.AddressRange.nat-ipv4-address String NAT IPv4 address.
CheckPoint.AddressRange.nat-install-on String Gateway for NAT rule installation.
CheckPoint.AddressRange.nat-hide-behind String Hide behind method (gateway or ip-address).

Command Example

!checkpoint-address-range-add name=address_range_test_2 ip_address_first=8.8.8.8 ip_address_last=9.9.9.9 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AddressRange": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "ipv4-address-first": "8.8.8.8",
            "ipv4-address-last": "9.9.9.9",
            "ipv6-address-first": "",
            "ipv6-address-last": "",
            "last-modifier": "adminsh",
            "name": "address_range_test_2",
            "read-only": true,
            "type": "address-range",
            "uid": "4fb8174d-89db-42f8-88b8-525c8fe818be"
        }
    }
}

Human Readable Output

CheckPoint data for adding an address range

name uid type domain-name domain-uid creator ipv4-address-first ipv4-address-last last-modifier read-only
address_range_test_2 4fb8174d-89db-42f8-88b8-525c8fe818be address-range SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh 8.8.8.8 9.9.9.9 adminsh true

checkpoint-address-range-update


Update an address range object

Base Command

checkpoint-address-range-update

Input

| Argument Name | Description | Required |
| — | — | — |
| identifier | Name for the new address range object. | Required |
| ip_address_first | First IP address in the range. Can be an IPv4 or IPv6 address. | Optional |
| ip_address_last | Last IP address in the range. Can be an IPv4 or IPv6 address. | Optional |
| new_name | New name of the object. | Optional |
| comments | The update comments. | Optional |
| ignore_warnings | Whether to ignore warnings when applying the updates. Can be “True” or “False”. Default is “True”. | Optional |
| ignore_errors | Whether to ignore errors when applying the updates. Can be “True” or “False”. Default is “False”.
Note: you won’t be able to publish such these changes.
If the ignore-warnings flag was omitted, warnings will also be ignored. | Optional |
| groups | A comma-separated list of group identifiers. | Optional |
| session_id | Executes the command with the specified session ID. | Required |
| color | The update color. | Optional |
| nat_method | Update NAT method. | Optional |
| nat_ip | The updated IPv4 address. This parameter value must not be provided if nat_method is set to “hide” and nat_hide_behind is set to “gateway”. | Optional |
| nat_install_on | Update NAT gateway. | Optional |
| nat_hide_behind | The hide behind method. This parameter value must not be provided if nat_method is set to “static”. | Optional |
| tags | A comma-separated list of updated tags. | Optional |

Context Output

Path Type Description
CheckPoint.AddressRange.name String Object name.
CheckPoint.AddressRange.uid String Object UID.
CheckPoint.AddressRange.type String Object type.
CheckPoint.AddressRange.domain-name String Domain name.
CheckPoint.AddressRange.domain-uid String Domain UID.
CheckPoint.AddressRange.domain-type String Domain type.
CheckPoint.AddressRange.ipv4-address-first String First IPv4 address in the range.
CheckPoint.AddressRange.ipv4-address-last String Last IPv4 address in the range.
CheckPoint.AddressRange.ipv6-address-first String First IPv6 address in the range.
CheckPoint.AddressRange.ipv6-address-last String Last IPv6 address in the range.
CheckPoint.AddressRange.read-only Boolean Indicates if the object is read-only.
CheckPoint.AddressRange.groups String List of all groups the address range is linked to.
CheckPoint.AddressRange.color String Color of the object.
CheckPoint.AddressRange.comments String Comments string.
CheckPoint.AddressRange.tags Unknown Collection of tag objects associated with the address range.
CheckPoint.AddressRange.nat-auto-rule Boolean Whether NAT automatic rules are enabled.
CheckPoint.AddressRange.nat-method String NAT method (hide or static).
CheckPoint.AddressRange.nat-ipv4-address String NAT IPv4 address.
CheckPoint.AddressRange.nat-install-on String Gateway for NAT rule installation.
CheckPoint.AddressRange.nat-hide-behind String Hide behind method (gateway or ip-address).

Command Example

!checkpoint-address-range-update identifier=address_range_test layer=Network session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AddressRange": {
            "comments": "",
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "ipv4-address": null,
            "last-modifier": "adminsh",
            "name": "address_range_test",
            "read-only": false,
            "type": "address-range",
            "uid": "26887214-d639-4acd-ab48-508d900cdfc2"
        }
    }
}

Human Readable Output

CheckPoint data for updating an address range

name uid type domain-name domain-uid creator last-modifier read-only
address_range_test 26887214-d639-4acd-ab48-508d900cdfc2 address-range SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh adminsh false

checkpoint-address-range-delete


Delete a given address range

Base Command

checkpoint-address-range-delete

Input

Argument Name Description Required
identifier Name for the new address range object. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.AddressRange.message String Operation status

Command Example

!checkpoint-address-range-delete identifier=address_range_test session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AddressRange": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint data for deleting address range

message
OK

checkpoint-threat-indicator-list


List all threat indicators

Base Command

checkpoint-threat-indicator-list

Input

Argument Name Description Required
limit The maximum number of results to return. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional
domain_names A comma-separated list of domains to process. Optional
details_level The level of detail for the results. Possible values are “standard”, “full”, or “uid”. Optional
filter 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. Optional

Context Output

Path Type Description
CheckPoint.ThreatIndicator.name String Object name.
CheckPoint.ThreatIndicator.uid String Object UID.
CheckPoint.ThreatIndicator.type String Object type.
CheckPoint.ThreatIndicator.domain-name String Domain name.
CheckPoint.ThreatIndicator.domain-uid String Domain UID.
CheckPoint.ThreatIndicator.domain-type String Domain type.

Command Example

!checkpoint-threat-indicator-list limit=5

Context Example

{
    "CheckPoint": {
        "ThreatIndicator": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "My_Indicator!",
                "read-only": null,
                "type": "threat-indicator",
                "uid": "a40ec97c-e286-474b-bff7-b922e3b3294d"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "test_indicator",
                "read-only": null,
                "type": "threat-indicator",
                "uid": "3e6a22c0-0416-4a2d-b7c0-f81df12916e1"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "threat_test_1",
                "read-only": null,
                "type": "threat-indicator",
                "uid": "88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "threat_test_2",
                "read-only": null,
                "type": "threat-indicator",
                "uid": "f34c89f1-b18f-4cf2-b2bb-672462178b9d"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "threat_test_3",
                "read-only": null,
                "type": "threat-indicator",
                "uid": "ee17772c-94aa-4e42-93e4-f0ba49de339b"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all threat indicators

name uid type
My_Indicator! a40ec97c-e286-474b-bff7-b922e3b3294d threat-indicator
test_indicator 3e6a22c0-0416-4a2d-b7c0-f81df12916e1 threat-indicator
threat_test_1 88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260 threat-indicator
threat_test_2 f34c89f1-b18f-4cf2-b2bb-672462178b9d threat-indicator
threat_test_3 ee17772c-94aa-4e42-93e4-f0ba49de339b threat-indicator

checkpoint-threat-indicator-get


Get data for a given list indicator

Base Command

checkpoint-threat-indicator-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.ThreatIndicator.name String object name
CheckPoint.ThreatIndicator.uid String object uid
CheckPoint.ThreatIndicator.type String object type
CheckPoint.ThreatIndicator.domain-name String Domain name
CheckPoint.ThreatIndicator.domain-uid String object uid
CheckPoint.ThreatIndicator.domain-type Unknown domain type
CheckPoint.ThreatIndicator.creator String creator
CheckPoint.ThreatIndicator.last-modifier String Indicates the last user modified the object
CheckPoint.ThreatIndicator.read-only Boolean Indicates whether the object is read-only.

Command Example

!checkpoint-threat-indicator-get identifier=threat_test_1

Context Example

{
    "CheckPoint": {
        "ThreatIndicator": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": null,
            "ipv4-address": null,
            "last-modifier": "adminsh",
            "name": "threat_test_1",
            "number-of-observables": 1,
            "read-only": false,
            "type": "threat-indicator",
            "uid": "88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260"
        }
    }
}

Human Readable Output

CheckPoint data for threat_test_1 threat indicator

name uid type domain-name domain-uid read-only creator last-modifier number-of-observables
threat_test_1 88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260 threat-indicator SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde false adminsh adminsh 1

checkpoint-threat-indicator-add


Add a threat indicator

Base Command

checkpoint-threat-indicator-add

Input

Argument Name Description Required
name Name for the new threat indicator. Required
observables A comma-separated list of the indicator’s observables, or the contents of a file containing the indicator’s observables. Required
session_id Executes the command with the specified session ID. Required
action The action for the indicator. Optional
profile_action A comma-separated list of profiles the indicator is applied to and the specific action to be performed, in the format “Profile_Action”. Optional
comments Comment string. Optional
color The object color. Optional
tags A comma-separated list of tags to assign. Optional
ignore_warnings Apply changes, ignoring warnings. Optional

Context Output

Path Type Description
CheckPoint.ThreatIndicator.task-id String Asynchronous task unique identifier.

Command Example

!checkpoint-threat-indicator-add name=threat_test2 observables=[] session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ThreatIndicator": {
                    'task-id': 'c3b11fff-c58d-4242-af44-f549c40b0af5'
        }
    }
}

Human Readable Output

checkpoint-threat-indicator-update


Update a given indicator

Base Command

checkpoint-threat-indicator-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
action The action to set for the indicator. Optional
new_name New name of the object. Optional
comments Comments for the object. Optional
session_id Executes the command with the specified session ID. Required
profile_action A comma-separated list of profiles the indicator is applied to and the specific action to be performed, in the format “Profile_Action”. Optional
color The update color. Optional
tags A comma-separated list of updated tags. Optional

Context Output

Path Type Description
CheckPoint.ThreatIndicator.name String Object name.
CheckPoint.ThreatIndicator.uid String Object UID.
CheckPoint.ThreatIndicator.type String Object type.
CheckPoint.ThreatIndicator.action String The indicator’s action.
CheckPoint.ThreatIndicator.domain-name String Domain name.
CheckPoint.ThreatIndicator.domain-uid String Domain UID.
CheckPoint.ThreatIndicator.domain-type String Domain type.
CheckPoint.ThreatIndicator.creator String The creator of the object.
CheckPoint.ThreatIndicator.last-modifier String The user that last modified the object.
CheckPoint.ThreatIndicator.read-only Boolean Indicates if the object is read-only.
CheckPoint.ThreatIndicator.color String Color of the object.
CheckPoint.ThreatIndicator.tags Unknown Collection of tag objects associated with the indicator.
CheckPoint.ThreatIndicator.profile-overrides Unknown A list of profiles where the default action of this indicator is overridden, along with the overriding action.

Command Example

!checkpoint-threat-indicator-update identifier=threat_test_1 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ThreatIndicator": {
            "comments": "",
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "ipv4-address": null,
            "last-modifier": "adminsh",
            "name": "threat_test_1",
            "read-only": false,
            "type": "threat-indicator",
            "uid": "88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260"
        }
    }
}

Human Readable Output

CheckPoint data for update threat_test_1 threat indicator

name uid type domain-name domain-uid creator last-modifier read-only
threat_test_1 88e502f1-2bd5-4ad4-ba6b-dbbb2fef8260 threat-indicator SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh adminsh false

checkpoint-address-range-get


Get all date of a given address range object

Base Command

checkpoint-address-range-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.AddressRange.name String Object name.
CheckPoint.AddressRange.uid String Object UID.
CheckPoint.AddressRange.type String Object type.
CheckPoint.AddressRange.domain-name String Domain name.
CheckPoint.AddressRange.domain-uid String Domain UID.
CheckPoint.AddressRange.domain-type String Domain type.
CheckPoint.AddressRange.groups-name String The name of the group object linked to current host object.
CheckPoint.AddressRange.groups-uid String The UID of the group object linked to current host object.

Command Example

!checkpoint-address-range-get identifier=address_range_test

Context Example

{
    "CheckPoint": {
        "AddressRange": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "ipv4-address": null,
            "last-modifier": "adminsh",
            "name": "address_range_test",
            "read-only": false,
            "type": "address-range",
            "uid": "26887214-d639-4acd-ab48-508d900cdfc2"
        }
    }
}

Human Readable Output

CheckPoint data for address_range_test address range

name uid type domain-name domain-uid read-only creator last-modifier
address_range_test 26887214-d639-4acd-ab48-508d900cdfc2 address-range SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde false adminsh adminsh

checkpoint-threat-indicator-delete


delete threat indicator

Base Command

checkpoint-threat-indicator-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.ThreatIndicator.message String Operation status

Command Example

!checkpoint-threat-indicator-delete identifier=threat_test_1 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ThreatIndicator": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint status for deleting threat_test_1threat indicator

message
OK

checkpoint-access-rule-list


Shows the entire Access Rules layer. This layer is divided into sections. An Access Rule may be within a section, or independent of a section.

Base Command

checkpoint-access-rule-list

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for the results. Possible values are “standard”, “full”, or “uid”. Optional
show_hits Includes hit count data in the output. Optional

Context Output

Path Type Description
CheckPoint.AccessRule.name String Object name.
CheckPoint.AccessRule.uid String Object UID.
CheckPoint.AccessRule.type String Object type.
CheckPoint.AccessRule.ipv4-address String IPv4 address of the specified object.
CheckPoint.AccessRule.ipv6-address String IPv6 address of the specified object.
CheckPoint.AccessRule.domain-name String Domain name.
CheckPoint.AccessRule.domain-uid String Domain UID.
CheckPoint.AccessRule.creator String The creator of the object.
CheckPoint.AccessRule.last-modifier String The user that last modified the object.
CheckPoint.AccessRule.read-only Boolean Indicates if the object is read-only.
CheckPoint.AccessRule.groups Unknown Collection of group identifiers.

Command Example

!checkpoint-access-rule-list identifier=Network limit=5

Context Example

{
    "CheckPoint": {
        "AccessRule": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": null,
                "read-only": null,
                "type": "access-rule",
                "uid": "6521b7b9-d340-44ec-a104-17d5ea669bc0"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": null,
                "read-only": null,
                "type": "access-rule",
                "uid": "bb6016e3-36e8-4214-b17f-89623160dd10"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "test_access_rule_8",
                "read-only": null,
                "type": "access-rule",
                "uid": "0c71cc44-a5ad-43cd-9af0-79e5f153f62f"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "None",
                "read-only": null,
                "type": "access-rule",
                "uid": "c44add02-0f02-4b29-8ab3-d5ac687d31f7"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "est_access_rule",
                "read-only": null,
                "type": "access-rule",
                "uid": "e5bc5918-7155-493e-89ce-5562586d3acc"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all access rule bases

name uid type
  6521b7b9-d340-44ec-a104-17d5ea669bc0 access-rule
  bb6016e3-36e8-4214-b17f-89623160dd10 access-rule
test_access_rule_8 0c71cc44-a5ad-43cd-9af0-79e5f153f62f access-rule
None c44add02-0f02-4b29-8ab3-d5ac687d31f7 access-rule
est_access_rule e5bc5918-7155-493e-89ce-5562586d3acc access-rule

checkpoint-access-rule-add


Create new access rule

Base Command

checkpoint-access-rule-add

Input

Argument Name Description Required
layer Layer to which to assign the rule, identified by the name or UID. Required
position Position in the rulebase. Required
name Rule name. Optional
action Action settings. Valid values are: Accept, Drop, Apply Layer, Ask and Info. Default value is Drop. Optional
vpn Communities or Directional. Valid values: Any or All_GwToGw. Optional
destination Collection of network objects identified by the name or UID. Optional
service Collection of network objects identified by the name or UID. Optional
source Collection of network objects identified by the name or UID. Optional
session_id Executes the command with the specified session ID. Required
comments Comment string. Optional
install_on A comma-separated list of installation targets. Optional
enabled Whether to enable/disable the rule. Optional
track_type Track settings for the rule. Possible values: “Log”, “Extended Log”, “Detailed Log”, “None”. Optional
track_accounting Whether to enable/disable track accounting. Optional
track_per_session Whether to generate a log per session. Optional

Context Output

Path Type Description
CheckPoint.AccessRule.name String Object name.
CheckPoint.AccessRule.uid String Object UID.
CheckPoint.AccessRule.type String Object type.
CheckPoint.AccessRule.domain-name String Domain name.
CheckPoint.AccessRule.domain-uid String Domain UID.
CheckPoint.AccessRule.domain-type String Domain type.
CheckPoint.AccessRule.enabled Boolean Indicates if the rule is enabled or disabled.
CheckPoint.AccessRule.layer String Layer to which the rule was assigned, identified by the name or UID.
CheckPoint.AccessRule.creator String The object creator.
CheckPoint.AccessRule.last-modifier String The user that last modified the object.

Command Example

!checkpoint-access-rule-add name=test_access_rule layer=Network position=top session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AccessRule": {
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "enabled": true,
            "last-modifier": "adminsh",
            "layer": "c0264a80-1832-4fce-8a90-d0849dc4ba33",
            "name": "test_access_rule",
            "type": "access-rule",
            "uid": "a9f00b65-bb3b-4548-b06a-6c5672df6c8b"
        }
    }
}

Human Readable Output

CheckPoint data for adding access rule

name uid type domain-name domain-uid enabled layer creator last-modifier
test_access_rule a9f00b65-bb3b-4548-b06a-6c5672df6c8b access-rule SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde true c0264a80-1832-4fce-8a90-d0849dc4ba33 adminsh adminsh

checkpoint-access-rule-update


Edit existing access rule using object name or uid.

Base Command

checkpoint-access-rule-update

Input

| Argument Name | Description | Required |
| — | — | — |
| identifier | Object unique identifier (UID), rule name, or rule number. | Required |
| layer | Layer to which the rule belongs, identified by the name or UID. | Required |
| action | Action to be taken on the rule. | Optional |
| enabled | If “true”, the rule is enabled. Default is “true”. | Optional |
| new_name | New name of the object. | Optional |
| new_position | New position in the rulebase. Value can be “int” to set a specific position, or str- ‘top’ or ‘bottom’. | Optional |
| ignore_warnings | Whether to ignore warnings when applying the updates. Can be “True” or “False”. Default is “True”. | Optional |
| ignore_errors | Whether to ignore errors when applying the updates. Can be “True” or “False”. Default is “False”.
Note: you won’t be able to publish such these changes.
If the ignore-warnings flag was omitted, warnings will also be ignored. | Optional |
| session_id | Executes the command with the specified session ID. | Required |
| comments | Update comments. | Optional |
| track_type | Track settings for the rule. Possible values: “Log”, “Extended Log”, “Detailed Log”, “None”. | Optional |
| track_accounting | Whether to enable/disable track accounting. | Optional |
| track_per_session | Whether to generate a log per session. | Optional |
| install_on | A comma-separated list of updated targets. | Optional |
| source_add | A comma-separated list of sources to add to the existing sources. | Optional |
| source_remove | A comma-separated list of sources to remove from the existing sources. | Optional |
| service_add | A comma-separated list of services to add to the existing services. | Optional |
| service_remove | A comma-separated list of services to remove from the existing services. | Optional |
| destination_add | A comma-separated list of destinations to add to the existing destinations. | Optional |
| destination_remove | A comma-separated list of destinations to remove from the existing destinations. | Optional |

Context Output

Path Type Description
CheckPoint.AccessRule.name String Object name.
CheckPoint.AccessRule.uid String Object UID.
CheckPoint.AccessRule.type String Object type.
CheckPoint.AccessRule.action-name String Action name.
CheckPoint.AccessRule.action-uid String Action UID.
CheckPoint.AccessRule.action-type Unknown Action type.
CheckPoint.AccessRule.action-domain-name String Action domain name.
CheckPoint.AccessRule.content-direction String The direction on which the file types processing is applied.
CheckPoint.AccessRule.domain-name String Domain name.
CheckPoint.AccessRule.domain-uid String Domain UID.
CheckPoint.AccessRule.domain-type String Domain type.
CheckPoint.AccessRule.enabled Boolean Indicates if the rule is enabled or disabled.
CheckPoint.AccessRule.layer String Layer to which the rule belongs, identified by the name or UID.
CheckPoint.AccessRule.creator String The creator of the object.
CheckPoint.AccessRule.last-modifier String The user that last modified the object.

Command Example

!checkpoint-access-rule-update identifier=7867e584-0e68-42b4-ba18-2dd16cdbd436 layer=Network session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AccessRule": {
            "action-name": "Drop",
            "action-type": "RulebaseAction",
            "action-uid": "6c488338-8eec-4103-ad21-cd461ac2c473",
            "content-direction": "any",
            "creator": "adminsh",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "enabled": true,
            "last-modifier": "adminsh",
            "name": "None",
            "type": "access-rule",
            "uid": "7867e584-0e68-42b4-ba18-2dd16cdbd436"
        }
    }
}

Human Readable Output

CheckPoint data for updating an access rule

name uid type domain-name domain-uid action-name action-uid action-type content-direction creator enabled last-modifier
None 7867e584-0e68-42b4-ba18-2dd16cdbd436 access-rule SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde Drop 6c488338-8eec-4103-ad21-cd461ac2c473 RulebaseAction any adminsh true adminsh

checkpoint-access-rule-delete


Delete access rule

Base Command

checkpoint-access-rule-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID), rule name, or rule number. Required
layer Layer to which the rule belongs, identified by the name or UID. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.AccessRule.message String Operation status

Command Example

!checkpoint-access-rule-delete identifier=7867e584-0e68-42b4-ba18-2dd16cdbd436 layer=Network session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "AccessRule": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint data for deleting access rule range: 7867e584-0e68-42b4-ba18-2dd16cdbd436

message
OK

checkpoint-application-site-list


Retrieve all objects.

Base Command

checkpoint-application-site-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional
details_level The level of detail for results. Optional
domains_to_process A comma-separated list of domains to process. Optional

Context Output

Path Type Description
CheckPoint.ApplicationSite.name String Object names.
CheckPoint.ApplicationSite.uid String Objects UIDs.
CheckPoint.ApplicationSite.type String Object types.

Command Example

!checkpoint-application-site-list limit=5

Context Example

{
    "CheckPoint": {
        "ApplicationSite": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "#hashtags",
                "read-only": null,
                "type": "application-site",
                "uid": "00fa9e3c-36ef-0f65-e053-08241dc22da2"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "050 Plus",
                "read-only": null,
                "type": "application-site",
                "uid": "00fa9e44-4035-0f65-e053-08241dc22da2"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0test_application_site_10",
                "read-only": null,
                "type": "application-site",
                "uid": "446cff2c-7e1f-4dbc-a943-66740e890d67"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "1000keyboards",
                "read-only": null,
                "type": "application-site",
                "uid": "00fa9e3d-a077-0f65-e053-08241dc22da2"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "1000memories",
                "read-only": null,
                "type": "application-site",
                "uid": "00fa9e43-56d7-0f65-e053-08241dc22da2"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all access rule bases

name uid type
#hashtags 00fa9e3c-36ef-0f65-e053-08241dc22da2 application-site
050 Plus 00fa9e44-4035-0f65-e053-08241dc22da2 application-site
0test_application_site_10 446cff2c-7e1f-4dbc-a943-66740e890d67 application-site
1000keyboards 00fa9e3d-a077-0f65-e053-08241dc22da2 application-site
1000memories 00fa9e43-56d7-0f65-e053-08241dc22da2 application-site

checkpoint-application-site-add


Add application site

Base Command

checkpoint-application-site-add

Input

| Argument Name | Description | Required |
| — | — | — |
| name | Object name. Must be unique in the domain. | Required |
| primary_category | Each application is assigned to one primary category based on its most defining aspect. | Required |
| identifier | A comma-separated list of identifiers. Can be:
url-list(str): URLs that determine this particular application.
application-signature(str): Application signature generated by Signature Tool. | Required |
| session_id | Executes the command with the specified session ID. | Required |
| groups | A comma-separated list of group identifiers. | Optional |
| description | Description of the application site. | Optional |
| comments | Comment string. | Optional |
| color | The object color. | Optional |
| tags | A comma-separated list of tags to assign. | Optional |

Context Output

Path Type Description
CheckPoint.ApplicationSite.name String Object name.
CheckPoint.ApplicationSite.uid String Object UID.
CheckPoint.ApplicationSite.type String Object type.
CheckPoint.ApplicationSite.application-id Number Application ID.
CheckPoint.ApplicationSite.description String A description of the application.
CheckPoint.ApplicationSite.domain-name String Domain name.
CheckPoint.ApplicationSite.domain-uid String Domain UID.
CheckPoint.ApplicationSite.domain-type String Domain type.
CheckPoint.ApplicationSite.url-list String URLs that determine this application.
CheckPoint.ApplicationSite.creator String The creator of the object.
CheckPoint.ApplicationSite.last-modifier String The user that last modified this object.
CheckPoint.ApplicationSite.groups Unknown Collection of group identifiers.
CheckPoint.ApplicationSite.color String Color of the object.
CheckPoint.ApplicationSite.comments String Comments string.
CheckPoint.ApplicationSite.tags Unknown Collection of tag objects associated with the application site.

Command Example

!checkpoint-application-site-add name="test_application_site_1" primary_category="Test Category" identifier="qmasters.co" session_id="TEAK9kWnZ9Dhql9hYP5IR4aZEw1mrKdPjw3lRnxvp88"

Context Example

{
    "CheckPoint": {
        "ApplicationSite": {
                'name': 'test_application_site_1',
                'uid': '452f6cff-e7fb-47b8-abfe-53c668dc0038',
                'type': 'application-site',
                'domain-name': 'SMC User',
                'domain-uid': '41e821a0-3720-11e3-aa6e-0800200c9fde',
                'domain-type': None,
                'creator': 'adminsh',
                'last-modifier': 'adminsh',
                'application-id': 0,
                'description': '',
                'url-list': [
                  'qmasters.co'
                ]
    }
}

Human Readable Output

CheckPoint data for adding application site

application-id creator domain-name domain-uid last-modifier name type uid url-list
0 adminsh SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh test_application_site_1 application-site 452f6cff-e7fb-47b8-abfe-53c668dc0038 qmasters.co

checkpoint-application-site-update


Edit existing application using object name or uid.
It’s impossible to set ‘application-signature’ when the application was initialized with ‘url-list’ and vice-verse.

Base Command

checkpoint-application-site-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
description A description of the application. Optional
primary_category Each application is assigned to one primary category based on its most defining aspect. Optional
application_signature A comma-separated list of application signatures generated by Signature Tool. Optional
new_name New name of the object. Optional
urls_defined_as_regular_expression If “True”, the URL is defined as a Regular Expression. Default is “True”. Optional
url_list A comma-separated list of URLs that determine this particular application. This will replace the current URL collection. Optional
url_list_to_add A comma-separated list of URLs to add to the collection. Optional
url_list_to_remove Removes a URL from the comma-separated list of URLs. Optional
groups A comma-separated list of groups to update membership. Optional
session_id Executes the command with the specified session ID. Required
comments Update comments. Optional
color Update color. Optional
tags A comma-separated list of update tags. Optional

Context Output

Path Type Description
CheckPoint.ApplicationSite.name String Object name.
CheckPoint.ApplicationSite.uid String Object UID.
CheckPoint.ApplicationSite.type String Object type.
CheckPoint.ApplicationSite.application-id Number Application ID.
CheckPoint.ApplicationSite.description String A description for the application.
CheckPoint.ApplicationSite.domain-name String Domain name.
CheckPoint.ApplicationSite.domain-uid String Domain UID.
CheckPoint.ApplicationSite.domain-type String Domain type.
CheckPoint.ApplicationSite.url-list String URLs that determine this application.
CheckPoint.ApplicationSite.groups String Collection of group identifiers.
CheckPoint.ApplicationSite.primary-category String Objects primary category.
CheckPoint.ApplicationSite.color String Color of the object.
CheckPoint.ApplicationSite.comments String Comments string.
CheckPoint.ApplicationSite.tags Unknown Collection of tag objects associated with the application site.

Command Example

!checkpoint-application-site-update identifier=test_application_site session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ApplicationSite": {
            "application-id": 1073741861,
            "description": "",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "name": "test_application_site",
            "primary-category": "Test Category",
            "type": "application-site",
            "uid": "ccc788d1-b798-4e5c-8530-a6c375853730",
            "url-list": [
                "qmasters.co"
            ]
        }
    }
}

Human Readable Output

CheckPoint data for updating an application site

name uid type application-id primary-category url-list domain-name domain-uid
test_application_site ccc788d1-b798-4e5c-8530-a6c375853730 application-site 1073741861 Test Category qmasters.co SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde

checkpoint-application-site-delete


Delete existing application site object using object name or uid.

Base Command

checkpoint-application-site-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.ApplicationSite.message String Operation status.

Command Example

!checkpoint-application-site-delete identifier=test_application_site session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ApplicationSite": {
            "message": "OK"
        }
    }
}

Human Readable Output

CheckPoint data for deleting application site : test_application_site

message
OK

checkpoint-publish


publish changes

Base Command

checkpoint-publish

Input

Argument Name Description Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.Publish.task-id String Task id of the publish command.

Command Example

!checkpoint-publish session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Publish": {
            "task-id": "01234567-89ab-cdef-9338-e44df5384ac3"
        }
    }
}

Human Readable Output

CheckPoint data for publishing current session

task-id
01234567-89ab-cdef-9338-e44df5384ac3

checkpoint-install-policy


Intsalling policy

Base Command

checkpoint-install-policy

Input

Argument Name Description Required
policy_package The name of the Policy Package to install. Required
targets The targets on which to execute this command. Targets can be identified by their name, or object unique identifier. Required
access If “True”, will install the Access Control policy. Optional
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.InstallPolicy.task-id String Operation task ID.

Command Example

!checkpoint-install-policy policy_package=standard targets=test-gw session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "InstallPolicy": {
            "task-id": "d461078b-cc1e-41b6-869b-096438673323"
        }
    }
}

Human Readable Output

CheckPoint data for installing policy

task-id
d461078b-cc1e-41b6-869b-096438673323

checkpoint-verify-policy


Verifies the policy of the selected package.

Base Command

checkpoint-verify-policy

Input

Argument Name Description Required
policy_package The name of the Policy Package to verify. Required
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.VerifyPolicy.task-id String Operation task ID.

Command Example

!checkpoint-policy-verify policy_package=standard session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Human Readable Output

checkpoint-show-task


Show task progress and details.

Base Command

checkpoint-show-task

Input

Argument Name Description Required
task_id Unique identifier of one or more tasks. Required
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.ShowTask.task-id String Task ID
CheckPoint.ShowTask.task-name String Task name
CheckPoint.ShowTask.status String Task status
CheckPoint.ShowTask.progress-percentage Unknown Task prograss in percentage
CheckPoint.ShowTask.suppressed Boolean Indicates if the task is suppressed

Command Example

!checkpoint-show-task task_id=01234567-89ab-cdef-997f-2e3e3b4b2541

Context Example

{
    "CheckPoint": {
        "ShowTask": {
            "progress-percentage": 100,
            "status": "succeeded",
            "suppressed": false,
            "task-id": "01234567-89ab-cdef-997f-2e3e3b4b2541",
            "task-name": "Publish operation"
        }
    }
}

Human Readable Output

CheckPoint data for tasks

task-name task-id status suppressed progress-percentage
Publish operation 01234567-89ab-cdef-997f-2e3e3b4b2541 succeeded false 100

checkpoint-login-and-get-session-id


Login to CheckPoint and get the session id

Base Command

checkpoint-login-and-get-session-id

Input

Argument Name Description Required
session_timeout Session expiration timeout in seconds. Default is 600 seconds. Session timeout range is between 600 to 3600 seconds. Optional
domain Optional domain to start session in, for use with MDS login only. Optional

Context Output

Path Type Description
CheckPoint.Login.session-id String Session ID

Command Example

!checkpoint-login-and-get-session-id
!checkpoint-login-and-get-session-id domain='Corp'

Context Example

{
    "CheckPoint": {
        "Login": {
            "session-id": "LoUhF29pRkJsBiIWlMdBFy1LhHWXzE0VJT_lWpz4v0k"
        }
    }
}

Human Readable Output

CheckPoint session data

session-id
LoUhF29pRkJsBiIWlMdBFy1LhHWXzE0VJT_lWpz4v0k

checkpoint-logout


Logout from a given session

Base Command

checkpoint-logout

Input

Argument Name Description Required
session_id Session ID to log out from. Required

Context Output

There is no context output for this command.

Command Example

!checkpoint-logout session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{}

Human Readable Output

OK

checkpoint-packages-list


List all packages.

Base Command

checkpoint-packages-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of the results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.Packages.name String Name of the package
CheckPoint.Packages.uid String UID of the package
CheckPoint.Packages.type String Type of the package
CheckPoint.Packages.domain-name String Domain name
CheckPoint.Packages.domain-uid String Domain uid
CheckPoint.Packages.domain-type String Domain type

Command Example

!checkpoint-packages-list session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Packages": [
            {
                "name": "BenLayer",
                "type": "package",
                "uid": "9daac370-ad2d-4a21-a503-a312755aceaf"
            },
            {
                "name": "Standard",
                "type": "package",
                "uid": "ca4e32a8-bee0-423c-84f0-19bab6751d5e"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all packages

name uid type
BenLayer 9daac370-ad2d-4a21-a503-a312755aceaf package
Standard ca4e32a8-bee0-423c-84f0-19bab6751d5e package

checkpoint-gateways-list


Retrieve all gateways and servers

Base Command

checkpoint-gateways-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of the results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.Gateways.name String Gateway name
CheckPoint.Gateways.uid String Gateway uid
CheckPoint.Gateways.type String Gateway type
CheckPoint.Gateways.version String Gateway vesion
CheckPoint.Gateways.network-security-blades String Gateway network security blades
CheckPoint.Gateways.management-blades String Gateway management blades
CheckPoint.Gateways.domain-name String Domain name
CheckPoint.Gateways.domain-uid String Domain UID
CheckPoint.Gateways.domain-type String Doamin type

Command Example

!checkpoint-gateways-list session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Gateways": [
            {
                "management-blades": {
                    "logging-and-status": true,
                    "network-policy-management": true
                },
                "name": "gw-88a290",
                "network-security-blades": {},
                "type": "CpmiHostCkp",
                "uid": "98bee60f-23ab-bf41-ba29-4c574b9d6f7c",
                "version": "R80.30"
            },
            {
                "management-blades": {},
                "name": "test-gw",
                "network-security-blades": {
                    "firewall": true
                },
                "type": "simple-gateway",
                "uid": "3b83b6cb-d3cb-4596-8d90-ba9735d7d53c",
                "version": "R80.30"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all gateways

name uid type version network-security-blades management-blades
gw-88a290 98bee60f-23ab-bf41-ba29-4c574b9d6f7c CpmiHostCkp R80.30   network-policy-management: true
logging-and-status: true
test-gw 3b83b6cb-d3cb-4596-8d90-ba9735d7d53c simple-gateway R80.30 firewall: true  

checkpoint-application-site-category-list


Retrieve all application site category.

Base Command

checkpoint-application-site-category-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of the results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.ApplicationSiteCategory.name String Name of the package
CheckPoint.ApplicationSiteCategory.uid String UID of the package
CheckPoint.ApplicationSiteCategory.type String Type of the package
CheckPoint.ApplicationSiteCategory.domain-name String Domain name
CheckPoint.ApplicationSiteCategory.domain-uid String Domain uid
CheckPoint.ApplicationSiteCategory.domain-type String Domain type

Command Example

!checkpoint-application-site-category-list limit=5

Context Example

{
    "CheckPoint": {
        "ApplicationSiteCategory": [
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0new_app_site_category",
                "read-only": null,
                "type": "application-site-category",
                "uid": "d42e14e7-1c50-48d5-9412-2306dc8e5219"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0new_category_1",
                "read-only": null,
                "type": "application-site-category",
                "uid": "13e91cb3-1025-41a5-8203-89e28102f82f"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0new_category_2",
                "read-only": null,
                "type": "application-site-category",
                "uid": "f49849de-9132-479d-b73a-56696976c235"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0new_category_3",
                "read-only": null,
                "type": "application-site-category",
                "uid": "51ebf347-290f-4d8c-b99d-7aba73a5698c"
            },
            {
                "creator": null,
                "domain-name": null,
                "domain-uid": null,
                "groups": null,
                "ipv4-address": null,
                "last-modifier": null,
                "name": "0new_category_4",
                "read-only": null,
                "type": "application-site-category",
                "uid": "6b996605-099c-41fa-a4c6-1733ff895bac"
            }
        ]
    }
}

Human Readable Output

CheckPoint data for all application site category

name uid type
0new_app_site_category d42e14e7-1c50-48d5-9412-2306dc8e5219 application-site-category
0new_category_1 13e91cb3-1025-41a5-8203-89e28102f82f application-site-category
0new_category_2 f49849de-9132-479d-b73a-56696976c235 application-site-category
0new_category_3 51ebf347-290f-4d8c-b99d-7aba73a5698c application-site-category
0new_category_4 6b996605-099c-41fa-a4c6-1733ff895bac application-site-category

checkpoint-application-site-category-add


Add new application site category

Base Command

checkpoint-application-site-category-add

Input

Argument Name Description Required
identifier Object name or uid. Must be unique in the domain. Required
groups Collection of group identifiers. Optional
session_id Executes the command with the specified session ID. Required

Context Output

Path Type Description
CheckPoint.ApplicationSiteCategory.name String object name
CheckPoint.ApplicationSiteCategory.uid String object uid
CheckPoint.ApplicationSiteCategory.type String object type
CheckPoint.ApplicationSiteCategory.description String A description for the application.
CheckPoint.ApplicationSiteCategory.domain-name String domain name
CheckPoint.ApplicationSiteCategory.domain-uid String domain uid
CheckPoint.ApplicationSiteCategory.domain-type String domain name
CheckPoint.ApplicationSiteCategory.creator String Indicates the creator of the object
CheckPoint.ApplicationSiteCategory.last-modifier String Indicates the last user modified this object
CheckPoint.ApplicationSiteCategory.groups Unknown Collection of group identifiers

Command Example

!checkpoint-application-site-category-add identifier=application_site_category_0101 session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "ApplicationSite": {
            "application-id": null,
            "creator": "adminsh",
            "description": "",
            "domain-name": "SMC User",
            "domain-type": null,
            "domain-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde",
            "groups": [],
            "last-modifier": "adminsh",
            "name": "application_site_category_0101",
            "type": "application-site-category",
            "uid": "5fb2e946-7e9c-42db-8b0a-cf5056f427d8",
            "url-list": null
        }
    }
}

Human Readable Output

CheckPoint data for adding application site category application_site_category_0101

name uid type domain-name domain-uid creator last-modifier
application_site_category_0101 5fb2e946-7e9c-42db-8b0a-cf5056f427d8 application-site-category SMC User 41e821a0-3720-11e3-aa6e-0800200c9fde adminsh adminsh

checkpoint-application-site-category-get


Retrieve application site category object using object name or uid.

Base Command

checkpoint-application-site-category-get

Input

Argument Name Description Required
identifier application site category object name or UID. Required
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.ApplicationSiteCategory.name Unknown host name
CheckPoint.ApplicationSiteCategory.uid String object uid
CheckPoint.ApplicationSiteCategory.type Unknown object type
CheckPoint.ApplicationSiteCategory.domain-name String domain name
CheckPoint.ApplicationSiteCategory.domain-uid String domain uid
CheckPoint.ApplicationSiteCategory.read-only Boolean indicates if the object is read only
CheckPoint.ApplicationSiteCategory.creator String indicates the creator of the object
CheckPoint.ApplicationSiteCategory.last-modifier String indicates the last user modified the object

Command Example

!checkpoint-application-site-category-get identifier=Alcohol

Context Example

{
    "CheckPoint": {
        "ApplicationSiteCategory": {
            "creator": "System",
            "domain-name": "APPI Data",
            "domain-type": null,
            "domain-uid": "8bf4ac51-2df7-40e1-9bce-bedbedbedbed",
            "groups": [],
            "ipv4-address": null,
            "last-modifier": "System",
            "name": "Alcohol",
            "read-only": false,
            "type": "application-site-category",
            "uid": "00fa9e44-409e-0f65-e053-08241dc22da2"
        }
    }
}

Human Readable Output

CheckPoint data for adding application site category

name uid type domain-name domain-uid read-only creator last-modifier
Alcohol 00fa9e44-409e-0f65-e053-08241dc22da2 application-site-category APPI Data 8bf4ac51-2df7-40e1-9bce-bedbedbedbed false System System

checkpoint-show-objects


Retrieve data about objects.

Base Command

checkpoint-show-objects

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Optional
offset Number of the results to initially skip. Default is 0. Optional
filter_search Search expression to filter objects by. The provided text should be exactly the same as it would be given in Smart Console. The logical operators in the expression (‘AND’, ‘OR’) should be provided in capital letters. By default, the search involves both a textual search and a IP search. To use IP search only, set the “ip-only” parameter to true. Optional
ip_only If using “filter”, use this field to search objects by their IP address only, without involving the textual search. Optional
object_type The object type, e.g.: host, service-tcp, network, address-range. Default value is object. Optional
session_id Executes the command with the specified session ID. Optional

Context Output

Path Type Description
CheckPoint.Objects.name String Object name.
CheckPoint.Objects.uid String Object UID.
CheckPoint.Objects.type String Object type.
CheckPoint.Objects.ipv4-address String IPv4 address of the specified object.
CheckPoint.Objects.ipv6-address String IPv6 address of the specified object.
CheckPoint.Objects.domain-name String Domain name.
CheckPoint.Objects.domain-uid String Domain UID.
CheckPoint.Objects.creator String The creator of the object.
CheckPoint.Objects.last-modifier String The user that last modified the object.
CheckPoint.Objects.read-only Boolean Indicates if the object is read-only.
CheckPoint.Objects.groups Unknown Collection of group identifiers.

Command Example

!checkpoint-show-objects limit=3 filter_search=1.2.3.4 ip_only=true

Context Example

{
    "CheckPoint": {
        "Objects": {
            "creator": null,
            "domain-name": null,
            "domain-uid": null,
            "groups": null,
            "ipv4-address": null,
            "last-modifier": null,
            "name": "All_Internet",
            "read-only": null,
            "type": "address-range",
            "uid": "f90e0a2b-f166-427a-b47f-a107b6fe43b9"
        }
    }
}

Human Readable Output

CheckPoint data for objects

name uid type
All_Internet f90e0a2b-f166-427a-b47f-a107b6fe43b9 address-range

checkpoint-package-list


Get checkpoint-packages details.

Base Command

checkpoint-package-list

Input

Argument Name Description Required
identifier The object unique identifier or name. Required
session_id The session ID used to execute the command. Optional

Context Output

Path Type Description
CheckPoint.Package.name String The name of the package.
CheckPoint.Package.target-name String The name of the targe.
CheckPoint.Package.target-uid String The UID of the target.
CheckPoint.Package.revision.domain.domain-type String The type of the domain.
CheckPoint.Package.revision.domain.name String The name of the domain.
CheckPoint.Package.revision.domain.uid String The UID of the domain.
CheckPoint.Package.revision.type String The type of the revision.
CheckPoint.Package.revision.uid String The UID of the revision.

Command Example

!checkpoint-package-list identifier=Standard session_id=GFcJQ9N-Zv8eG33qc4WQ7d4zmdsNvK_l3GcnOUqo8ew

Context Example

{
    "CheckPoint": {
        "Package": {
            "name": "Standard",
            "target-name": "Host1",
            "target-uid": "41e821a0-3720-11e3-aa6e-0800200c9fde"
            "revision": {
                "domain": {
                    "name": "test",
                    "domain-type": "domain",
                    "uid": "41e821a0-3720-11e3-aa6e-0800200c9fde"
                },
                "type": "session",
                "uid", "41e821a0-3720-11e3-aa6e-0800200c9fde"
            }
        }
    }
}

Human Readable Output

CheckPoint data for objects

target-name name target-uid revision
Host1 Standard 41e821a0-3720-11e3-aa6e-0800200c9fde “domain”: {
“name”: “test”,
“domain-type”: “domain”,
“uid”: “41e821a0-3720-11e3-aa6e-0800200c9fde”
},
“type”: “session”,
“uid”, “41e821a0-3720-11e3-aa6e-0800200c9fde”

checkpoint-add-objects-batch


Creates new objects in batch. To achieve optimum performance when adding more than one object, use this API. Note: Errors and warnings are ignored when using this API, operation will apply changes while ignoring errors. It is not possible to publish changes that contain validations errors.

Base Command

checkpoint-add-objects-batch

Input

Argument Name Description Required
session_id Executes the command with the specified session ID. Required
object_type Type of objects to be created. Required
ipaddress ip addresses to be added. Required
name names of the ip objects to be added. Required

Context Output

Path Type Description
CheckPoint.AddObjectBatch.task-id string Task id of the add-objects-batch command.

checkpoint-delete-objects-batch


Deletes existing objects in batch using object name or uid. To achieve optimum performance when deleting more than one object, use this API.

Base Command

checkpoint-delete-objects-batch

Input

Argument Name Description Required
session_id Executes the command with the specified session ID. Required
name a comma separated list of names of the ip objects to be deleted. Required
object_type Type of objects to be deleted. Required

Context Output

Path Type Description
CheckPoint.DeleteObjectsBatch.task-id string Task id of the delete-objects-batch command.

checkpoint-show-threat-protection


Shows an existing threat protection using object name or uid

Base Command

checkpoint-show-threat-protection

Input

Argument Name Description Required
uid   Optional
name   Optional
showProfiles   Optional
additionalProperties   Optional

Context Output

Path Type Description
CheckPoint.ShowThreatProtection unknown  

checkpoint-show-threat-protections


Shows existing threat protections using a filter

Base Command

checkpoint-show-threat-protections

Input

Argument Name Description Required
filter   Optional
limit   Optional
offset   Optional
order   Optional

Context Output

Path Type Description
CheckPoint.ShowThreatProtections unknown  

checkpoint-set-threat-protection


Edit existing object using object name or uid.

Base Command

checkpoint-set-threat-protection

Input

Argument Name Description Required
uid   Optional
name   Optional
comments   Optional
follow_up   Optional
action   Optional
track   Optional
capturePackets   Optional
profiles   Optional

Context Output

Path Type Description
CheckPoint.SetThreatProtections unknown  

checkpoint-add-threat-profile


Add a new threat profile

Base Command

checkpoint-add-threat-profile

Input

Argument Name Description Required
name   Required
active_protections_performance_impact   Optional
active_protections_severity   Optional
confidence_level_high   Optional
confidence_level_low   Optional
confidence_level_medium   Optional
ips_settings   Optional
tags   Optional
use_indicators   Optional
anti_bot   Optional
anti_virus   Optional
ips   Optional
threat_emulation   Optional
exclude_protection_with_performance_impact   Optional
exclude_protection_with_performance_impact_mode   Optional
exclude_protection_with_severity   Optional
exclude_protection_with_severity_mode   Optional
newly_updated_protections   Optional

Context Output

Path Type Description
CheckPoint.AddedThreatProfiles unknown  

checkpoint-delete-threat-protections


Deletes threat protections.

Base Command

checkpoint-delete-threat-protections

Input

Argument Name Description Required
packageFormat Valid response is “snort”. Required

Context Output

Path Type Description
CheckPoint.DeletedThreatProtections unknown  

checkpoint-service-group-delete


Deletes the specified service group object.

Base Command

checkpoint-service-group-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

There is no context output for this command.

checkpoint-service-group-list


Gets a list of all service group objects.

Base Command

checkpoint-service-group-list

Input

Argument Name Description Required
filter 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. Optional
limit The maximum number of results to return. API default is 50. Optional
offset Number of results to initially skip. API default is 0. Optional
order Define the sort order using a single string made of comma-separated direction:field pairs. The direction can be ASC or DESC. Example: “ASC:type,ASC:name,DESC:uid”. Automatically sorts the results by Name, in the ascending order. Optional
show_as_ranges When true, the service group’s matched content is displayed as ranges of port numbers rather than service objects. Objects that are not represented using port numbers are presented as objects. The ‘members’ parameter is omitted from the response and instead the ‘ranges’ parameter is displayed. Possible values are: true, false. Default is false. Optional
dereference_group_members Indicates whether to dereference “members” field by details level for every object in reply. Possible values are: true, false. Default is false. Optional
show_membership Indicates whether to calculate and show “groups” field for every object in reply. Possible values are: true, false. Default is false. Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
domains_to_process Indicates which domains to process the commands on. It cannot be used with details_level set to ‘full’. Must be run from the System Domain. Possible values are: CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.ServiceGroup.name String Object name.
CheckPoint.ServiceGroup.uid String Object unique identifier.
CheckPoint.ServiceGroup.type String Object type.
CheckPoint.ServiceGroup.domain.name String Domain name.
CheckPoint.ServiceGroup.domain.uid String Domain UID.
CheckPoint.ServiceGroup.domain.domain-type String Domain type.

checkpoint-access-section-add


Adds a new access section.

Base Command

checkpoint-access-section-add

Input

Argument Name Description Required
layer Layer that the rule belongs to identified by the name or UID. Required
position_rule Rule name. Add rule relatively to another rule or section. Optional
position The position of the rule. Possible values are: top, above, below, bottom. Required
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
name Object name. Must be unique in the domain. Optional
tags Collection of tag identifiers. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.AccessSection.name String Object name.
CheckPoint.AccessSection.uid String Object unique identifier.
CheckPoint.AccessSection.type String Object type.
CheckPoint.AccessSection.domain.name String Domain name.
CheckPoint.AccessSection.domain.uid String Domain UID.
CheckPoint.AccessSection.domain.domain-type String Domain type.

checkpoint-service-group-add


Adds a new service group object.

Base Command

checkpoint-service-group-add

Input

Argument Name Description Required
name Object name. Must be unique in the domain. Required
members Collection of Network objects identified by the name or UID. Optional
color Color of the object. Should be one of existing colors. Possible values are: 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. Default is black. Optional
comments Comments string. Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
groups Collection of group identifiers. Optional
tags Collection of tag identifiers. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.ServiceGroup.name String Object name.
CheckPoint.ServiceGroup.uid String Object unique identifier.
CheckPoint.ServiceGroup.type String Object type.
CheckPoint.ServiceGroup.domain.name String Domain name.
CheckPoint.ServiceGroup.domain.uid String Domain UID.
CheckPoint.ServiceGroup.domain.domain-type String Domain type.
CheckPoint.ServiceGroup.members.name String Member object name.
CheckPoint.ServiceGroup.members.uid String Member object UID.
CheckPoint.ServiceGroup.members.type String Member object type.
CheckPoint.ServiceGroup.groups.name String Group name.
CheckPoint.ServiceGroup.groups.uid String Group UID.
CheckPoint.ServiceGroup.tags.name String Tag name.
CheckPoint.ServiceGroup.tags.uid String Tag UID.

checkpoint-access-section-delete


Deletes the specified access section.

Base Command

checkpoint-access-section-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
layer Layer that the rule belongs to identified by the name or UID. Required
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

There is no context output for this command.

checkpoint-service-group-get


Shows an existing service group object using object name or uid.

Base Command

checkpoint-service-group-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
show_as_ranges When true, the service group’s matched content is displayed as ranges of port numbers rather than service objects. Objects that are not represented using port numbers are presented as objects. The ‘members’ parameter is omitted from the response and instead the ‘ranges’ parameter is displayed. Possible values are: true, false. Default is false. Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.ServiceGroup.name String Object name.
CheckPoint.ServiceGroup.uid String Object unique identifier.
CheckPoint.ServiceGroup.type String Object type.
CheckPoint.ServiceGroup.domain.name String Domain name.
CheckPoint.ServiceGroup.domain.uid String Domain UID.
CheckPoint.ServiceGroup.domain.domain-type String Domain type.
CheckPoint.ServiceGroup.members.name String Member object name.
CheckPoint.ServiceGroup.members.uid String Member object UID.
CheckPoint.ServiceGroup.members.type String Member object type.
CheckPoint.ServiceGroup.groups.name String Group name.
CheckPoint.ServiceGroup.groups.uid String Group UID.
CheckPoint.ServiceGroup.tags.name String Tag name.
CheckPoint.ServiceGroup.tags.uid String Tag UID.

checkpoint-service-group-update


Updates the specified service group object.

Base Command

checkpoint-service-group-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
members_action When the action is “add” or “remove”, the members list is wrapped as {members_action: members}. Otherwise, members are sent without an action. Possible values are: add, remove. Optional
members List of Network objects identified by the name or UID. Optional
new_name New name of the object. Optional
color Color of the object. Should be one of existing colors. Possible values are: 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. Default is black. Optional
comments Comments string. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
groups_action When the action is “add” or “remove”, the groups list is wrapped as {groups_action: groups}. Otherwise, groups are sent without an action. Possible values are: add, remove. Optional
groups List of group identifiers. Optional
tags_action When the action is “add” or “remove”, the tags list is wrapped as {tags_action: tags}. Otherwise, tags are sent without an action. Possible values are: add, remove. Optional
tags List of tag identifiers. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.ServiceGroup.name String Object name.
CheckPoint.ServiceGroup.uid String Object unique identifier.
CheckPoint.ServiceGroup.type String Object type.
CheckPoint.ServiceGroup.domain.name String Domain name.
CheckPoint.ServiceGroup.domain.uid String Domain UID.
CheckPoint.ServiceGroup.domain.domain-type String Domain type.
CheckPoint.ServiceGroup.members.name String Member object name.
CheckPoint.ServiceGroup.members.uid String Member object UID.
CheckPoint.ServiceGroup.members.type String Member object type.
CheckPoint.ServiceGroup.groups.name String Group name.
CheckPoint.ServiceGroup.groups.uid String Group UID.
CheckPoint.ServiceGroup.tags.name String Tag name.
CheckPoint.ServiceGroup.tags.uid String Tag UID.

checkpoint-service-group-clone


Clones an existing service group object.

Base Command

checkpoint-service-group-clone

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name of the service group to clone. Required
members_action When the action is “add” or “remove”, the members list is wrapped as {members_action: members}. Otherwise, members are sent without an action. Possible values are: add, remove. Optional
members List of Network objects identified by the name or UID. Optional
new_name New name of the object. Optional
color Color of the object. Should be one of existing colors. Possible values are: 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. Default is black. Optional
comments Comments string. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
groups_action When the action is “add” or “remove”, the groups list is wrapped as {groups_action: groups}. Otherwise, groups are sent without an action. Possible values are: add, remove. Optional
groups List of group identifiers. Optional
tags_action When the action is “add” or “remove”, the tags list is wrapped as {tags_action: tags}. Otherwise, tags are sent without an action. Possible values are: add, remove. Optional
tags List of tag identifiers. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.ServiceGroup.name String Object name.
CheckPoint.ServiceGroup.uid String Object unique identifier.
CheckPoint.ServiceGroup.type String Object type.
CheckPoint.ServiceGroup.domain.name String Domain name.
CheckPoint.ServiceGroup.domain.uid String Domain UID.
CheckPoint.ServiceGroup.domain.domain-type String Domain type.
CheckPoint.ServiceGroup.members.name String Member object name.
CheckPoint.ServiceGroup.members.uid String Member object UID.
CheckPoint.ServiceGroup.members.type String Member object type.
CheckPoint.ServiceGroup.groups.name String Group name.
CheckPoint.ServiceGroup.groups.uid String Group UID.
CheckPoint.ServiceGroup.tags.name String Tag name.
CheckPoint.ServiceGroup.tags.uid String Tag UID.

checkpoint-access-section-update


Updates the specified access section.

Base Command

checkpoint-access-section-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
layer Layer that the rule belongs to identified by the name or UID. Required
new_name New name of the object. Optional
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
tags_action When the action is “add” or “remove”, the tags list is wrapped as {tags_action: tags}. Otherwise, tags are sent without an action. Possible values are: add, remove. Optional
tags List of tag identifiers. Optional
ignore_warnings Apply changes ignoring warnings. Possible values are: true, false. Default is false. Optional
ignore_errors Apply changes ignoring errors. You won’t be able to publish such changes.
If ignore-warnings flag was omitted - warnings will also be ignored. Possible values are: true, false. Default is false.
Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.AccessSection.name String Object name.
CheckPoint.AccessSection.uid String Object unique identifier.
CheckPoint.AccessSection.type String Object type.
CheckPoint.AccessSection.domain.name String Domain name.
CheckPoint.AccessSection.domain.uid String Domain UID.
CheckPoint.AccessSection.domain.domain-type String Domain type.

checkpoint-access-section-get


Shows an existing access section using object name or uid.

Base Command

checkpoint-access-section-get

Input

Argument Name Description Required
layer Layer that the rule belongs to identified by the name or UID. Required
identifier Object unique identifier (UID) or name. Required
details_level 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. Possible values are: uid, standard, full. Default is standard. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.AccessSection.name String Object name.
CheckPoint.AccessSection.uid String Object unique identifier.
CheckPoint.AccessSection.type String Object type.
CheckPoint.AccessSection.domain.name String Domain name.
CheckPoint.AccessSection.domain.uid String Domain UID.
CheckPoint.AccessSection.domain.domain-type String Domain type.

checkpoint-network-get


Gets full data for the specified network object.

Base Command

checkpoint-network-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
details_level 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. Possible values are: standard, full, uid. Optional

Context Output

Path Type Description
CheckPoint.Network.name String Object name.
CheckPoint.Network.uid String Object UID.
CheckPoint.Network.type String Object type.
CheckPoint.Network.domain.name String Domain name.
CheckPoint.Network.domain.uid String Domain UID.
CheckPoint.Network.read-only Boolean Indicates if the object is read-only.
CheckPoint.Network.meta-info.creator String The creator of the object.
CheckPoint.Network.meta-info.last-modifier String The user that last modified the object.

checkpoint-network-list


Retrieve a list of network objects.

Base Command

checkpoint-network-list

Input

Argument Name Description Required
limit The maximum number of results to return. Default is 50. Max is 500. Optional
offset Number of results to initially skip. Default is 0. Optional
session_id Executes the command with the specified session ID. Default is None. Optional
details_level 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. Possible values are: standard, full, uid. Optional

Context Output

Path Type Description
CheckPoint.Network.name String Object name.
CheckPoint.Network.uid String Object UID.
CheckPoint.Network.type String Object type.

checkpoint-network-add


Create a new network object.

Base Command

checkpoint-network-add

Input

Argument Name Description Required
identifier Object name. Must be unique in the domain. Required
subnet IPv4 network address. Required
mask_length IPv4 network mask length (e.g. 24). Optional
subnet_mask IPv4 network mask (e.g. 255.255.255.0). Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional
broadcast Allow broadcast address inclusion. Possible values are: disallow, allow. Optional
nat_install_on Gateway for NAT rule. Optional
nat_hide_behind Hide behind method. This parameter is forbidden when nat_method is “static”. Possible values are: gateway, ip_address. Optional
nat_settings_auto_rule Whether to add automatic address translation rules. Possible values are: true, false. Default is false. Optional
nat_settings_ip IPv4 address. This parameter is not required when nat_method is “hide” and nat_hide_behind is “gateway”. Optional
nat_method NAT translation method. Possible values are: hide, static. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.Network.name String Object name.
CheckPoint.Network.uid String Object UID.
CheckPoint.Network.type String Object type.
CheckPoint.Network.domain.name String Domain name.
CheckPoint.Network.domain.uid String Domain UID.
CheckPoint.Network.domain.domain-type String Domain type.
CheckPoint.Network.meta-info.creator String The creator of the object.
CheckPoint.Network.meta-info.last-modifier String The user that last modified the object.
CheckPoint.Network.read-only Boolean Indicates if the object is read-only.

checkpoint-network-update


Update an existing network object.

Base Command

checkpoint-network-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
new_identifier New name of the object. Optional
subnet IPv4 network address. Optional
subnet_mask IPv4 network mask (e.g. 255.255.255.0). Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional
broadcast Allow broadcast address inclusion. Possible values are: disallow, allow. Optional
nat_install_on Gateway for NAT rule. Optional
nat_hide_behind Hide behind method. This parameter is forbidden when nat_method is “static”. Possible values are: gateway, ip_address. Optional
nat_settings_auto_rule Whether to add automatic address translation rules. Possible values are: true, false. Default is false. Optional
nat_settings_ip IPv4 address. This parameter is not required when nat_method is “hide” and nat_hide_behind is “gateway”. Optional
nat_method NAT translation method. Possible values are: hide, static. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.Network.name String Object name.
CheckPoint.Network.uid String Object UID.
CheckPoint.Network.type String Object type.
CheckPoint.Network.domain.name String Domain name.
CheckPoint.Network.domain.uid String Domain UID.
CheckPoint.Network.domain.domain-type String Domain type.
CheckPoint.Network.meta-info.creator String The creator of the object.
CheckPoint.Network.meta-info.last-modifier String The user that last modified the object.
CheckPoint.Network.read-only Boolean Indicates if the object is read-only.
CheckPoint.Network.comments String Comments string.

checkpoint-network-delete


Delete a network object.

Base Command

checkpoint-network-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
ignore_warnings Whether to ignore warnings when deleting the network object. Possible values are: true, false. Default is true. Optional

Context Output

There is no context output for this command.

checkpoint-service-get


Gets full data for the specified service object.

Base Command

checkpoint-service-get

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
service_type The type of service to retrieve. Possible values are: tcp, udp, icmp. Required

Context Output

Path Type Description
CheckPoint.TCPService.name String Object name.
CheckPoint.TCPService.uid String Object UID.
CheckPoint.TCPService.type String Object type.
CheckPoint.TCPService.domain.name String Domain name.
CheckPoint.TCPService.domain.uid String Domain UID.
CheckPoint.TCPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.TCPService.meta-info.creator String The creator of the object.
CheckPoint.TCPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.TCPService.port String The number of the port used to provide this service.
CheckPoint.UDPService.name String Object name.
CheckPoint.UDPService.uid String Object UID.
CheckPoint.UDPService.type String Object type.
CheckPoint.UDPService.domain.name String Domain name.
CheckPoint.UDPService.domain.uid String Domain UID.
CheckPoint.UDPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.UDPService.meta-info.creator String The creator of the object.
CheckPoint.UDPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.UDPService.port String The number of the port used to provide this service.
CheckPoint.ICMPService.name String Object name.
CheckPoint.ICMPService.uid String Object UID.
CheckPoint.ICMPService.type String Object type.
CheckPoint.ICMPService.domain.name String Domain name.
CheckPoint.ICMPService.domain.uid String Domain UID.
CheckPoint.ICMPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.ICMPService.meta-info.creator String The creator of the object.
CheckPoint.ICMPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.ICMPService.icmp-type Number ICMP type as listed in RFC 792.
CheckPoint.ICMPService.icmp-code Number ICMP code as listed in RFC 792.

checkpoint-service-list


Retrieve a list of service objects. When identifier is provided, returns a single service object.

Base Command

checkpoint-service-list

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. When provided, calls the single-object endpoint instead of the list endpoint. Optional
session_id Executes the command with the specified session ID. Default is None. Optional
service_type The type of service to retrieve. Possible values are: tcp, udp, icmp. Required
limit The maximum number of results to return. Default is 50. Max is 500. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional

Context Output

Path Type Description
CheckPoint.TCPService.name String Object name.
CheckPoint.TCPService.uid String Object UID.
CheckPoint.TCPService.type String Object type.
CheckPoint.TCPService.port String The number of the port used to provide this service.
CheckPoint.TCPService.domain.name String Domain name.
CheckPoint.TCPService.domain.uid String Domain UID.
CheckPoint.TCPService.domain.domain-type String Domain type.
CheckPoint.UDPService.name String Object name.
CheckPoint.UDPService.uid String Object UID.
CheckPoint.UDPService.type String Object type.
CheckPoint.UDPService.port String The number of the port used to provide this service.
CheckPoint.UDPService.domain.name String Domain name.
CheckPoint.UDPService.domain.uid String Domain UID.
CheckPoint.UDPService.domain.domain-type String Domain type.
CheckPoint.ICMPService.name String Object name.
CheckPoint.ICMPService.uid String Object UID.
CheckPoint.ICMPService.type String Object type.
CheckPoint.ICMPService.icmp-type Number ICMP type as listed in RFC 792.
CheckPoint.ICMPService.icmp-code Number ICMP code as listed in RFC 792.
CheckPoint.ICMPService.domain.name String Domain name.
CheckPoint.ICMPService.domain.uid String Domain UID.
CheckPoint.ICMPService.domain.domain-type String Domain type.

checkpoint-tcp-service-add


Create a new TCP service object.

Base Command

checkpoint-tcp-service-add

Input

Argument Name Description Required
identifier Object name. Must be unique in the domain. Required
session_id Executes the command with the specified session ID. Default is None. Optional
port The number of the port used to provide this service. To specify a port range, place a hyphen between the lowest and highest port numbers (for example, 44-55). Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
session_timeout Time (in seconds) before the session times out. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.TCPService.name String Object name.
CheckPoint.TCPService.uid String Object UID.
CheckPoint.TCPService.type String Object type.
CheckPoint.TCPService.domain.name String Domain name.
CheckPoint.TCPService.domain.uid String Domain UID.
CheckPoint.TCPService.domain.domain-type String Domain type.
CheckPoint.TCPService.meta-info.creator String The creator of the object.
CheckPoint.TCPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.TCPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.TCPService.port String The number of the port used to provide this service.

checkpoint-udp-service-add


Create a new UDP service object.

Base Command

checkpoint-udp-service-add

Input

Argument Name Description Required
identifier Object name. Must be unique in the domain. Required
session_id Executes the command with the specified session ID. Default is None. Optional
port The number of the port used to provide this service. To specify a port range, place a hyphen between the lowest and highest port numbers (for example, 44-55). Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
session_timeout Time (in seconds) before the session times out. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.UDPService.name String Object name.
CheckPoint.UDPService.uid String Object UID.
CheckPoint.UDPService.type String Object type.
CheckPoint.UDPService.domain.name String Domain name.
CheckPoint.UDPService.domain.uid String Domain UID.
CheckPoint.UDPService.domain.domain-type String Domain type.
CheckPoint.UDPService.meta-info.creator String The creator of the object.
CheckPoint.UDPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.UDPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.UDPService.port String The number of the port used to provide this service.

checkpoint-icmp-service-add


Create a new ICMP service object.

Base Command

checkpoint-icmp-service-add

Input

Argument Name Description Required
identifier Object name. Must be unique in the domain. Required
session_id Executes the command with the specified session ID. Default is None. Optional
icmp_type ICMP type as listed in RFC 792. (default is 0). Optional
icmp_code ICMP code as listed in RFC 792. (default is 0). Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.ICMPService.name String Object name.
CheckPoint.ICMPService.uid String Object UID.
CheckPoint.ICMPService.type String Object type.
CheckPoint.ICMPService.domain.name String Domain name.
CheckPoint.ICMPService.domain.uid String Domain UID.
CheckPoint.ICMPService.domain.domain-type String Domain type.
CheckPoint.ICMPService.meta-info.creator String The creator of the object.
CheckPoint.ICMPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.ICMPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.ICMPService.icmp-type Number ICMP type as listed in RFC 792.
CheckPoint.ICMPService.icmp-code Number ICMP code as listed in RFC 792.

checkpoint-tcp-service-update


Update an existing TCP service object.

Base Command

checkpoint-tcp-service-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
new_identifier New name of the object. Optional
port The number of the port used to provide this service. Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.TCPService.name String Object name.
CheckPoint.TCPService.uid String Object UID.
CheckPoint.TCPService.type String Object type.
CheckPoint.TCPService.domain.name String Domain name.
CheckPoint.TCPService.domain.uid String Domain UID.
CheckPoint.TCPService.domain.domain-type String Domain type.
CheckPoint.TCPService.meta-info.creator String The creator of the object.
CheckPoint.TCPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.TCPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.TCPService.comments String Comments string.
CheckPoint.TCPService.port String The number of the port used to provide this service.

checkpoint-udp-service-update


Update an existing UDP service object.

Base Command

checkpoint-udp-service-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
new_identifier New name of the object. Optional
port The number of the port used to provide this service. Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.UDPService.name String Object name.
CheckPoint.UDPService.uid String Object UID.
CheckPoint.UDPService.type String Object type.
CheckPoint.UDPService.domain.name String Domain name.
CheckPoint.UDPService.domain.uid String Domain UID.
CheckPoint.UDPService.domain.domain-type String Domain type.
CheckPoint.UDPService.meta-info.creator String The creator of the object.
CheckPoint.UDPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.UDPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.UDPService.comments String Comments string.
CheckPoint.UDPService.port String The number of the port used to provide this service.

checkpoint-icmp-service-update


Update an existing ICMP service object.

Base Command

checkpoint-icmp-service-update

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
new_identifier New name of the object. Optional
icmp_type ICMP type as listed in RFC 792. Optional
icmp_code ICMP code as listed in RFC 792. Optional
comments Comments string. Optional
color Color of the object. Possible values are: 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. Default is black. Optional
tags Collection of tag identifiers. Optional

Context Output

Path Type Description
CheckPoint.ICMPService.name String Object name.
CheckPoint.ICMPService.uid String Object UID.
CheckPoint.ICMPService.type String Object type.
CheckPoint.ICMPService.domain.name String Domain name.
CheckPoint.ICMPService.domain.uid String Domain UID.
CheckPoint.ICMPService.domain.domain-type String Domain type.
CheckPoint.ICMPService.meta-info.creator String The creator of the object.
CheckPoint.ICMPService.meta-info.last-modifier String The user that last modified the object.
CheckPoint.ICMPService.read-only Boolean Indicates if the object is read-only.
CheckPoint.ICMPService.comments String Comments string.
CheckPoint.ICMPService.icmp-type Number ICMP type as listed in RFC 792.
CheckPoint.ICMPService.icmp-code Number ICMP code as listed in RFC 792.

checkpoint-service-delete


Delete a service object.

Base Command

checkpoint-service-delete

Input

Argument Name Description Required
identifier Object unique identifier (UID) or name. Required
session_id Executes the command with the specified session ID. Default is None. Optional
service_type The type of service to delete. Possible values are: tcp, udp, icmp. Required
ignore_warnings Whether to ignore warnings when deleting the service object. Possible values are: true, false. Default is false. Optional

Context Output

There is no context output for this command.

checkpoint-nat-rule-get


Gets full data for the specified NAT rule.

Base Command

checkpoint-nat-rule-get

Input

Argument Name Description Required
identifier Rule name or Rule number. Required
package Name of the package. Required
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.NatRule.uid String Object unique identifier.
CheckPoint.NatRule.name String Object name.
CheckPoint.NatRule.type String Object type.
CheckPoint.NatRule.enabled Boolean Whether the rule is enabled.
CheckPoint.NatRule.method String NAT translation method.
CheckPoint.NatRule.original-source.name String Original source object name.
CheckPoint.NatRule.original-destination.name String Original destination object name.
CheckPoint.NatRule.original-service.name String Original service object name.
CheckPoint.NatRule.translated-source.name String Translated source object name.
CheckPoint.NatRule.translated-destination.name String Translated destination object name.
CheckPoint.NatRule.translated-service.name String Translated service object name.
CheckPoint.NatRule.comments String Comments string.
CheckPoint.NatRule.domain.name String Domain name.
CheckPoint.NatRule.domain.uid String Domain UID.
CheckPoint.NatRule.domain.domain-type String Domain type.

checkpoint-nat-rule-list


Retrieve a list of NAT rules from the rulebase.

Base Command

checkpoint-nat-rule-list

Input

Argument Name Description Required
package Name of the package. Required
limit The maximum number of results to return. Default is 50. Max is 500. Default is 50. Optional
offset Number of results to initially skip. Default is 0. Optional
filter Search expression to filter the rulebase. The provided text should be exactly the same as it would be given in Smart Console. The logical operators in the expression (AND, OR) should be provided in capital letters. Default operator is OR. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.NatRule.uid String Object unique identifier.
CheckPoint.NatRule.name String Object name.

checkpoint-nat-rule-add


Add a new NAT rule.

Base Command

checkpoint-nat-rule-add

Input

Argument Name Description Required
package Name of the package. Required
position Position in the rulebase. Possible values are: top, bottom. Required
name Rule name. Optional
original_source Original source object. Optional
original_destination Original destination object. Optional
original_service Original service object. Optional
translated_source Translated source object. Optional
translated_destination Translated destination object. Optional
translated_service Translated service object. Optional
install_on Which Gateways identified by the name or UID to install the policy on. Optional
comments Comments string. Optional
enabled Enable/Disable the rule. Possible values are: true, false. Optional
nat_method NAT translation method. Possible values are: static, hide, nat64, nat46, cgnat. Optional
tags Collection of tag identifiers. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.NatRule.uid String Object unique identifier.
CheckPoint.NatRule.name String Object name.
CheckPoint.NatRule.type String Object type.
CheckPoint.NatRule.enabled Boolean Whether the rule is enabled.
CheckPoint.NatRule.method String NAT translation method.
CheckPoint.NatRule.original-source.name String Original source object name.
CheckPoint.NatRule.original-destination.name String Original destination object name.
CheckPoint.NatRule.original-service.name String Original service object name.
CheckPoint.NatRule.translated-source.name String Translated source object name.
CheckPoint.NatRule.translated-destination.name String Translated destination object name.
CheckPoint.NatRule.translated-service.name String Translated service object name.
CheckPoint.NatRule.comments String Comments string.
CheckPoint.NatRule.domain.name String Domain name.
CheckPoint.NatRule.domain.uid String Domain UID.
CheckPoint.NatRule.domain.domain-type String Domain type.

checkpoint-nat-rule-update


Update an existing NAT rule.

Base Command

checkpoint-nat-rule-update

Input

Argument Name Description Required
identifier Rule name or Rule number. Required
package Name of the package. Required
original_source Original source object. Optional
original_destination Original destination object. Optional
translated_source Translated source object. Optional
translated_destination Translated destination object. Optional
original_service Original service object. Optional
translated_service Translated service object. Optional
comments Comments string. Optional
enabled Enable/Disable the rule. Possible values are: true, false. Optional
nat_method NAT translation method. Possible values are: static, hide, nat64, nat46, cgnat. Optional
tags Collection of tag identifiers. Optional
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

Path Type Description
CheckPoint.NatRule.uid String Object unique identifier.
CheckPoint.NatRule.name String Object name.
CheckPoint.NatRule.type String Object type.
CheckPoint.NatRule.enabled Boolean Whether the rule is enabled.
CheckPoint.NatRule.method String NAT translation method.
CheckPoint.NatRule.original-source.name String Original source object name.
CheckPoint.NatRule.original-destination.name String Original destination object name.
CheckPoint.NatRule.original-service.name String Original service object name.
CheckPoint.NatRule.translated-source.name String Translated source object name.
CheckPoint.NatRule.translated-destination.name String Translated destination object name.
CheckPoint.NatRule.translated-service.name String Translated service object name.
CheckPoint.NatRule.comments String Comments string.
CheckPoint.NatRule.domain.name String Domain name.
CheckPoint.NatRule.domain.uid String Domain UID.
CheckPoint.NatRule.domain.domain-type String Domain type.

checkpoint-nat-rule-delete


Delete a NAT rule.

Base Command

checkpoint-nat-rule-delete

Input

Argument Name Description Required
identifier Rule name or Rule number. Required
package Name of the package. Required
session_id Executes the command with the specified session ID. Default is None. Optional

Context Output

There is no context output for this command.

Configuration parameters

  • server — Server URL (e.g. example.net or 8.8.8.8) (required)
  • port — Server Port (e.g. 4434) (required)
  • domain — Domain (used in Multi Domain Server)
  • username — Username (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (77)

  • checkpoint-access-rule-add

    Creates a new access rule.

  • checkpoint-access-rule-delete

    Deletes the specified access rule.

  • checkpoint-access-rule-list

    Returns the entire Access Rules layer.

  • checkpoint-access-rule-update

    Modifies an existing access rule, using object name or UID.

  • checkpoint-access-section-add

    Adds a new access section.

  • checkpoint-access-section-delete

    Deletes the specified access section.

  • checkpoint-access-section-get

    Shows an existing access section using object name or UID.

  • checkpoint-access-section-update

    Updates the specified access section.

  • checkpoint-add-objects-batch

    Creates new objects in batch. To achieve optimum performance when adding more than one object, use this API. Note: Errors and warnings are ignored when using this API, operation will apply changes while ignoring errors. It is not possible to publish changes that contain validations errors.

  • checkpoint-add-threat-profile

    Add a new threat profile.

  • checkpoint-address-range-add

    Adds an address range object.

  • checkpoint-address-range-delete

    Deletes the specified address range.

  • checkpoint-address-range-get

    Gets full data for the specified address range object.

  • checkpoint-address-range-list

    Gets a list all address range objects.

  • checkpoint-address-range-update

    Updates the specified address range object.

  • checkpoint-application-site-add

    Adds an application site.

  • checkpoint-application-site-category-add

    Adds new application site category.

  • checkpoint-application-site-category-get

    Retrieve application site category object using object name or UID.

  • checkpoint-application-site-category-list

    Retrieve all application site category.

  • checkpoint-application-site-delete

    Deletes an existing application site object using the object name or UID.

  • checkpoint-application-site-list

    Retrieves all application site objects.

  • checkpoint-application-site-update

    Edits an existing application using the object name or UID. It's impossible to set 'application-signature' when the application was initialized with 'url-list' and vice-versa.

  • checkpoint-delete-objects-batch

    Deletes existing objects in batch using object name or uid. To achieve optimum performance when deleting more than one object, use this API.

  • checkpoint-delete-threat-protections

    Deletes threat protections.

  • checkpoint-gateways-list

    Retrieve all gateways and servers.

  • checkpoint-group-add

    Adds a group.

  • checkpoint-group-delete

    Deletes the specified group object.

  • checkpoint-group-get

    Gets full data for the specified group.

  • checkpoint-group-list

    Gets a list of all groups.

  • checkpoint-group-update

    Updates the specified group object.

  • checkpoint-host-add

    Adds a new host.

  • checkpoint-host-delete

    Deletes the specified host.

  • checkpoint-host-get

    Gets full data for the specified host.

  • checkpoint-host-list

    Returns all host objects.

  • checkpoint-host-update

    Updates the specified host.

  • checkpoint-icmp-service-add

    Creates a new ICMP service object.

  • checkpoint-icmp-service-update

    Updates an existing ICMP service object.

  • checkpoint-install-policy

    Intsalls an Access Control policy.

  • checkpoint-login-and-get-session-id

    Log in to CheckPoint and get the session ID.

  • checkpoint-logout

    Log out from a given session.

  • checkpoint-nat-rule-add

    Add a new NAT rule.

  • checkpoint-nat-rule-delete

    Deletes a NAT rule.

  • checkpoint-nat-rule-get

    Gets full data for the specified NAT rule.

  • checkpoint-nat-rule-list

    Retrieves a list of NAT rules from the rulebase.

  • checkpoint-nat-rule-update

    Updates an existing NAT rule.

  • checkpoint-network-add

    Create a new network object.

  • checkpoint-network-delete

    Deletes a network object.

  • checkpoint-network-get

    Gets full data for the specified network object.

  • checkpoint-network-list

    Retrieves a list of network objects.

  • checkpoint-network-update

    Update an existing network object.

  • checkpoint-package-list

    Retrieve the details of Checkpoint packages.

  • checkpoint-packages-list

    List all packages.

  • checkpoint-publish

    Publishes changes.

  • checkpoint-service-delete

    Deletes a service object.

  • checkpoint-service-get

    Gets full data for the specified service object.

  • checkpoint-service-group-add

    Adds a new service group object.

  • checkpoint-service-group-clone

    Clones an existing service group object.

  • checkpoint-service-group-delete

    Deletes the specified service group object.

  • checkpoint-service-group-get

    Shows an existing service group object using object name or UID.

  • checkpoint-service-group-list

    Gets a list of all service group objects.

  • checkpoint-service-group-update

    Updates the specified service group object.

  • checkpoint-service-list

    Retrieves a list of service objects. When the identifier is provided, returns a single service object.

  • checkpoint-set-threat-protection

    Edit existing object using object name or uid.

  • checkpoint-show-objects

    Retrieve data about objects.

  • checkpoint-show-task

    Show task progress and details.

  • checkpoint-show-threat-protection

    Shows an existing threat protection using object name or uid.

  • checkpoint-show-threat-protections

    Shows existing threat protections using a filter.

  • checkpoint-tcp-service-add

    Creates a new TCP service object.

  • checkpoint-tcp-service-update

    Updates an existing TCP service object.

  • checkpoint-threat-indicator-add

    Adds a threat indicator.

  • checkpoint-threat-indicator-delete

    Deletes the specified threat indicator.

  • checkpoint-threat-indicator-get

    Gets data for the specified list indicator.

  • checkpoint-threat-indicator-list

    Gets a list of all threat indicators.

  • checkpoint-threat-indicator-update

    Updates the specified indicator.

  • checkpoint-udp-service-add

    Creates a new UDP service object.

  • checkpoint-udp-service-update

    Update an existing UDP service object.

  • checkpoint-verify-policy

    Verifies the policy of the selected package.

import demistomock as demisto  # noqa: F401
import urllib3
from CommonServerPython import *  # noqa: F401

# Disable insecure warnings
urllib3.disable_warnings()

DEFAULT_LIST_FIELD = [
    "name",
    "uid",
    "type",
    "ipv4-address",
    "ipv6-address",
    "domain-name",
    "domain-uid",
    "domain-type",
    "groups",
    "read-only",
    "creator",
    "last-modifier",
]


class Client(BaseClient):
    """
    Client for CheckPoint RESTful API.
    Args:
          base_url (str): the URL of CheckPoint.
          sid (str): CheckPoint session ID of the current user session. [Optional]
          use_ssl (bool): specifies whether to verify the SSL certificate or not.
          use_proxy (bool): specifies if to use Demisto proxy settings.
    """

    def __init__(self, base_url: str, use_ssl: bool, use_proxy: bool, sid: Optional[str] = None, **kwargs):
        super().__init__(base_url, verify=use_ssl, proxy=use_proxy, **kwargs)
        self.verify = use_ssl
        self.sid = sid if sid != "None" else None
        self.has_performed_login = False  # set to True once username and password are used to login.
        """ Note that Client is "disposable", and will not be the same object on the next command,
        has_performed_login is used to decide whether to logout after running the command."""

    @property
    def headers(self):
        if self.sid is None:  # for logging in, before self.sid is set
            return {"Content-Type": "application/json"}
        return {"Content-Type": "application/json", "X-chkp-sid": self.sid}

    def login(self, username: str, password: str, session_timeout: int, domain_arg: str = None) -> CommandResults:
        """login to a checkpoint admin account using username and password."""

        json_body = {"user": username, "password": password, "session-timeout": session_timeout}
        if domain_arg:
            json_body["domain"] = domain_arg

        response = self._http_request(method="POST", url_suffix="login", json_data=json_body, headers=self.headers)
        sid = response.get("sid", "")

        if sid:
            self.sid = sid
            self.has_performed_login = True
            demisto.debug(f"login: success, saving sid={sid} to integrationContext")
            demisto.setIntegrationContext({"cp_sid": sid})
        else:
            demisto.debug("login: failed, clearing integrationContext")
            demisto.setIntegrationContext({})

        printable_result = {"session-id": sid}
        readable_output = tableToMarkdown("CheckPoint session data:", printable_result)

        return CommandResults(
            outputs_prefix="CheckPoint.Login",
            outputs_key_field="uid",
            readable_output=readable_output,
            outputs=printable_result,
            raw_response=response,
        )

    def restore_sid_from_context_or_login(self, username: str, password: str, session_timeout: int, domain_arg: str = None):
        if sid_from_context := demisto.getIntegrationContext().get("cp_sid"):
            demisto.debug(f"restore sid: success, setting restored sid on Client (sid={sid_from_context})")
            self.sid = sid_from_context
        else:
            demisto.debug("restore sid: failed to restore, logging in")
            self.login(username, password, session_timeout, domain_arg)

    def test_connection(self):
        """
        Returns ok on a successful connection to the CheckPoint Firewall API.
        Otherwise, an exception should be raised by self._http_request()
        """
        response = self._http_request(
            method="POST",
            url_suffix="show-api-versions",
            headers=self.headers,
            ok_codes=(200, 500),
            resp_type="response",
            json_data={},
        )
        if response.status_code == 500:
            return "Server Error: make sure Server URL and Server Port are correctly set"

        if response.json() and response.json().get("message") == "Missing header: [X-chkp-sid]":
            return "\nWrong credentials! Please check the username and password you entered and try again."

        return "ok"

    def logout(self) -> str:
        """logout from current session, returning the response message"""
        response = self._http_request(method="POST", url_suffix="logout", headers=self.headers, json_data={})
        self.sid = None
        demisto.setIntegrationContext({})
        self.has_performed_login = False

        message = response.get("message")
        demisto.debug(f"logout: sid={self.sid}, message={message}")
        return message

    def list_hosts(
        self,
        limit: int,
        offset: int,
        details_level: str | None = None,
        domains_to_process: list | None = None,
    ):
        body: dict = {"limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        if domains_to_process:
            body["domains-to-process"] = domains_to_process
        demisto.debug(
            f"{demisto.command()}: endpoint='show-hosts', "
            f"args=({limit=}, {offset=}, {details_level=}, "
            f"{domains_to_process=}), body={body}"
        )
        return self._http_request(
            method="POST",
            url_suffix="show-hosts",
            headers=self.headers,
            resp_type="json",
            json_data=body,
        )

    def get_host(self, identifier: str, details_level: str | None = None):
        body: dict = {"name": identifier}
        if details_level:
            body["details-level"] = details_level
        demisto.debug(f"{demisto.command()}: endpoint='show-host', " f"args=({identifier=}, {details_level=}), body={body}")
        return self._http_request(method="POST", url_suffix="show-host", headers=self.headers, json_data=body)

    def add_host(
        self,
        name: str,
        ip_address: str,
        ignore_warnings: bool,
        ignore_errors: bool,
        groups: list | None = None,
        comments: str | None = None,
        color: str | None = None,
        nat_settings: dict | None = None,
        interfaces: list | None = None,
        tags: list | None = None,
    ):
        body: dict = {
            "name": name,
            "ip-address": ip_address,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if groups:
            body["groups"] = groups
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if nat_settings:
            body["nat-settings"] = nat_settings
        if interfaces:
            body["interfaces"] = interfaces
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='add-host', "
            f"args=({name=}, {ip_address=}, {ignore_warnings=}, "
            f"{ignore_errors=}, {groups=}, {comments=}, {color=}, "
            f"{nat_settings=}, {interfaces=}, {tags=}), body={body}"
        )
        return self._http_request(
            method="POST",
            url_suffix="add-host",
            headers=self.headers,
            json_data=body,
        )

    def update_host(
        self,
        identifier: str,
        ignore_warnings: bool,
        ignore_errors: bool,
        ip_address: str | None = None,
        new_name: str | None = None,
        comments: str | None = None,
        groups: list | None = None,
        color: str | None = None,
        nat_settings: dict | None = None,
        interfaces: list | None = None,
        tags: list | None = None,
    ):
        body: dict = {
            "name": identifier,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if ip_address:
            body["ip-address"] = ip_address
        if new_name:
            body["new-name"] = new_name
        if comments:
            body["comments"] = comments
        if groups:
            body["groups"] = groups
        if color:
            body["color"] = color
        if nat_settings:
            body["nat-settings"] = nat_settings
        if interfaces:
            body["interfaces"] = interfaces
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='set-host', "
            f"args=({identifier=}, {ignore_warnings=}, {ignore_errors=}, "
            f"{ip_address=}, {new_name=}, {comments=}, {groups=}, "
            f"{color=}, {nat_settings=}, {interfaces=}, {tags=}), body={body}"
        )
        response = self._http_request(method="POST", url_suffix="set-host", headers=self.headers, json_data=body)
        return response

    def delete_host(self, identifier: str, ignore_warnings: bool, ignore_errors: bool):
        return self._http_request(
            method="POST",
            url_suffix="delete-host",
            headers=self.headers,
            json_data={"name": identifier, "ignore-warnings": ignore_warnings, "ignore-errors": ignore_errors},
        )

    def list_groups(
        self,
        limit: int,
        offset: int,
        details_level: str | None = None,
        domains_to_process: list | None = None,
        filter_exp: str | None = None,
    ):
        body: dict = {"limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        if domains_to_process:
            body["domains-to-process"] = domains_to_process
        if filter_exp:
            body["filter"] = filter_exp
        demisto.debug(
            f"{demisto.command()}: endpoint='show-groups', "
            f"args=({limit=}, {offset=}, {details_level=}, "
            f"{domains_to_process=}, {filter_exp=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="show-groups", headers=self.headers, json_data=body)

    def get_group(self, identifier: str, details_level: str | None = None):
        body: dict = {"name": identifier}
        if details_level:
            body["details-level"] = details_level
        demisto.debug(f"{demisto.command()}: endpoint='show-group', " f"args=({identifier=}, {details_level=}), body={body}")
        return self._http_request(method="POST", url_suffix="show-group", headers=self.headers, json_data=body)

    def add_group(
        self,
        name: str,
        members: list | None = None,
        comments: str | None = None,
        color: str | None = None,
        tags: list | None = None,
        ignore_warnings: bool = False,
        ignore_errors: bool = False,
    ):
        body: dict = {
            "name": name,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if members:
            body["members"] = members
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='add-group', "
            f"args=({name=}, {members=}, {comments=}, {color=}, "
            f"{tags=}, {ignore_warnings=}, {ignore_errors=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="add-group", headers=self.headers, json_data=body)

    def update_group(
        self,
        identifier: str,
        ignore_warnings: bool,
        ignore_errors: bool,
        action: str,
        members,
        new_name: Optional[str] = None,
        comments: Optional[str] = None,
        color: str | None = None,
        tags: list | None = None,
        details_level: str | None = None,
    ):
        # If the desired action is to add or remove members, they should be specified differently.
        members_value = {action: members} if action in ["add", "remove"] else members
        body: dict = {
            "name": identifier,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if new_name:
            body["new-name"] = new_name
        if members_value:
            body["members"] = members_value
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        if details_level:
            body["details-level"] = details_level

        demisto.debug(
            f"{demisto.command()}: endpoint='set-group', "
            f"args=({identifier=}, {ignore_warnings=}, {ignore_errors=}, "
            f"{action=}, {members=}, {new_name=}, {comments=}, "
            f"{color=}, {tags=}, {details_level=}), body={body}"
        )
        response = self._http_request(method="POST", url_suffix="set-group", headers=self.headers, json_data=body)
        return response

    def delete_group(self, identifier: str):
        return self._http_request(method="POST", url_suffix="delete-group", headers=self.headers, json_data={"name": identifier})

    def list_address_ranges(
        self,
        limit: int,
        offset: int,
        details_level: str | None = None,
        domains_to_process: list | None = None,
    ):
        body: dict = {"limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        if domains_to_process:
            body["domains-to-process"] = domains_to_process
        demisto.debug(
            f"{demisto.command()}: endpoint='show-address-ranges', "
            f"args=({limit=}, {offset=}, {details_level=}, "
            f"{domains_to_process=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="show-address-ranges", headers=self.headers, json_data=body)

    def get_address_range(self, identifier: str):
        return self._http_request(
            method="POST", url_suffix="show-address-range", headers=self.headers, json_data={"name": identifier}
        )

    def add_address_range(
        self,
        name: str,
        ip_address_first: str,
        ip_address_last: str,
        set_if_exists: bool,
        ignore_warnings: bool,
        ignore_errors: bool,
        groups=None,
        comments: str | None = None,
        color: str | None = None,
        nat_settings: dict | None = None,
        tags: list | None = None,
    ):
        body: dict = {
            "name": name,
            "ip-address-first": ip_address_first,
            "ip-address-last": ip_address_last,
            "set-if-exists": set_if_exists,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if groups:
            body["groups"] = groups
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if nat_settings:
            body["nat-settings"] = nat_settings
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='add-address-range', "
            f"args=({name=}, {ip_address_first=}, {ip_address_last=}, "
            f"{set_if_exists=}, {ignore_warnings=}, {ignore_errors=}, "
            f"{groups=}, {comments=}, {color=}, {nat_settings=}, {tags=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="add-address-range", headers=self.headers, json_data=body)

    def update_address_range(
        self,
        identifier: str,
        ignore_warnings: bool,
        ignore_errors: bool,
        ip_address_first: Optional[str] = None,
        ip_address_last: Optional[str] = None,
        new_name: Optional[str] = None,
        comments: Optional[str] = None,
        groups=None,
        color: str | None = None,
        nat_settings: dict | None = None,
        tags: list | None = None,
    ):
        body: dict = {
            "name": identifier,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if ip_address_first:
            body["ip-address-first"] = ip_address_first
        if ip_address_last:
            body["ip-address-last"] = ip_address_last
        if new_name:
            body["new-name"] = new_name
        if comments:
            body["comments"] = comments
        if groups:
            body["groups"] = groups
        if color:
            body["color"] = color
        if nat_settings:
            body["nat-settings"] = nat_settings
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='set-address-range', "
            f"args=({identifier=}, {ignore_warnings=}, {ignore_errors=}, "
            f"{ip_address_first=}, {ip_address_last=}, {new_name=}, "
            f"{comments=}, {groups=}, {color=}, {nat_settings=}, {tags=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="set-address-range", headers=self.headers, json_data=body)

    def delete_address_range(self, identifier: str):
        return self._http_request(
            method="POST", url_suffix="delete-address-range", headers=self.headers, json_data={"name": identifier}
        )

    def list_threat_indicators(
        self,
        limit: int,
        offset: int,
        domain_names: list | None = None,
        details_level: str | None = None,
        filter_exp: str | None = None,
    ):
        body: dict = {"limit": limit, "offset": offset}
        if domain_names:
            body["domains-to-process"] = domain_names
        if details_level:
            body["details-level"] = details_level
        if filter_exp:
            body["filter"] = filter_exp
        demisto.debug(
            f"{demisto.command()}: endpoint='show-threat-indicators', "
            f"args=({limit=}, {offset=}, {domain_names=}, "
            f"{details_level=}, {filter_exp=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="show-threat-indicators", headers=self.headers, json_data=body)

    def get_threat_indicator(self, identifier):
        return self._http_request(
            method="POST", url_suffix="show-threat-indicator", headers=self.headers, json_data={"name": identifier}
        )

    def add_threat_indicator(
        self,
        name: str,
        observables: list,
        comments: str | None = None,
        color: str | None = None,
        tags: list | None = None,
        ignore_warnings: bool = False,
        action: str | None = None,
        profile_overrides: list | None = None,
    ):
        body: dict = {"name": name, "observables": observables}
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        if ignore_warnings:
            body["ignore-warnings"] = ignore_warnings
        if action:
            body["action"] = action
        if profile_overrides:
            body["profile-overrides"] = profile_overrides
        demisto.debug(
            f"{demisto.command()}: endpoint='add-threat-indicator', "
            f"args=({name=}, {observables=}, {comments=}, {color=}, "
            f"{tags=}, {ignore_warnings=}, {action=}, {profile_overrides=}), body={body}"
        )
        return self._http_request(
            method="POST",
            url_suffix="add-threat-indicator",
            headers=self.headers,
            json_data=body,
        )

    def update_threat_indicator(
        self,
        identifier: str,
        action: str | None = None,
        new_name: str | None = None,
        comments: str | None = None,
        profile_overrides: list | None = None,
        color: str | None = None,
        tags: list | None = None,
    ):
        body: dict = {"name": identifier}
        if action:
            body["action"] = action
        if new_name:
            body["new-name"] = new_name
        if comments:
            body["comments"] = comments
        if profile_overrides:
            body["profile-overrides"] = profile_overrides
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='set-threat-indicator', "
            f"args=({identifier=}, {action=}, {new_name=}, {comments=}, "
            f"{profile_overrides=}, {color=}, {tags=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="set-threat-indicator", headers=self.headers, json_data=body)

    def delete_threat_indicator(self, identifier: str):
        return self._http_request(
            method="POST", url_suffix="delete-threat-indicator", headers=self.headers, json_data={"name": identifier}
        )

    def list_access_rule(
        self,
        identifier: str,
        limit: int,
        offset: int,
        details_level: str | None = None,
        show_hits: bool | None = None,
    ):
        body: dict = {"name": identifier, "limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        if show_hits is not None:
            body["show-hits"] = show_hits
        demisto.debug(
            f"{demisto.command()}: endpoint='show-access-rulebase', "
            f"args=({identifier=}, {limit=}, {offset=}, "
            f"{details_level=}, {show_hits=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="show-access-rulebase", headers=self.headers, json_data=body)

    def add_rule(
        self,
        layer: str,
        position,
        action: str,
        name: Optional[str] = None,
        vpn: Optional[str] = None,
        destination=None,
        service=None,
        source=None,
        comments: str | None = None,
        install_on: list | None = None,
        enabled: bool | None = None,
        track: dict | None = None,
    ):
        body: dict = {
            "layer": layer,
            "position": position,
            "action": action,
        }
        if name:
            body["name"] = name
        if vpn:
            body["vpn"] = vpn
        if destination:
            body["destination"] = destination
        if service:
            body["service"] = service
        if source:
            body["source"] = source
        if comments:
            body["comments"] = comments
        if install_on:
            body["install-on"] = install_on
        if enabled is not None:
            body["enabled"] = enabled
        if track:
            body["track"] = track
        demisto.debug(
            f"{demisto.command()}: endpoint='add-access-rule', "
            f"args=({layer=}, {position=}, {action=}, {name=}, {vpn=}, "
            f"{destination=}, {service=}, {source=}, {comments=}, "
            f"{install_on=}, {enabled=}, {track=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="add-access-rule", headers=self.headers, json_data=body)

    def update_rule(
        self,
        identifier: str,
        layer: str,
        ignore_warnings: bool,
        ignore_errors: bool,
        enabled: bool | None = None,
        action: Optional[str] = None,
        new_name: Optional[str] = None,
        new_position=None,
        comments: str | None = None,
        track: dict | None = None,
        install_on: list | None = None,
        source: dict | None = None,
        destination: dict | None = None,
        service: dict | None = None,
    ):
        body: dict = {
            "name": identifier,
            "layer": layer,
            "ignore-warnings": ignore_warnings,
            "ignore-errors": ignore_errors,
        }
        if action:
            body["action"] = action
        if enabled is not None:
            body["enabled"] = enabled
        if new_name:
            body["new-name"] = new_name
        if new_position:
            body["new-position"] = new_position
        if comments:
            body["comments"] = comments
        if track:
            body["track"] = track
        if install_on:
            body["install-on"] = install_on
        if source:
            body["source"] = source
        if destination:
            body["destination"] = destination
        if service:
            body["service"] = service
        demisto.debug(
            f"{demisto.command()}: endpoint='set-access-rule', "
            f"args=({identifier=}, {layer=}, {ignore_warnings=}, {ignore_errors=}, "
            f"{enabled=}, {action=}, {new_name=}, {new_position=}, {comments=}, "
            f"{track=}, {install_on=}, {source=}, {destination=}, {service=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="set-access-rule", headers=self.headers, json_data=body)

    def delete_rule(self, identifier: str, layer: str):
        return self._http_request(
            method="POST", url_suffix="delete-access-rule", headers=self.headers, json_data={"name": identifier, "layer": layer}
        )

    def list_application_site(
        self,
        limit: int,
        offset: int,
        details_level: str | None = None,
        domains_to_process: list | None = None,
    ):
        body: dict = {"limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        if domains_to_process:
            body["domains-to-process"] = domains_to_process
        demisto.debug(
            f"{demisto.command()}: endpoint='show-application-sites', "
            f"args=({limit=}, {offset=}, {details_level=}, "
            f"{domains_to_process=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="show-application-sites", headers=self.headers, json_data=body)

    def add_application_site(
        self,
        name: str,
        primary_category: str,
        identifier,
        groups=None,
        description: str | None = None,
        comments: str | None = None,
        color: str | None = None,
        tags: list | None = None,
    ):
        body: dict = {"name": name, "primary-category": primary_category, "url-list": identifier}
        if groups:
            body["groups"] = groups
        if description:
            body["description"] = description
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='add-application-site', "
            f"args=({name=}, {primary_category=}, {identifier=}, "
            f"{groups=}, {description=}, {comments=}, {color=}, {tags=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="add-application-site", headers=self.headers, json_data=body)

    def update_application_site(
        self,
        identifier: str,
        urls_defined_as_regular_expression: bool,
        groups=None,
        url_list=None,
        description: Optional[str] = None,
        new_name: Optional[str] = None,
        primary_category: Optional[str] = None,
        application_signature: Optional[str] = None,
        comments: str | None = None,
        color: str | None = None,
        tags: list | None = None,
    ):
        body: dict = {
            "name": identifier,
            "urls-defined-as-regular-expression": urls_defined_as_regular_expression,
        }
        if description:
            body["description"] = description
        if new_name:
            body["new-name"] = new_name
        if primary_category:
            body["primary-category"] = primary_category
        if groups:
            body["groups"] = groups
        if application_signature:
            body["application-signature"] = application_signature
        if url_list:
            body["url-list"] = url_list
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(
            f"{demisto.command()}: endpoint='set-application-site', "
            f"args=({identifier=}, {urls_defined_as_regular_expression=}, "
            f"{groups=}, {url_list=}, {description=}, {new_name=}, "
            f"{primary_category=}, {application_signature=}, {comments=}, "
            f"{color=}, {tags=}), body={body}"
        )
        return self._http_request(method="POST", url_suffix="set-application-site", headers=self.headers, json_data=body)

    def add_objects_batch(self, object_type, add_list):
        body = {"objects": [{"type": object_type, "list": add_list}]}
        return self._http_request(method="POST", url_suffix="add-objects-batch", headers=self.headers, json_data=body)

    def delete_objects_batch(self, object_type, delete_list):
        body = {"objects": [{"type": object_type, "list": delete_list}]}
        return self._http_request(method="POST", url_suffix="delete-objects-batch", headers=self.headers, json_data=body)

    def delete_application_site(self, identifier: str):
        return self._http_request(
            method="POST", url_suffix="delete-application-site", headers=self.headers, json_data={"name": identifier}
        )

    def show_network(self, identifier: str, details_level: Optional[str] = None):
        body: dict = {"name": identifier}
        if details_level:
            body["details-level"] = details_level
        demisto.debug(f"show-network request body: {body}")
        return self._http_request(method="POST", url_suffix="show-network", headers=self.headers, json_data=body)

    def list_networks(self, limit: int, offset: int, details_level: Optional[str] = None):
        body: dict = {"limit": limit, "offset": offset}
        if details_level:
            body["details-level"] = details_level
        demisto.debug(f"show-networks request body: {body}")
        return self._http_request(method="POST", url_suffix="show-networks", headers=self.headers, json_data=body)

    def add_network(
        self,
        identifier: str,
        subnet: str,
        mask_length: Optional[int] = None,
        subnet_mask: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        tags: Optional[list] = None,
        broadcast: Optional[str] = None,
        nat_settings: Optional[dict] = None,
    ):
        body: dict = {"name": identifier, "subnet4": subnet}
        if mask_length is not None:
            body["mask-length4"] = mask_length
        if subnet_mask:
            body["subnet-mask"] = subnet_mask
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        if broadcast:
            body["broadcast"] = broadcast
        if nat_settings:
            body["nat-settings"] = nat_settings
        demisto.debug(f"add-network request body: {body}")
        return self._http_request(method="POST", url_suffix="add-network", headers=self.headers, json_data=body)

    def update_network(
        self,
        identifier: str,
        new_identifier: Optional[str] = None,
        subnet: Optional[str] = None,
        subnet_mask: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        tags: Optional[list] = None,
        broadcast: Optional[str] = None,
        nat_settings: Optional[dict] = None,
    ):
        body: dict = {"name": identifier}
        if new_identifier:
            body["new-name"] = new_identifier
        if subnet:
            body["subnet4"] = subnet
        if subnet_mask:
            body["subnet-mask"] = subnet_mask
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        if broadcast:
            body["broadcast"] = broadcast
        if nat_settings:
            body["nat-settings"] = nat_settings
        demisto.debug(f"set-network request body: {body}")
        return self._http_request(method="POST", url_suffix="set-network", headers=self.headers, json_data=body)

    def delete_network(self, identifier: str, ignore_warnings: bool = True):
        body: dict = {"name": identifier, "ignore-warnings": ignore_warnings}
        demisto.debug(f"delete-network request body: {body}")
        return self._http_request(
            method="POST",
            url_suffix="delete-network",
            headers=self.headers,
            json_data=body,
        )

    def show_service(self, identifier: str, service_type: str):
        body: dict = {"name": identifier}
        demisto.debug(f"show-service-{service_type} request body: {body}")
        return self._http_request(method="POST", url_suffix=f"show-service-{service_type}", headers=self.headers, json_data=body)

    def list_services(self, limit: int, offset: int, service_type: str):
        body: dict = {"limit": limit, "offset": offset}
        demisto.debug(f"show-services-{service_type} request body: {body}")
        return self._http_request(
            method="POST",
            url_suffix=f"show-services-{service_type}",
            headers=self.headers,
            json_data=body,
        )

    def add_service_tcp(
        self,
        identifier: str,
        port: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        session_timeout: Optional[int] = None,
        aggressive_aging: Optional[dict] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if port:
            body["port"] = port
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if session_timeout is not None:
            body["session-timeout"] = session_timeout
            body["use-default-session-timeout"] = False
        if aggressive_aging:
            body["aggressive-aging"] = aggressive_aging
        if tags:
            body["tags"] = tags
        demisto.debug(f"add-service-tcp request body: {body}")
        return self._http_request(method="POST", url_suffix="add-service-tcp", headers=self.headers, json_data=body)

    def add_service_udp(
        self,
        identifier: str,
        port: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        session_timeout: Optional[int] = None,
        aggressive_aging: Optional[dict] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if port:
            body["port"] = port
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if session_timeout is not None:
            body["session-timeout"] = session_timeout
            body["use-default-session-timeout"] = False
        if aggressive_aging:
            body["aggressive-aging"] = aggressive_aging
        if tags:
            body["tags"] = tags
        demisto.debug(f"add-service-udp request body: {body}")
        return self._http_request(method="POST", url_suffix="add-service-udp", headers=self.headers, json_data=body)

    def add_service_icmp(
        self,
        identifier: str,
        icmp_type: Optional[int] = None,
        icmp_code: Optional[int] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if icmp_type is not None:
            body["icmp-type"] = icmp_type
        if icmp_code is not None:
            body["icmp-code"] = icmp_code
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(f"add-service-icmp request body: {body}")
        return self._http_request(method="POST", url_suffix="add-service-icmp", headers=self.headers, json_data=body)

    def update_service_tcp(
        self,
        identifier: str,
        new_identifier: Optional[str] = None,
        port: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        session_timeout: Optional[int] = None,
        aggressive_aging: Optional[dict] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if new_identifier:
            body["new-name"] = new_identifier
        if port:
            body["port"] = port
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if session_timeout is not None:
            body["session-timeout"] = session_timeout
            body["use-default-session-timeout"] = False
        if aggressive_aging:
            body["aggressive-aging"] = aggressive_aging
        if tags:
            body["tags"] = tags
        demisto.debug(f"set-service-tcp request body: {body}")
        return self._http_request(method="POST", url_suffix="set-service-tcp", headers=self.headers, json_data=body)

    def update_service_udp(
        self,
        identifier: str,
        new_identifier: Optional[str] = None,
        port: Optional[str] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        session_timeout: Optional[int] = None,
        aggressive_aging: Optional[dict] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if new_identifier:
            body["new-name"] = new_identifier
        if port:
            body["port"] = port
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if session_timeout is not None:
            body["session-timeout"] = session_timeout
            body["use-default-session-timeout"] = False
        if aggressive_aging:
            body["aggressive-aging"] = aggressive_aging
        if tags:
            body["tags"] = tags
        demisto.debug(f"set-service-udp request body: {body}")
        return self._http_request(method="POST", url_suffix="set-service-udp", headers=self.headers, json_data=body)

    def update_service_icmp(
        self,
        identifier: str,
        new_identifier: Optional[str] = None,
        icmp_type: Optional[int] = None,
        icmp_code: Optional[int] = None,
        comments: Optional[str] = None,
        color: Optional[str] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"name": identifier}
        if new_identifier:
            body["new-name"] = new_identifier
        if icmp_type is not None:
            body["icmp-type"] = icmp_type
        if icmp_code is not None:
            body["icmp-code"] = icmp_code
        if comments:
            body["comments"] = comments
        if color:
            body["color"] = color
        if tags:
            body["tags"] = tags
        demisto.debug(f"set-service-icmp request body: {body}")
        return self._http_request(method="POST", url_suffix="set-service-icmp", headers=self.headers, json_data=body)

    def delete_service(self, identifier: str, service_type: str, ignore_warnings: bool = False):
        body: dict = {"name": identifier}
        if ignore_warnings:
            body["ignore-warnings"] = ignore_warnings
        demisto.debug(f"delete-service-{service_type} request body: {body}")
        return self._http_request(
            method="POST", url_suffix=f"delete-service-{service_type}", headers=self.headers, json_data=body
        )

    def show_nat_rule(self, identifier: str, package: str):
        identifier_key = "rule-number" if str(identifier).isdigit() else "name"
        body: dict = {identifier_key: identifier, "package": package}
        demisto.debug(f"show-nat-rule request body: {body}")
        return self._http_request(
            method="POST",
            url_suffix="show-nat-rule",
            headers=self.headers,
            json_data=body,
        )

    def list_nat_rulebase(self, package: str, limit: int, offset: int, filter_str: Optional[str] = None):
        body: dict = {"package": package, "limit": limit, "offset": offset}
        if filter_str:
            body["filter"] = filter_str
        demisto.debug(f"show-nat-rulebase request body: {body}")
        return self._http_request(method="POST", url_suffix="show-nat-rulebase", headers=self.headers, json_data=body)

    def add_nat_rule(
        self,
        package: str,
        position: str | int | dict,
        name: Optional[str] = None,
        original_source: Optional[str] = None,
        original_destination: Optional[str] = None,
        original_service: Optional[str] = None,
        translated_source: Optional[str] = None,
        translated_destination: Optional[str] = None,
        translated_service: Optional[str] = None,
        install_on: Optional[list] = None,
        comments: Optional[str] = None,
        enabled: Optional[bool] = None,
        method: Optional[str] = None,
        tags: Optional[list] = None,
    ):
        body: dict = {"package": package, "position": position}
        if name:
            body["name"] = name
        if original_source:
            body["original-source"] = original_source
        if original_destination:
            body["original-destination"] = original_destination
        if original_service:
            body["original-service"] = original_service
        if translated_source:
            body["translated-source"] = translated_source
        if translated_destination:
            body["translated-destination"] = translated_destination
        if translated_service:
            body["translated-service"] = translated_service
        if install_on:
            body["install-on"] = install_on
        if comments:
            body["comments"] = comments
        if enabled is not None:
            body["enabled"] = enabled
        if method:
            body["method"] = method
        if tags:
            body["tags"] = tags
        demisto.debug(f"add-nat-rule request body: {body}")
        return self._http_request(method="POST", url_suffix="add-nat-rule", headers=self.headers, json_data=body)

    def update_nat_rule(
        self,
        identifier: str,
        package: str,
        original_source: Optional[str] = None,
        original_destination: Optional[str] = None,
        translated_source: Optional[str] = None,
        translated_destination: Optional[str] = None,
        original_service: Optional[str] = None,
        translated_service: Optional[str] = None,
        comments: Optional[str] = None,
        enabled: Optional[bool] = None,
        method: Optional[str] = None,
        tags: Optional[list] = None,
        new_position: str | int | dict | None = None,
    ):
        identifier_key = "rule-number" if str(identifier).isdigit() else "name"
        body: dict = {identifier_key: identifier, "package": package}
        if original_source:
            body["original-source"] = original_source
        if original_destination:
            body["original-destination"] = original_destination
        if translated_source:
            body["translated-source"] = translated_source
        if translated_destination:
            body["translated-destination"] = translated_destination
        if original_service:
            body["original-service"] = original_service
        if translated_service:
            body["translated-service"] = translated_service
        if comments:
            body["comments"] = comments
        if enabled is not None:
            body["enabled"] = enabled
        if method:
            body["method"] = method
        if tags:
            body["tags"] = tags
        if new_position is not None:
            body["new-position"] = new_position
        demisto.debug(f"set-nat-rule request body: {body}")
        return self._http_request(method="POST", url_suffix="set-nat-rule", headers=self.headers, json_data=body)

    def delete_nat_rule(self, identifier: str, package: str):
        identifier_key = "rule-number" if str(identifier).isdigit() else "name"
        body: dict = {identifier_key: identifier, "package": package}
        demisto.debug(f"delete-nat-rule request body: {body}")
        return self._http_request(method="POST", url_suffix="delete-nat-rule", headers=self.headers, json_data=body)

    def show_task(self, task_id):
        return self._http_request(method="POST", url_suffix="show-task", headers=self.headers, json_data={"task-id": task_id})

    def list_objects(self, limit: int, offset: int, filter_search: str, ip_only: bool, object_type: str):
        body = {"limit": limit, "offset": offset, "filter": filter_search, "ip-only": ip_only, "type": object_type}
        return self._http_request(method="POST", url_suffix="show-objects", headers=self.headers, json_data=body)

    def list_application_site_categories(self, limit: int, offset: int):
        body = {"limit": limit, "offset": offset}
        return self._http_request(
            method="POST", url_suffix="show-application-site-categories", headers=self.headers, json_data=body
        )

    def get_application_site_category(self, identifier: str):
        return self._http_request(
            method="POST", url_suffix="show-application-site-category", headers=self.headers, json_data={"name": identifier}
        )

    def add_application_site_category(self, identifier: str, groups):
        body = {"name": identifier, "groups": groups}
        return self._http_request(method="POST", url_suffix="add-application-site-category", headers=self.headers, json_data=body)

    def list_packages(self, limit: int, offset: int):
        response = self._http_request(
            method="POST", url_suffix="show-packages", headers=self.headers, json_data={"limit": limit, "offset": offset}
        )
        return response.get("packages")

    def list_package(self, identifier: str):
        return self._http_request(method="POST", url_suffix="show-package", headers=self.headers, json_data={"name": identifier})

    def list_gateways(self, limit: int, offset: int):
        response = self._http_request(
            method="POST",
            url_suffix="show-gateways-and-servers",
            headers=self.headers,
            json_data={"limit": limit, "offset": offset, "details-level": "full"},
        )
        return response.get("objects")

    def publish(self):
        return self._http_request(method="POST", url_suffix="publish", headers=self.headers, json_data={})

    def install_policy(self, policy_package: str, access: bool, targets=None):
        body: dict = {
            "policy-package": policy_package,
            "access": access,
        }
        if targets:
            body["targets"] = targets
        return self._http_request(method="POST", url_suffix="install-policy", headers=self.headers, json_data=body)

    def verify_policy(self, policy_package: str):
        body = {
            "policy-package": policy_package,
        }
        return self._http_request(method="POST", url_suffix="verify-policy", headers=self.headers, json_data=body)

    def show_threat_protection(self, uid: str, name: str, properties: bool, profiles: bool):
        body = {"show-ips-additional-properties": properties, "show-profiles": profiles}
        if uid:
            body["uid"] = uid  # type: ignore

        elif name:
            body["name"] = name  # type: ignore
        return self._http_request(method="POST", url_suffix="show-threat-protection", headers=self.headers, json_data=body)

    def show_threat_protections(self, args):
        return self._http_request(method="POST", url_suffix="show-threat-protections", headers=self.headers, json_data=args)

    def add_threat_profile(self, args):
        return self._http_request(method="POST", url_suffix="add-threat-profile", headers=self.headers, json_data=args)

    def delete_threat_protections(self, args):
        return self._http_request(method="POST", url_suffix="delete-threat-protections", headers=self.headers, json_data=args)

    def set_threat_protection(self, args):
        return self._http_request(method="POST", url_suffix="set-threat-protection", headers=self.headers, json_data=args)

    def add_service_group(
        self,
        name: str,
        members: Optional[list] = None,
        color: Optional[str] = None,
        comments: Optional[str] = None,
        details_level: Optional[str] = None,
        groups: Optional[list] = None,
        tags: Optional[list] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
    ) -> dict:
        body: dict = {"name": name}
        if members is not None:
            body["members"] = members
        if color is not None:
            body["color"] = color
        if comments is not None:
            body["comments"] = comments
        if details_level is not None:
            body["details-level"] = details_level
        if groups is not None:
            body["groups"] = groups
        if tags is not None:
            body["tags"] = tags
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        demisto.debug(f"add-service-group request body: {body}")
        return self._http_request(method="POST", url_suffix="add-service-group", headers=self.headers, json_data=body)

    def get_service_group(
        self,
        identifier: str,
        show_as_ranges: Optional[bool] = None,
        details_level: Optional[str] = None,
    ) -> dict:
        body: dict = {"name": identifier}
        if show_as_ranges is not None:
            body["show-as-ranges"] = show_as_ranges
        if details_level is not None:
            body["details-level"] = details_level
        demisto.debug(f"show-service-group request body: {body}")
        return self._http_request(method="POST", url_suffix="show-service-group", headers=self.headers, json_data=body)

    def list_service_groups(
        self,
        filter_search: Optional[str] = None,
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        order: Optional[list] = None,
        show_as_ranges: Optional[bool] = None,
        dereference_group_members: Optional[bool] = None,
        show_membership: Optional[bool] = None,
        details_level: Optional[str] = None,
        domains_to_process: Optional[list] = None,
    ) -> dict:
        body: dict = {}
        if filter_search is not None:
            body["filter"] = filter_search
        if limit is not None:
            body["limit"] = limit
        if offset is not None:
            body["offset"] = offset
        if order is not None:
            body["order"] = order
        if show_as_ranges is not None:
            body["show-as-ranges"] = show_as_ranges
        if dereference_group_members is not None:
            body["dereference-group-members"] = dereference_group_members
        if show_membership is not None:
            body["show-membership"] = show_membership
        if details_level is not None:
            body["details-level"] = details_level
        if domains_to_process is not None:
            body["domains-to-process"] = domains_to_process
            # The API requires ignore-warnings=true when querying multiple domains
            body["ignore-warnings"] = True
        demisto.debug(f"show-service-groups request body: {body}")
        return self._http_request(method="POST", url_suffix="show-service-groups", headers=self.headers, json_data=body)

    def update_service_group(
        self,
        identifier: str,
        members: Optional[dict | list] = None,
        new_name: Optional[str] = None,
        color: Optional[str] = None,
        comments: Optional[str] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
        details_level: Optional[str] = None,
        groups: Optional[dict | list] = None,
        tags: Optional[dict | list] = None,
    ) -> dict:
        body: dict = {"name": identifier}
        if members is not None:
            body["members"] = members
        if new_name is not None:
            body["new-name"] = new_name
        if color is not None:
            body["color"] = color
        if comments is not None:
            body["comments"] = comments
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        if details_level is not None:
            body["details-level"] = details_level
        if groups is not None:
            body["groups"] = groups
        if tags is not None:
            body["tags"] = tags
        demisto.debug(f"set-service-group request body: {body}")
        return self._http_request(method="POST", url_suffix="set-service-group", headers=self.headers, json_data=body)

    def clone_service_group(
        self,
        identifier: str,
        members: Optional[dict | list] = None,
        new_name: Optional[str] = None,
        color: Optional[str] = None,
        comments: Optional[str] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
        details_level: Optional[str] = None,
        groups: Optional[dict | list] = None,
        tags: Optional[dict | list] = None,
    ) -> dict:
        body: dict = {"name": identifier}
        if members is not None:
            body["members"] = members
        if new_name is not None:
            body["new-name"] = new_name
        if color is not None:
            body["color"] = color
        if comments is not None:
            body["comments"] = comments
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        if details_level is not None:
            body["details-level"] = details_level
        if groups is not None:
            body["groups"] = groups
        if tags is not None:
            body["tags"] = tags
        demisto.debug(f"clone-service-group request body: {body}")
        return self._http_request(method="POST", url_suffix="clone-service-group", headers=self.headers, json_data=body)

    def delete_service_group(
        self,
        identifier: str,
        details_level: Optional[str] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
    ) -> dict:
        body: dict = {"name": identifier}
        if details_level is not None:
            body["details-level"] = details_level
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        demisto.debug(f"delete-service-group request body: {body}")
        return self._http_request(method="POST", url_suffix="delete-service-group", headers=self.headers, json_data=body)

    def add_access_section(
        self,
        layer: str,
        position: str | dict | int,
        details_level: Optional[str] = None,
        name: Optional[str] = None,
        tags: Optional[list] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
    ) -> dict:
        body: dict = {"layer": layer, "position": position}
        if details_level is not None:
            body["details-level"] = details_level
        if name is not None:
            body["name"] = name
        if tags is not None:
            body["tags"] = tags
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        demisto.debug(f"add-access-section request body: {body}")
        return self._http_request(method="POST", url_suffix="add-access-section", headers=self.headers, json_data=body)

    def get_access_section(
        self,
        layer: str,
        identifier: str,
        details_level: Optional[str] = None,
    ) -> dict:
        body: dict = {"layer": layer, "name": identifier}
        if details_level is not None:
            body["details-level"] = details_level
        demisto.debug(f"show-access-section request body: {body}")
        return self._http_request(method="POST", url_suffix="show-access-section", headers=self.headers, json_data=body)

    def update_access_section(
        self,
        identifier: str,
        layer: str,
        new_name: Optional[str] = None,
        details_level: Optional[str] = None,
        tags: Optional[dict | list] = None,
        ignore_warnings: Optional[bool] = None,
        ignore_errors: Optional[bool] = None,
    ) -> dict:
        body: dict = {"name": identifier, "layer": layer}
        if new_name is not None:
            body["new-name"] = new_name
        if details_level is not None:
            body["details-level"] = details_level
        if tags is not None:
            body["tags"] = tags
        if ignore_warnings is not None:
            body["ignore-warnings"] = ignore_warnings
        if ignore_errors is not None:
            body["ignore-errors"] = ignore_errors
        demisto.debug(f"set-access-section request body: {body}")
        return self._http_request(method="POST", url_suffix="set-access-section", headers=self.headers, json_data=body)

    def delete_access_section(
        self,
        identifier: str,
        layer: str,
        details_level: Optional[str] = None,
    ) -> dict:
        body: dict = {"name": identifier, "layer": layer}
        if details_level is not None:
            body["details-level"] = details_level
        demisto.debug(f"delete-access-section request body: {body}")
        return self._http_request(method="POST", url_suffix="delete-access-section", headers=self.headers, json_data=body)


def validate_domains_to_process(domains_to_process: str | None, details_level: str | None) -> None:
    """Validate domains_to_process argument constraints.

    Args:
        domains_to_process: Indicates which domains to process the commands on.
        details_level: The level of detail for returned objects.

    Raises:
        ValueError: If domains_to_process is used with details_level 'full'.
    """
    if domains_to_process and details_level == "full":
        raise ValueError(
            "The 'domains_to_process' argument cannot be used with 'details_level' set to 'full'. "
            "Please change 'details_level' or remove 'domains_to_process'."
        )


def checkpoint_list_hosts_command(
    client: Client,
    limit: int,
    offset: int,
    details_level: str = None,
    domains_to_process: str = None,
) -> CommandResults:
    """
    Retrieve all host objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
        details_level (str): The level of detail for returned objects.
        domains_to_process (str): Indicates which domains to process the commands on.
    """
    validate_domains_to_process(domains_to_process, details_level)
    printable_result = []
    readable_output = ""
    domains_list = argToList(domains_to_process) if domains_to_process else None

    result = client.list_hosts(limit, offset, details_level=details_level, domains_to_process=domains_list)
    demisto.info(result)
    if result:
        if result.get("total") == 0:
            readable_output = "No hosts objects were found."
        else:
            result = result.get("objects")
            for element in result:
                current_printable_result = {}

                domain = element.get("domain", {})
                current_printable_result["domain-name"] = domain.get("name")
                current_printable_result["domain-uid"] = domain.get("uid")
                current_printable_result["domain-type"] = domain.get("domain-type")

                for endpoint in DEFAULT_LIST_FIELD:
                    if endpoint not in ["domain-name", "domain-uid", "domain-type"]:
                        current_printable_result[endpoint] = element.get(endpoint)
                printable_result.extend([current_printable_result])

            readable_output = tableToMarkdown(
                "CheckPoint data for all hosts:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
            )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Host",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_get_host_command(client: Client, identifier: str, details_level: str = None) -> CommandResults:
    """
    Show existing host object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        details_level (str): The level of detail for returned objects.
    """
    result = client.get_host(identifier, details_level=details_level)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data of host object {identifier}:", printable_result, headers=DEFAULT_LIST_FIELD, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Host",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_host_command(
    client: Client,
    name,
    ip_address,
    ignore_warnings: Union[bool, str] = "false",
    ignore_errors: Union[bool, str] = "false",
    groups: str = None,
    comments: str = None,
    color: str = None,
    nat_auto_rule: str = None,
    nat_method: str = None,
    nat_ip: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    interfaces_name: str = None,
    interfaces_subnet: str = None,
    interfaces_mask_length: str = None,
    tags: str = None,
) -> CommandResults:
    """
    Add new host object.

    Args:
        client (Client): CheckPoint client.
        name(str): host name.
        ip_address: ip address linked to the host.
        groups (str or list): Collection of group identifiers.
        ignore_warnings (str): Whether to ignore warnings when adding a host.
        ignore_errors (str): Whether to ignore errors when adding a host.
        comments (str): Comments string.
        color (str): Object color.
        nat_auto_rule (str): Whether to enable automatic NAT rule generation.
        nat_method (str): NAT translation method (hide or static).
        nat_ip (str): NAT IPv4 or IPv6 address.
        nat_install_on (str): Gateway for NAT install-on setting.
        nat_hide_behind (str): Hide behind method (gateway or ip_address).
        interfaces_name (str): Interface name.
        interfaces_subnet (str): Interface subnet address.
        interfaces_mask_length (str): Interface mask length.
        tags (str or list): Collection of tag identifiers.
    """
    name = argToList(name)
    ip_address = argToList(ip_address)
    groups_list = argToList(groups) if groups else None
    tags_list = argToList(tags) if tags else None
    ignore_warnings = argToBoolean(ignore_warnings)
    ignore_errors = argToBoolean(ignore_errors)

    nat_settings = build_nat_settings(nat_auto_rule, nat_method, nat_ip, nat_install_on, nat_hide_behind)
    interfaces = build_interfaces_list(interfaces_name, interfaces_subnet, interfaces_mask_length)

    result = []
    context = []
    readable_output = ""
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "ipv4-address",
        "ipv6-address",
        "read-only",
        "groups",
        "color",
        "comments",
        "tags",
        "nat-auto-rule",
        "nat-method",
        "nat-ipv4-address",
        "nat-install-on",
        "nat-hide-behind",
    ]

    if len(name) != len(ip_address):
        raise ValueError("Number of host-names and host-IP has to be equal")
    else:
        for index, item in enumerate(name):
            current_result = client.add_host(
                item,
                ip_address[index],
                ignore_warnings,
                ignore_errors,
                groups=groups_list,
                comments=comments,
                color=color,
                nat_settings=nat_settings,
                interfaces=interfaces,
                tags=tags_list,
            )
            printable_result = build_printable_result(headers, current_result)
            current_readable_output = tableToMarkdown(
                "CheckPoint data for adding host:", printable_result, headers=headers, removeNull=True
            )
            readable_output = readable_output + current_readable_output
            result.append(current_result)
            context.append(printable_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Host",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=context,
        raw_response=result,
    )
    return command_results


def checkpoint_update_host_command(
    client: Client,
    identifier: str,
    ignore_warnings: Union[bool, str] = "false",
    ignore_errors: Union[bool, str] = "false",
    ip_address: str = None,
    new_name: str = None,
    comments: str = None,
    groups=None,
    color: str = None,
    nat_auto_rule: str = None,
    nat_method: str = None,
    nat_ip: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    interfaces_name: str = None,
    interfaces_subnet: str = None,
    interfaces_mask_length: str = None,
    tags: str = None,
) -> CommandResults:
    """
    Edit existing host using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        ignore_warnings(bool):Apply changes ignoring warnings.
        ignore_errors(bool): 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
        ip_address (object): ip address linked to the host.
        new_name(str): New name of the object.
        comments(str): Comments string.
        groups (str or list): Collection of group identifiers.
        color (str): Object color.
        nat_auto_rule (str): Whether to enable automatic NAT rule generation.
        nat_method (str): NAT translation method (hide or static).
        nat_ip (str): NAT IPv4 or IPv6 address.
        nat_install_on (str): Gateway for NAT install-on setting.
        nat_hide_behind (str): Hide behind method (gateway or ip_address).
        interfaces_name (str): Interface name.
        interfaces_subnet (str): Interface subnet address.
        interfaces_mask_length (str): Interface mask length.
        tags (str or list): Collection of tag identifiers.
    """
    groups_list = argToList(groups) if groups else None
    tags_list = argToList(tags) if tags else None
    ignore_warnings = argToBoolean(ignore_warnings)
    ignore_errors = argToBoolean(ignore_errors)

    nat_settings = build_nat_settings(nat_auto_rule, nat_method, nat_ip, nat_install_on, nat_hide_behind)
    interfaces = build_interfaces_list(interfaces_name, interfaces_subnet, interfaces_mask_length)

    result = client.update_host(
        identifier,
        ignore_warnings,
        ignore_errors,
        ip_address=ip_address,
        new_name=new_name,
        comments=comments,
        groups=groups_list,
        color=color,
        nat_settings=nat_settings,
        interfaces=interfaces,
        tags=tags_list,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "ipv4-address",
        "last-modifier",
        "read-only",
        "color",
        "comments",
        "tags",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown("CheckPoint data for updating a host:", printable_result, headers=headers, removeNull=True)

    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Host",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_host_command(client: Client, identifier, ignore_warnings: bool, ignore_errors: bool) -> CommandResults:
    """
    delete host object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        ignore_warnings (bool): Whether to ignore warnings when adding a host.
        ignore_errors (bool): Whether to ignore errors when adding a host.
    """
    identifiers_list = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = []
    for item in identifiers_list:
        current_result = client.delete_host(item, ignore_warnings, ignore_errors)
        result.append(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown("CheckPoint data for deleting host:", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Host",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_groups_command(
    client: Client,
    limit: int,
    offset: int,
    details_level: str = None,
    domains_to_process: str = None,
    filter: str = None,
) -> CommandResults:
    """
    Retrieve all group objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
        details_level (str): The level of detail for returned objects.
        domains_to_process (str): Indicates which domains to process the commands on.
        filter (str): Search expression to filter objects by.
    """
    domains_list = argToList(domains_to_process) if domains_to_process else None
    result = client.list_groups(limit, offset, details_level=details_level, domains_to_process=domains_list, filter_exp=filter)
    result = result.get("objects")

    printable_result = []
    readable_output = ""

    if result:
        for element in result:
            current_printable_result = {}

            domain = element.get("domain", {})
            current_printable_result["domain-name"] = domain.get("name")
            current_printable_result["domain-uid"] = domain.get("uid")
            current_printable_result["domain-type"] = domain.get("domain-type")

            for endpoint in DEFAULT_LIST_FIELD:
                if endpoint not in ["domain-name", "domain-uid", "domain-type"]:
                    current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown(
            "CheckPoint data for all groups:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Group",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_get_group_command(client: Client, identifier: str, details_level: str = None) -> CommandResults:
    """
    Show existing group object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        details_level (str): The level of detail for returned objects.
    """
    result = client.get_group(identifier, details_level=details_level)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        f"CheckPoint for {identifier} group:", printable_result, headers=DEFAULT_LIST_FIELD, removeNull=True
    )
    readable_output, printable_result = build_member_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Group",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_group_command(
    client: Client,
    name,
    members: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
    ignore_warnings: Union[bool, str] = "false",
    ignore_errors: Union[bool, str] = "false",
) -> CommandResults:
    """
    add group objects.

    Args:
        client (Client): CheckPoint client.
        name(str): Object name. Must be unique in the domain.
        members (str or list): Collection of network objects identified by name or UID.
        comments (str): Comments string.
        color (str): Object color.
        tags (str or list): Collection of tag identifiers.
        ignore_warnings (str): Whether to ignore warnings when adding a group.
        ignore_errors (str): Whether to ignore errors when adding a group.
    """
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "ipv4-address",
        "ipv6-address",
        "read-only",
        "groups",
        "color",
        "comments",
    ]
    name = argToList(name)
    members_list = argToList(members) if members else None
    tags_list = argToList(tags) if tags else None
    ignore_warnings_bool = argToBoolean(ignore_warnings)
    ignore_errors_bool = argToBoolean(ignore_errors)
    result = []
    printable_result = {}
    readable_output = ""

    for item in enumerate(name):
        current_result = client.add_group(
            item[1],
            members=members_list,
            comments=comments,
            color=color,
            tags=tags_list,
            ignore_warnings=ignore_warnings_bool,
            ignore_errors=ignore_errors_bool,
        )
        printable_result = build_printable_result(headers, current_result)
        current_readable_output = tableToMarkdown(
            "CheckPoint data for adding group:", printable_result, headers=headers, removeNull=True
        )
        readable_output = readable_output + current_readable_output
        result.append(current_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Group",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_update_group_command(
    client: Client,
    identifier: str,
    ignore_warnings: Union[bool, str] = "true",
    ignore_errors: Union[bool, str] = "false",
    action: str = "",
    members=None,
    new_name: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
    details_level: str = None,
) -> CommandResults:
    """
    Edit existing group using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        ignore_warnings(bool):Apply changes ignoring warnings.
        action(str): The action to take towards the modified objects.
        ignore_errors(bool): 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
        members(object): Collection of Network objects identified by the name or UID.
        new_name(str): New name of the object.
        comments(str): Comments string.
        color (str): Object color.
        tags (str or list): Collection of tag identifiers.
        details_level (str): The level of detail for returned objects.
    """
    if members:
        # noinspection PyTypeChecker
        members = argToList(members)
    tags_list = argToList(tags) if tags else None
    ignore_warnings_bool = argToBoolean(ignore_warnings)
    ignore_errors_bool = argToBoolean(ignore_errors)

    result = client.update_group(
        identifier,
        ignore_warnings_bool,
        ignore_errors_bool,
        action,
        members,
        new_name=new_name,
        comments=comments,
        color=color,
        tags=tags_list,
        details_level=details_level,
    )
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "read-only",
        "color",
        "comments",
        "tags",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown("CheckPoint data for updating a group:", printable_result, headers=headers, removeNull=True)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Group",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_group_command(client: Client, identifier) -> CommandResults:
    """
    delete group object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    identifier = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = {}

    for item in enumerate(identifier):
        current_result = client.delete_group(item[1])
        result.update(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown(f"CheckPoint data for deleting {item[1]}:", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Group",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_address_range_command(
    client: Client,
    limit: int,
    offset: int,
    details_level: str = None,
    domains_to_process: str = None,
) -> CommandResults:
    """
    Retrieve all address range objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
        details_level (str): The level of detail for returned objects.
        domains_to_process (str): Indicates which domains to process the commands on.
    """
    domains_list = argToList(domains_to_process) if domains_to_process else None
    result = client.list_address_ranges(limit, offset, details_level=details_level, domains_to_process=domains_list)
    result = result.get("objects")

    printable_result = []
    readable_output = ""

    if result:
        for element in result:
            current_printable_result = {}

            domain = element.get("domain", {})
            current_printable_result["domain-name"] = domain.get("name")
            current_printable_result["domain-uid"] = domain.get("uid")
            current_printable_result["domain-type"] = domain.get("domain-type")

            for endpoint in DEFAULT_LIST_FIELD:
                if endpoint not in ["domain-name", "domain-uid", "domain-type"]:
                    current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown(
            "CheckPoint data for all address ranges:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddressRange",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_get_address_range_command(client: Client, identifier: str) -> CommandResults:
    """
    Show existing address range object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    result = client.get_address_range(identifier)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for {identifier} address range:", printable_result, headers=DEFAULT_LIST_FIELD, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddressRange",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_address_range_command(
    client: Client,
    name: str,
    ip_address_first: str,
    ip_address_last: str,
    set_if_exists: Union[bool, str] = "false",
    ignore_warnings: Union[bool, str] = "true",
    ignore_errors: Union[bool, str] = "false",
    groups=None,
    comments: str = None,
    color: str = None,
    nat_auto_rule: str = None,
    nat_method: str = None,
    nat_ip: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    tags: str = None,
) -> CommandResults:
    """
    add address range object.

    Args:
        client (Client): CheckPoint client.
        name(str): Object name. Must be unique in the domain.
        ip_address_first(str): First IP address in the range. IPv4 or IPv6 address.
        ip_address_last(str): Last IP address in the range. IPv4 or IPv6 address.
        set_if_exists(bool): If another object with the same identifier already exists,
                             it will be updated.
        ignore_warnings(bool): Apply changes ignoring warnings.
        ignore_errors(bool): Apply changes ignoring errors
        groups(str or list): Collection of group identifiers.
        comments (str): Comments string.
        color (str): Object color.
        nat_auto_rule (str): Whether to enable automatic NAT rule generation.
        nat_method (str): NAT translation method (hide or static).
        nat_ip (str): NAT IPv4 or IPv6 address.
        nat_install_on (str): Gateway for NAT install-on setting.
        nat_hide_behind (str): Hide behind method (gateway or ip_address).
        tags (str or list): Collection of tag identifiers.
    """
    groups_list = argToList(groups) if groups else None
    tags_list = argToList(tags) if tags else None
    set_if_exists_bool = argToBoolean(set_if_exists)
    ignore_warnings_bool = argToBoolean(ignore_warnings)
    ignore_errors_bool = argToBoolean(ignore_errors)
    nat_settings = build_nat_settings(nat_auto_rule, nat_method, nat_ip, nat_install_on, nat_hide_behind)

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "ipv4-address-first",
        "ipv4-address-last",
        "ipv6-address-first",
        "ipv6-address-last",
        "last-modifier",
        "read-only",
        "color",
        "comments",
        "tags",
        "nat-auto-rule",
        "nat-method",
        "nat-ipv4-address",
        "nat-install-on",
        "nat-hide-behind",
    ]

    result = client.add_address_range(
        name,
        ip_address_first,
        ip_address_last,
        set_if_exists_bool,
        ignore_warnings_bool,
        ignore_errors_bool,
        groups=groups_list,
        comments=comments,
        color=color,
        nat_settings=nat_settings,
        tags=tags_list,
    )
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding an address range:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddressRange",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_update_address_range_command(
    client: Client,
    identifier: str,
    ignore_warnings: Union[bool, str] = "true",
    ignore_errors: Union[bool, str] = "false",
    ip_address_first: str = None,
    ip_address_last: str = None,
    new_name: str = None,
    comments: str = None,
    groups=None,
    color: str = None,
    nat_auto_rule: str = None,
    nat_method: str = None,
    nat_ip: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    tags: str = None,
) -> CommandResults:
    """
    Edit existing address range object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        ignore_warnings(bool):Apply changes ignoring warnings.
        ignore_errors(bool): 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
        ip_address_first(str): First IP address in the range. IPv4 or IPv6 address.
        ip_address_last(str): Last IP address in the range. IPv4 or IPv6 address.
        new_name(str): New name of the object.
        comments(str): Comments string.
        groups(str or list): Collection of group identifiers.
        color (str): Object color.
        nat_auto_rule (str): Whether to enable automatic NAT rule generation.
        nat_method (str): NAT translation method (hide or static).
        nat_ip (str): NAT IPv4 or IPv6 address.
        nat_install_on (str): Gateway for NAT install-on setting.
        nat_hide_behind (str): Hide behind method (gateway or ip_address).
        tags (str or list): Collection of tag identifiers.
    """
    groups_list = argToList(groups) if groups else None
    tags_list = argToList(tags) if tags else None
    ignore_warnings_bool = argToBoolean(ignore_warnings)
    ignore_errors_bool = argToBoolean(ignore_errors)
    nat_settings = build_nat_settings(nat_auto_rule, nat_method, nat_ip, nat_install_on, nat_hide_behind)

    result = client.update_address_range(
        identifier,
        ignore_warnings_bool,
        ignore_errors_bool,
        ip_address_first=ip_address_first,
        ip_address_last=ip_address_last,
        new_name=new_name,
        comments=comments,
        groups=groups_list,
        color=color,
        nat_settings=nat_settings,
        tags=tags_list,
    )
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "ipv4-address",
        "last-modifier",
        "read-only",
        "color",
        "tags",
        "nat-auto-rule",
        "nat-method",
        "nat-ipv4-address",
        "nat-install-on",
        "nat-hide-behind",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating an address range:", printable_result, headers=headers, removeNull=True
    )

    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddressRange",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_address_range_command(client: Client, identifier) -> CommandResults:
    """
    delete address range object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    identifier = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = {}
    for item in enumerate(identifier):
        current_result = client.delete_address_range(item[1])
        result.update(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown("CheckPoint data for deleting address range:", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddressRange",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_threat_indicator_command(
    client: Client,
    limit: int,
    offset: int,
    domain_names: str = None,
    details_level: str = None,
    filter: str = None,
) -> CommandResults:
    """
    Retrieve all threat indicator objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
        domain_names (str): Indicates which domains to process.
        details_level (str): The level of detail for returned objects.
        filter (str): Search expression to filter objects by.
    """
    domains_list = argToList(domain_names) if domain_names else None
    result = client.list_threat_indicators(
        limit, offset, domain_names=domains_list, details_level=details_level, filter_exp=filter
    )
    result["objects"] = result.pop("indicators")
    printable_result = []
    readable_output = ""

    result = result.get("objects")
    if result:
        for element in result:
            current_printable_result = {}

            domain = element.get("domain", {})
            current_printable_result["domain-name"] = domain.get("name")
            current_printable_result["domain-uid"] = domain.get("uid")
            current_printable_result["domain-type"] = domain.get("domain-type")

            for endpoint in DEFAULT_LIST_FIELD:
                if endpoint not in ["domain-name", "domain-uid", "domain-type"]:
                    current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown(
            "CheckPoint data for all threat indicators:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ThreatIndicator",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_get_threat_indicator_command(client: Client, identifier: str) -> CommandResults:
    """
    Show existing threat indicator object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    result = client.get_threat_indicator(identifier)
    headers = DEFAULT_LIST_FIELD + ["number-of-observables"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for {identifier} threat indicator:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ThreatIndicator",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_threat_indicator_command(
    client: Client,
    name: str,
    profile_action: str,
    observables: list = None,
    action: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
    ignore_warnings: Union[bool, str] = "false",
) -> CommandResults:
    """
    Create new threat indicator.

    Args:
        client (Client): CheckPoint client.
        name(str): Object name. Must be unique in the domain.
        profile_action (str or list): List of profile-action pairs in the format 'profile_action'.
            Each item is split by '_' to create a profile override with 'profile' and 'action' keys.
            example: ["p1_a1", "p2_a2", "p3_a3"]
        observables(list): The indicator's observables.
        action (str): Action for the indicator.
        comments (str): Comments string.
        color (str): Object color.
        tags (str or list): Collection of tag identifiers.
        ignore_warnings (str): Whether to ignore warnings.
    """
    observables_list = argToList(observables) if observables else []
    tags_list = argToList(tags) if tags else None
    profile_action_list = argToList(profile_action)
    profile_overrides = []
    for item in profile_action_list:
        parts = item.split("_", 1)
        if len(parts) == 2:
            profile_overrides.append({"profile": parts[0], "action": parts[1]})
        else:
            profile_overrides.append({"profile": parts[0], "action": ""})
    ignore_warnings_bool = argToBoolean(ignore_warnings)

    result = client.add_threat_indicator(
        name,
        observables_list,
        comments=comments,
        color=color,
        tags=tags_list,
        ignore_warnings=ignore_warnings_bool,
        action=action,
        profile_overrides=profile_overrides,
    )
    printable_result = {"task-id": result.get("task-id")}
    readable_output = tableToMarkdown("CheckPoint data for adding an threat indicator:", printable_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ThreatIndicator",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_update_threat_indicator_command(
    client: Client,
    identifier: str,
    profile_action: str,
    action: str = None,
    new_name: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
) -> CommandResults:
    """
    Edit existing threat indicator object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        profile_action (str or list): List of profile-action pairs in the format 'profile_action'.
            Each item is split by '_' to create a profile override with 'profile' and 'action' keys.
            example: ["p1_a1", "p2_a2", "p3_a3"]
        action (str): the action to set. available options:
                            "Inactive", "Ask", "Prevent", "Detect".
        new_name(str): New name of the object.
        comments(str): Comments string.
        color (str): Object color.
        tags (str or list): Collection of tag identifiers.
    """
    profile_action_list = argToList(profile_action)
    profile_overrides = []
    for item in profile_action_list:
        parts = item.split("_", 1)
        if len(parts) == 2:
            profile_overrides.append({"profile": parts[0], "action": parts[1]})
        else:
            profile_overrides.append({"profile": parts[0], "action": ""})
    tags_list = argToList(tags) if tags else None

    result = client.update_threat_indicator(
        identifier,
        action=action,
        new_name=new_name,
        comments=comments,
        profile_overrides=profile_overrides,
        color=color,
        tags=tags_list,
    )
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "ipv4-address",
        "last-modifier",
        "read-only",
        "color",
        "tags",
        "profile-overrides",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for update {identifier} threat indicator", printable_result, headers=headers, removeNull=True
    )

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ThreatIndicator",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_threat_indicator_command(client: Client, identifier) -> CommandResults:
    """
    delete threat indicator object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    identifier = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = {}
    for item in enumerate(identifier):
        current_result = client.delete_threat_indicator(item[1])
        result.update(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown(f"CheckPoint status for deleting {item[1]}threat indicator:", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ThreatIndicator",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_access_rule_command(
    client: Client,
    identifier: str,
    limit: int,
    offset: int,
    details_level: str = None,
    show_hits: str = None,
) -> CommandResults:
    """
    Show existing access rule base objects using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
        limit (int): The maximal number of returned results.
        offset (int): Number of the results to initially skip.
        details_level (str): The level of detail for returned objects.
        show_hits (str): Whether to include hit count data in the output.
    """
    printable_result = []
    readable_output = ""
    show_hits_bool = argToBoolean(show_hits) if show_hits is not None else None

    result = client.list_access_rule(identifier, limit, offset, details_level=details_level, show_hits=show_hits_bool)
    result = result.get("rulebase")

    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in DEFAULT_LIST_FIELD:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown(
            "CheckPoint data for all access rule bases:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.AccessRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_access_rule_command(
    client: Client,
    layer: str,
    position: str,
    position_rule: str = None,
    action: str = "Drop",
    name: str = None,
    vpn: str = None,
    destination=None,
    service=None,
    source=None,
    comments: str = None,
    install_on: str = None,
    enabled: str = None,
    track_type: str = None,
    track_accounting: str = None,
    track_per_session: str = None,
) -> CommandResults:
    """
    Add new access rule object.

    Args:
        client (Client): CheckPoint client.
        layer(str): Layer that the rule belongs to identified by the name or UID.
        position(str): Position in the rulebase. Can be an integer, "top", "bottom", "above", or "below".
        position_rule(str): The name of the rule or section to position relative to.
            Required when position is "above" or "below".
            Optional when position is "top" or "bottom" (used as a reference section name).
        name(str): rule name
        action(str): Action settings. valid values are: Accept, Drop, Apply Layer, Ask and Info
        vpn(str): Communities or Directional. Valid values: Any, All_GwToGw.
        destination(str or list): Collection of Network objects identified by the name or UID.
        service(str or list): Collection of Network objects identified by the name or UID.
        source(str or list): Collection of Network objects identified by the name or UID.
        comments (str): Comments string.
        install_on (str or list): Which gateways to install the policy on.
        enabled (str): Enable/Disable the rule.
        track_type (str): Track settings (Log, Extended Log, Detailed Log, None).
        track_accounting (str): Turns accounting for track on and off.
        track_per_session (str): Determines whether to perform the log per session.
    """
    """
    According to API docs:
    - "above"/"below" require position_rule (reference rule/section name)
    - "top"/"bottom" can optionally use position_rule (reference section name)
    - integer position is sent as-is (no position_rule needed)
    """
    if position in ("above", "below") and not position_rule:
        raise DemistoException(
            f"The 'position_rule' argument is required when position is '{position}'. "
            f"Provide the name of the rule or section to position relative to."
        )
    if position_rule:
        position_obj: str | int | dict = {position: position_rule}
    elif position.isdigit():
        position_obj = int(position)
    else:
        position_obj = position

    install_on_list = argToList(install_on) if install_on else None
    enabled_bool = argToBoolean(enabled) if enabled is not None else None

    # Build track settings dict
    track = None
    if track_type or track_accounting or track_per_session:
        track = {}
        if track_type:
            track["type"] = track_type
        if track_accounting is not None:
            track["accounting"] = argToBoolean(track_accounting)
        if track_per_session is not None:
            track["per-session"] = argToBoolean(track_per_session)

    headers = ["name", "uid", "type", "domain-name", "domain-type", "domain-uid", "enabled", "layer", "creator", "last-modifier"]

    result = client.add_rule(
        layer,
        position_obj,
        action,
        name=name,
        vpn=vpn,
        destination=destination,
        service=service,
        source=source,
        comments=comments,
        install_on=install_on_list,
        enabled=enabled_bool,
        track=track,
    )
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding access rule:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.AccessRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_update_access_rule_command(
    client: Client,
    identifier: str,
    layer: str,
    ignore_warnings: Union[bool, str] = "true",
    ignore_errors: Union[bool, str] = "false",
    enabled: str = None,
    action: str = None,
    new_name: str = None,
    new_position: str = None,
    new_position_rule: str = None,
    comments: str = None,
    track_type: str = None,
    track_accounting: str = None,
    track_per_session: str = None,
    install_on: str = None,
    source_add: str = None,
    source_remove: str = None,
    service_add: str = None,
    service_remove: str = None,
    destination_add: str = None,
    destination_remove: str = None,
) -> CommandResults:
    """
    Edit existing access rule object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid, name or rule-number.
        layer (str): Layer that the rule belongs to identified by the name or UID.
        ignore_warnings(bool): Apply changes ignoring warnings.
        ignore_errors(bool): Apply changes ignoring errors.
        enabled(str): Enable/Disable the rule.
        action (str): the action to set.
        new_name(str): New name of the object.
        new_position(str): New position in the rulebase. Can be an integer, "top", "bottom", "above", or "below".
        new_position_rule(str): The name of the rule or section to position relative to.
            Required when new_position is "above" or "below".
            Optional when new_position is "top" or "bottom" (used as a reference section name).
        comments (str): Comments string.
        track_type (str): Track settings (Log, Extended Log, Detailed Log, None).
        track_accounting (str): Turns accounting for track on and off.
        track_per_session (str): Determines whether to perform the log per session.
        install_on (str or list): Which gateways to install the policy on.
        source_add (str or list): Adds to the collection of source network objects.
        source_remove (str or list): Removes from the collection of source network objects.
        service_add (str or list): Adds to the collection of service objects.
        service_remove (str or list): Removes from the collection of service objects.
        destination_add (str or list): Adds to the collection of destination network objects.
        destination_remove (str or list): Removes from the collection of destination network objects.
    """
    new_position_obj: str | int | dict | None = None
    if new_position is not None:
        if new_position in ("above", "below") and not new_position_rule:
            raise DemistoException(
                f"The 'new_position_rule' argument is required when new_position is '{new_position}'. "
                f"Provide the name of the rule or section to position relative to."
            )
        if new_position_rule:
            new_position_obj = {new_position: new_position_rule}
        elif new_position.isdigit():
            new_position_obj = int(new_position)
        else:
            new_position_obj = new_position

    ignore_warnings_bool = argToBoolean(ignore_warnings)
    ignore_errors_bool = argToBoolean(ignore_errors)
    enabled_bool = argToBoolean(enabled) if enabled is not None else None
    install_on_list = argToList(install_on) if install_on else None

    # Build track settings dict
    track = None
    if track_type or track_accounting or track_per_session:
        track = {}
        if track_type:
            track["type"] = track_type
        if track_accounting is not None:
            track["accounting"] = argToBoolean(track_accounting)
        if track_per_session is not None:
            track["per-session"] = argToBoolean(track_per_session)

    # Build incremental source/destination/service dicts
    source_obj = None
    if source_add or source_remove:
        source_obj = {}
        if source_add:
            source_obj["add"] = argToList(source_add)
        if source_remove:
            source_obj["remove"] = argToList(source_remove)

    destination_obj = None
    if destination_add or destination_remove:
        destination_obj = {}
        if destination_add:
            destination_obj["add"] = argToList(destination_add)
        if destination_remove:
            destination_obj["remove"] = argToList(destination_remove)

    service_obj = None
    if service_add or service_remove:
        service_obj = {}
        if service_add:
            service_obj["add"] = argToList(service_add)
        if service_remove:
            service_obj["remove"] = argToList(service_remove)

    result = client.update_rule(
        identifier,
        layer,
        ignore_warnings_bool,
        ignore_errors_bool,
        enabled=enabled_bool,
        action=action,
        new_name=new_name,
        new_position=new_position_obj,
        comments=comments,
        track=track,
        install_on=install_on_list,
        source=source_obj,
        destination=destination_obj,
        service=service_obj,
    )
    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "action-name",
        "action-uid",
        "action-type",
        "content-direction",
        "creator",
        "enabled",
        "last-modifier",
    ]
    printable_result = build_printable_result(headers, result)

    action_data = result.get("action")
    if action_data:
        printable_result["action-name"] = action_data.get("name")
        printable_result["action-uid"] = action_data.get("uid")
        printable_result["action-type"] = action_data.get("type")

    readable_output = tableToMarkdown(
        "CheckPoint data for updating an access rule:", printable_result, headers=headers, removeNull=True
    )

    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AccessRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_access_rule_command(client: Client, identifier, layer: str) -> CommandResults:
    """
    Delete existing rule object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid, name or rule-number.
        layer(str): Layer that the rule belongs to identified by the name or UID.
    """
    identifier = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = {}
    for item in enumerate(identifier):
        current_result = client.delete_rule(item[1], layer)
        result.update(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown(f"CheckPoint data for deleting access rule range: {item[1]}", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AccessRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_application_site_command(
    client: Client,
    limit: int,
    offset: int,
    details_level: str = None,
    domains_to_process: str = None,
) -> CommandResults:
    """
    Show existing application site objects using object name or uid.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results.
        offset (int): Number of the results to initially skip.
        details_level (str): The level of detail for returned objects.
        domains_to_process (str): Indicates which domains to process the commands on.
    """
    printable_result = []
    readable_output = ""
    domains_list = argToList(domains_to_process) if domains_to_process else None

    result = client.list_application_site(limit, offset, details_level=details_level, domains_to_process=domains_list)
    result = result.get("objects")
    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in DEFAULT_LIST_FIELD:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)
        readable_output = tableToMarkdown(
            "CheckPoint data for all access rule bases:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSite",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_application_site_command(
    client: Client,
    name: str,
    primary_category: str,
    identifier=None,
    groups=None,
    description: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
):
    """
    Add application site objects.

    Args:
        client (Client): CheckPoint client.
        name(str): Object name. Must be unique in the domain.
        primary_category(str): Each application is assigned to one primary category
                                based on its most defining aspect.
        identifier(str or list): can be-
                               url-list(str or list): URLs that determine this particular
                               application
                               application-signature(str): Application signature generated by
                                                            Signature Tool.
        groups(str or list): Collection of group identifiers.
        description (str): A description of the application site.
        comments (str): Comments string.
        color (str): Object color.
        tags (str or list): Collection of tag identifiers.
    """
    identifier = argToList(identifier)
    groups = argToList(groups) if groups else None
    tags_list = argToList(tags) if tags else None
    headers = [
        "name",
        "uid",
        "type",
        "url-list",
        "application-id",
        "domain-name",
        "domain-type",
        "domain-uid",
        "description",
        "creator",
        "last-modifier",
        "groups",
    ]

    result = client.add_application_site(
        name,
        primary_category,
        identifier,
        groups=groups,
        description=description,
        comments=comments,
        color=color,
        tags=tags_list,
    )
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding application site:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSite",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_update_application_site_command(
    client: Client,
    identifier: str,
    urls_defined_as_regular_expression: bool = True,
    groups=None,
    url_list=None,
    url_list_to_add=None,
    url_list_to_remove=None,
    description: str = None,
    new_name: str = None,
    primary_category: str = None,
    application_signature: str = None,
    comments: str = None,
    color: str = None,
    tags: str = None,
):
    """
    Edit existing application site object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier: uid or name.
        url_list(str or list): URLs that determine this particular application.
                                can be a string of a URL or a list of URLs.
        url_list_to_add (str or list): Adds to collection of values.
        url_list_to_remove (str or list): Removes from collection of values.
        urls_defined_as_regular_expression(bool): States whether the URL is defined as a
                                                  Regular Expression or not.
        groups(str or list): Collection of group identifiers.
        description(str): A description for the application.
        new_name(str): New name of the object.
        primary_category (str): Each application is assigned to one primary category based on
                                its most defining aspect
        application_signature(str): Application signature generated by Signature Tool
    """

    url_list_object = None
    if url_list:
        url_list_object = argToList(url_list)

    elif url_list_to_add:
        url_list_to_add = argToList(url_list_to_add)
        url_list_object = {"add": url_list_to_add}

    elif url_list_to_remove:
        url_list_to_remove = argToList(url_list_to_remove)
        url_list_object = {"remove": url_list_to_remove}

    if groups:
        groups = argToList(groups)
    tags_list = argToList(tags) if tags else None
    result = client.update_application_site(
        identifier,
        urls_defined_as_regular_expression,
        groups=groups,
        url_list=url_list_object,
        description=description,
        new_name=new_name,
        primary_category=primary_category,
        application_signature=application_signature,
        comments=comments,
        color=color,
        tags=tags_list,
    )
    headers = [
        "name",
        "uid",
        "type",
        "application-id",
        "primary-category",
        "url-list",
        "domain-name",
        "domain-type",
        "domain-uid",
        "description",
        "groups",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating an application site:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSite",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_application_site_command(client: Client, identifier) -> CommandResults:
    """
    Delete existing application site object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid, name or rule-number.
    """
    identifier = argToList(identifier)
    readable_output = ""
    printable_result = {}
    result = {}
    for item in enumerate(identifier):
        current_result = client.delete_application_site(item[1])
        result.update(current_result)
        printable_result = {"message": current_result.get("message")}
        current_readable_output = tableToMarkdown(f"CheckPoint data for deleting application site : {item[1]}", printable_result)
        readable_output = readable_output + current_readable_output

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSite",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_application_site_categories_command(client: Client, limit: int, offset: int) -> CommandResults:
    """
    Retrieve all application site categories objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
    """
    result = client.list_application_site_categories(limit, offset)
    result = result.get("objects")

    printable_result = []
    readable_output = ""

    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in DEFAULT_LIST_FIELD:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown(
            "CheckPoint data for all application site category:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
        )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSiteCategory",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_get_application_site_category_command(client: Client, identifier: str) -> CommandResults:
    """
    Show existing application site category object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    result = client.get_application_site_category(identifier)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding application site category:", printable_result, headers=DEFAULT_LIST_FIELD, removeNull=True
    )

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSiteCategory",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_application_site_category_command(client: Client, identifier: str, groups=None) -> CommandResults:
    """
    Add application site objects.

    Args:
        client (Client): CheckPoint client.
        identifier (str or list): Object name or unique identifier.
        groups (str or list): Collection of group identifiers.
    """
    identifier = argToList(identifier)
    groups = argToList(groups)

    headers = [
        "name",
        "uid",
        "type",
        "url-list",
        "application-id",
        "domain-name",
        "domain-type",
        "domain-uid",
        "description",
        "creator",
        "last-modifier",
        "groups",
    ]
    readable_output = ""
    printable_result = {}
    result = {}
    for item in enumerate(identifier):
        current_result = client.add_application_site_category(item[1], groups)
        result.update(current_result)

        printable_result = build_printable_result(headers, current_result)
        current_readable_output = tableToMarkdown(
            f"CheckPoint data for adding application site category {item[1]}:",
            printable_result,
            headers=headers,
            removeNull=True,
        )
        readable_output = readable_output + current_readable_output
        readable_output, printable_result = build_group_data(current_result, readable_output, printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.ApplicationSite",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_objects_command(
    client: Client, limit: int, offset: int, filter_search: str, ip_only: bool, object_type: str
) -> CommandResults:
    """
    Retrieve data about objects.

        Args:
            client (Client): CheckPoint client.
            limit (int): The maximal number of returned results.
            offset (int): Number of the results to initially skip.
            filter_search(str): Search expression to filter objects by. To use IP search only,
                                set the "ip-only" parameter to true.
            ip_only(bool): If using "filter", use this field to search objects by their IP address
                           only, without involving the textual search. Default value is False.
            object_type(str): The objects' type, e.g.: host, service-tcp, network, address-range.
                       Default value is object.
    """

    printable_result = []
    readable_output = ""

    result = client.list_objects(limit, offset, filter_search, ip_only, object_type)
    result = result.get("objects")
    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in DEFAULT_LIST_FIELD:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)
        readable_output = tableToMarkdown("CheckPoint data for objects:", printable_result, DEFAULT_LIST_FIELD, removeNull=True)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Objects",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_packages_command(client: Client, limit: int, offset: int) -> CommandResults:
    """
    Retrieve all policy packages.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results.
        offset (int): Number of the results to initially skip.
    """
    printable_result = []
    readable_output = ""
    headers = ["name", "uid", "type"]
    result = client.list_packages(limit, offset)
    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in headers:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)
        readable_output = tableToMarkdown("CheckPoint data for all packages:", printable_result, headers, removeNull=True)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Packages",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_package_command(client: Client, identifier: str) -> CommandResults:
    """
    Show existing package object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier(str): uid or name.
    """
    printable_result = []
    readable_output = ""
    headers = ["target-name", "target-uid", "revision"]
    result = client.list_package(identifier)
    if result:
        gwinfo = result.get("installation-targets-revision")
        if gwinfo:
            for element in gwinfo:
                current_printable_result = {}
                current_printable_result["name"] = result.get("name")
                for endpoint in headers:
                    current_printable_result[endpoint] = element.get(endpoint)
                printable_result.append(current_printable_result)
            readable_output = tableToMarkdown("CheckPoint data for package:", printable_result, headers, removeNull=True)
        else:
            readable_output = "No package objects were found."

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Package",
        outputs_key_field="target-uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_list_gateways_command(client: Client, limit: int, offset: int) -> CommandResults:
    """
    Retrieve all policy gateways.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results.
        offset (int): Number of the results to initially skip.
    """
    printable_result = []
    readable_output = ""
    headers = ["name", "uid", "type", "version", "network-security-blades", "management-blades"]
    result = client.list_gateways(limit, offset)
    if result:
        for element in result:
            current_printable_result = {}
            for endpoint in headers:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)
        readable_output = tableToMarkdown("CheckPoint data for all gateways:", printable_result, headers, removeNull=True)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.Gateways",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_publish_command(client: Client) -> CommandResults:
    """
    publish changes. All the changes done by this user will be seen by all users only after publish
    is called.
    Args:
        client (Client): CheckPoint client.
    """
    printable_result = {}
    readable_output = ""

    result = client.publish()
    if result:
        printable_result = {"task-id": result.get("task-id")}
        readable_output = tableToMarkdown("CheckPoint data for publishing current session:", printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.Publish",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_show_task_command(client: Client, task_id: str) -> CommandResults:
    """
    Show task status with the given task id

    Args:
        client (Client): CheckPoint client.
        task_id (str): task id.
    """
    printable_result = []
    result = client.show_task(task_id)
    task_list = result.get("tasks")
    if task_list:
        for task in task_list:
            current_object_data = {
                "task-id": task.get("task-id"),
                "task-name": task.get("task-name"),
                "status": task.get("status"),
                "suppressed": task.get("suppressed"),
                "progress-percentage": task.get("progress-percentage"),
            }
            printable_result.append(current_object_data)

    readable_output = tableToMarkdown(
        "CheckPoint data for tasks:",
        printable_result,
        ["task-name", "task-id", "status", "suppressed", "progress-percentage"],
        removeNull=True,
    )
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ShowTask",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_add_objects_batch_command(client: Client, object_type: str, ipaddress, name):
    context_data = {}
    readable_output = ""

    ip_addresses = argToList(ipaddress, ",")
    ip_object_names = argToList(name, ",")
    add_list = []
    for ip, name in zip(ip_addresses, ip_object_names):
        tmp_dict = {"name": name, "ip-address": ip}
        add_list.append(tmp_dict)

    result = client.add_objects_batch(object_type, add_list)

    if result:
        context_data = {"task-id": result.get("task-id")}
        readable_output = tableToMarkdown("CheckPoint data for add-objects-batch command:", context_data)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddObjectBatch",
        outputs_key_field="task-id",
        readable_output=readable_output,
        outputs=context_data,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_objects_batch_command(client: Client, object_type: str, name):
    context_data = {}
    readable_output = ""

    object_names = argToList(name)
    objects_to_delete = [{"name": object_name} for object_name in object_names]

    result = client.delete_objects_batch(object_type, objects_to_delete)

    if result:
        context_data = {"task-id": result.get("task-id")}
        readable_output = tableToMarkdown("CheckPoint data for delete-objects-batch command:", context_data)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.DeleteObjectsBatch",
        outputs_key_field="task-id",
        readable_output=readable_output,
        outputs=context_data,
        raw_response=result,
    )
    return command_results


def checkpoint_show_threat_protection_command(client: Client, args):
    context_data = {}
    readable_output = ""
    uid = args.get("uid", "")
    name = args.get("name")
    properties = args.get("properties") != "false"
    profiles = args.get("profiles") != "false"
    result = client.show_threat_protection(uid, name, properties, profiles)

    if result:
        context_data = {"uid": result}
        readable_output = tableToMarkdown("CheckPoint data for show threat protection command:", result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ShowThreatProtection",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=context_data,
        raw_response=result,
    )
    return command_results


def checkpoint_show_threat_protections_command(client: Client, args):
    context_data = {}
    readable_output = ""
    result = client.show_threat_protections(args)

    if result:
        context_data = result.get("protections", [])
        readable_output = tableToMarkdown("CheckPoint data for show threat protections command:", result.get("protections", []))
    command_results = CommandResults(
        outputs_prefix="CheckPoint.ShowThreatProtections",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=context_data,
        raw_response=result,
    )
    return command_results


def ip_settings(args):
    keys = args.keys()
    args["ips-settings"] = {}
    if "exclude-protection-with-performance-impact" in keys:
        args["ips-settings"]["exclude-protection-with-performance-impact"] = args["exclude-protection-with-performance-impact"]
        args.pop("exclude-protection-with-performance-impact")

    if "exclude-protection-with-performance-impact-mode" in keys:
        args["ips-settings"]["exclude-protection-with-performance-impact-mode"] = args[
            "exclude-protection-with-performance-impact-mode"
        ]
        args.pop("exclude-protection-with-performance-impact-mode")

    if "exclude-protection-with-severity" in keys:
        args["ips-settings"]["exclude-protection-with-severity"] = args["exclude-protection-with-severity"]
        args.pop("exclude-protection-with-severity")

    if "exclude-protection-with-severity-mode" in keys:
        args["ips-settings"]["exclude-protection-with-severity-mode"] = args["exclude-protection-with-severity-mode"]
        args.pop("exclude-protection-with-severity-mode")

    if "newly-updated-protections" in keys:
        args["ips-settings"]["newly-updated-protections"] = args["newly-updated-protections"]
        args.pop("newly-updated-protections")

    return args


def checkpoint_add_threat_profile_command(client: Client, args):
    body = {f'{k.replace("_", "-")}': v for k, v in args.items()}

    body = ip_settings(body)
    readable_output = ""

    result = client.add_threat_profile(body)

    if result:
        readable_output = tableToMarkdown("CheckPoint data for add threat profile command:", result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.AddedThreatProfiles",
        outputs_key_field="task-id",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )
    return command_results


def checkpoint_delete_threat_protections_command(client: Client, args):
    body = {}
    body["package-format"] = args.get("packageFormat")
    result = client.delete_threat_protections(body)

    if result:
        readable_output = tableToMarkdown("CheckPoint data for delete threat protections command:", result)
    else:
        readable_output = "No result was found."
    command_results = CommandResults(
        outputs_prefix="CheckPoint.DeletedThreatProtections",
        outputs_key_field="task-id",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )
    return command_results


def create_override_data(args):
    profiles = args.get("profiles").split(",")
    profiles = [x.rstrip() for x in profiles]

    if args.get("track"):
        args["track"] = args["track"].replace("-", " ")
    obj = []

    for profile in profiles:
        obj.append(
            {
                "profile": profile,
                "action": args.get("action"),
                "track": args.get("track"),
                "capture-packets": args.get("caputurePackets"),
            }
        )
    args["overrides"] = obj
    args.pop("profiles", None)
    args.pop("action", None)
    args.pop("track", None)
    args.pop("capturePackets", None)
    return args


def checkpoint_set_threat_protections_command(client: Client, args):
    readable_output = ""

    if args.get("profiles"):
        args = create_override_data(args)

    body = {f'{k.replace("_", "-")}': v for k, v in args.items()}
    result = client.set_threat_protection(body)

    if result:
        readable_output = tableToMarkdown("CheckPoint data for set threat protection command:", result)
    command_results = CommandResults(
        outputs_prefix="CheckPoint.SetThreatProtections",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )
    return command_results


def checkpoint_install_policy_command(client: Client, policy_package: str, access: bool, targets=None) -> CommandResults:
    """
    installing policy.

    Args:
        client (Client): CheckPoint client.
        policy_package(str): The name of the Policy Package to be installed.
        access(bool): Set to be true in order to install the Access Control policy.
                        By default, the value is true if Access Control policy is enabled
                        on the input policy package, otherwise false.
        targets(str or list):On what targets to execute this command. Targets may be identified
                            by their name, or object unique identifier.
    """
    printable_result = {}
    readable_output = ""

    result = client.install_policy(policy_package, access, targets)
    if result:
        printable_result = {"task-id": result.get("task-id")}
        readable_output = tableToMarkdown("CheckPoint data for installing policy:", printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.InstallPolicy",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_verify_policy_command(client: Client, policy_package: str) -> CommandResults:
    """
    Verifies the policy of the selected package.

    Args:
        client (Client): CheckPoint client.
        policy_package(str): The name of the Policy Package to be installed.
    """
    printable_result = {}
    readable_output = ""

    result = client.verify_policy(policy_package)
    if result:
        printable_result = {"task-id": result.get("task-id")}
        readable_output = tableToMarkdown("CheckPoint data for verifying policy", printable_result)

    command_results = CommandResults(
        outputs_prefix="CheckPoint.VerifyPolicy",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=printable_result,
        raw_response=result,
    )
    return command_results


def checkpoint_network_get_command(client: Client, identifier: str, details_level: str = None) -> CommandResults:
    """
    Show existing network object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        details_level (str): The level of detail for some of the fields in the response.
    """
    demisto.debug(f"checkpoint-network-get command called with args: {demisto.args()}")
    result = client.show_network(identifier, details_level)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for network object {identifier}:", printable_result, headers=DEFAULT_LIST_FIELD, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-network-get command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.Network",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_network_list_command(
    client: Client, limit: int = 50, offset: int = 0, details_level: str = None
) -> CommandResults:
    """
    Retrieve all network objects.

    Args:
        client (Client): CheckPoint client.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
        details_level (str): The level of detail for some of the fields in the response.
    """
    demisto.debug(f"checkpoint-network-list command called with args: {demisto.args()}")
    limit = arg_to_number(limit) or 50
    offset = arg_to_number(offset) or 0

    result = client.list_networks(limit, offset, details_level)

    printable_result: list = []
    readable_output = ""

    if result:
        if result.get("total") == 0:
            readable_output = "No network objects were found."
        else:
            objects = result.get("objects", [])
            for element in objects:
                current_printable_result = {}
                for endpoint in DEFAULT_LIST_FIELD:
                    current_printable_result[endpoint] = element.get(endpoint)
                printable_result.append(current_printable_result)

            readable_output = tableToMarkdown(
                "CheckPoint data for all networks:", printable_result, DEFAULT_LIST_FIELD, removeNull=True
            )

    demisto.debug("checkpoint-network-list command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.Network",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result.get("objects", []) if result else [],
        raw_response=result,
    )


def checkpoint_network_add_command(
    client: Client,
    identifier: str,
    subnet: str,
    mask_length: str = None,
    subnet_mask: str = None,
    comments: str = None,
    color: str = None,
    tags=None,
    broadcast: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    nat_settings_auto_rule: str = None,
    nat_settings_ip: str = None,
    nat_method: str = None,
) -> CommandResults:
    """
    Create a new network object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object name. Must be unique in the domain.
        subnet (str): IPv4 network address.
        mask_length (str): IPv4 network mask length.
        subnet_mask (str): IPv4 network mask.
        comments (str): Comments string.
        color (str): Color of the object.
        tags: Collection of tag identifiers.
        broadcast (str): Allow broadcast address inclusion.
        nat_install_on (str): Gateway for NAT rule.
        nat_hide_behind (str): Hide behind method.
        nat_settings_auto_rule (str): Whether to add automatic address translation rules.
        nat_settings_ip (str): IPv4 address for NAT.
        nat_method (str): NAT translation method.
    """
    demisto.debug(f"checkpoint-network-add command called with args: {demisto.args()}")
    tags = argToList(tags)

    nat_settings = build_nat_settings(
        nat_auto_rule=nat_settings_auto_rule,
        nat_method=nat_method,
        nat_ip=nat_settings_ip,
        nat_install_on=nat_install_on,
        nat_hide_behind=nat_hide_behind,
    )

    result = client.add_network(
        identifier=identifier,
        subnet=subnet,
        mask_length=arg_to_number(mask_length),
        subnet_mask=subnet_mask,
        comments=comments,
        color=color,
        tags=tags or None,
        broadcast=broadcast,
        nat_settings=nat_settings,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "read-only",
        "groups",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown("CheckPoint data for adding a network:", printable_result, headers=headers, removeNull=True)
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-network-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.Network",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_network_update_command(
    client: Client,
    identifier: str,
    new_identifier: str = None,
    subnet: str = None,
    subnet_mask: str = None,
    comments: str = None,
    color: str = None,
    tags=None,
    broadcast: str = None,
    nat_install_on: str = None,
    nat_hide_behind: str = None,
    nat_settings_auto_rule: str = None,
    nat_settings_ip: str = None,
    nat_method: str = None,
) -> CommandResults:
    """
    Update an existing network object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        new_identifier (str): New name of the object.
        subnet (str): IPv4 network address.
        subnet_mask (str): IPv4 network mask.
        comments (str): Comments string.
        color (str): Color of the object.
        tags: Collection of tag identifiers.
        broadcast (str): Allow broadcast address inclusion.
        nat_install_on (str): Gateway for NAT rule.
        nat_hide_behind (str): Hide behind method.
        nat_settings_auto_rule (str): Whether to add automatic address translation rules.
        nat_settings_ip (str): IPv4 address for NAT.
        nat_method (str): NAT translation method.
    """
    demisto.debug(f"checkpoint-network-update command called with args: {demisto.args()}")
    tags = argToList(tags)

    nat_settings = build_nat_settings(
        nat_auto_rule=nat_settings_auto_rule,
        nat_method=nat_method,
        nat_ip=nat_settings_ip,
        nat_install_on=nat_install_on,
        nat_hide_behind=nat_hide_behind,
    )

    result = client.update_network(
        identifier=identifier,
        new_identifier=new_identifier,
        subnet=subnet,
        subnet_mask=subnet_mask,
        comments=comments,
        color=color,
        tags=tags or None,
        broadcast=broadcast,
        nat_settings=nat_settings,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "last-modifier",
        "read-only",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating a network:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-network-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.Network",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_network_delete_command(
    client: Client, identifier: str, ignore_warnings: Union[bool, str] = True
) -> CommandResults:
    """
    Delete a network object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        ignore_warnings (bool): Whether to ignore warnings when deleting the network object.
    """
    demisto.debug(f"checkpoint-network-delete command called with args: {demisto.args()}")
    ignore_warnings = argToBoolean(ignore_warnings)

    client.delete_network(identifier, ignore_warnings)

    demisto.debug("checkpoint-network-delete command completed successfully")
    return CommandResults(
        readable_output="Object deleted successfully.",
    )


SERVICE_TYPE_CONTEXT_MAP = {
    "tcp": "CheckPoint.TCPService",
    "udp": "CheckPoint.UDPService",
    "icmp": "CheckPoint.ICMPService",
}


def checkpoint_service_get_command(client: Client, identifier: str, service_type: str) -> CommandResults:
    """
    Show existing service object using object name or uid.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        service_type (str): The service type (tcp, udp, or icmp).
    """
    demisto.debug(f"checkpoint-service-get command called with args: {demisto.args()}")
    result = client.show_service(identifier, service_type)
    printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for {service_type} service object {identifier}:",
        printable_result,
        headers=DEFAULT_LIST_FIELD,
        removeNull=True,
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-service-get command completed successfully")
    return CommandResults(
        outputs_prefix=SERVICE_TYPE_CONTEXT_MAP[service_type],
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_list_command(
    client: Client, service_type: str, identifier: str = None, limit: int = 50, offset: int = 0
) -> CommandResults:
    """
    Retrieve service objects. When identifier is provided, calls the single-object endpoint.

    Args:
        client (Client): CheckPoint client.
        service_type (str): The service type (tcp, udp, or icmp).
        identifier (str): uid or name. When provided, calls show-service-* instead of show-services-*.
        limit (int): The maximal number of returned results. default is 50.
        offset (int): Number of the results to initially skip. default is 0.
    """
    demisto.debug(f"checkpoint-service-list command called with args: {demisto.args()}")
    if identifier:
        result = client.show_service(identifier, service_type)
        printable_result = build_printable_result(DEFAULT_LIST_FIELD, result)
        readable_output = tableToMarkdown(
            f"CheckPoint data for {service_type} service object {identifier}:",
            printable_result,
            headers=DEFAULT_LIST_FIELD,
            removeNull=True,
        )
        demisto.debug("checkpoint-service-list command completed successfully")
        return CommandResults(
            outputs_prefix=SERVICE_TYPE_CONTEXT_MAP[service_type],
            outputs_key_field="uid",
            readable_output=readable_output,
            outputs=result,
            raw_response=result,
        )

    limit = arg_to_number(limit) or 50
    offset = arg_to_number(offset) or 0

    result = client.list_services(limit, offset, service_type)

    printable_results: list = []
    readable_output = ""

    if result:
        if result.get("total") == 0:
            readable_output = f"No {service_type} service objects were found."
        else:
            objects = result.get("objects", [])
            for element in objects:
                current_printable_result = {}
                for endpoint in DEFAULT_LIST_FIELD:
                    current_printable_result[endpoint] = element.get(endpoint)
                printable_results.append(current_printable_result)

            readable_output = tableToMarkdown(
                f"CheckPoint data for all {service_type} services:", printable_results, DEFAULT_LIST_FIELD, removeNull=True
            )

    demisto.debug("checkpoint-service-list command completed successfully")
    return CommandResults(
        outputs_prefix=SERVICE_TYPE_CONTEXT_MAP[service_type],
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result.get("objects", []) if result else [],
        raw_response=result,
    )


def checkpoint_tcp_service_add_command(
    client: Client,
    identifier: str,
    port: str = None,
    comments: str = None,
    color: str = None,
    session_timeout: str = None,
    aggressive_aging: str = None,
    tags=None,
) -> CommandResults:
    """
    Create a new TCP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object name. Must be unique in the domain.
        port (str): The number of the port used to provide this service.
        comments (str): Comments string.
        color (str): Color of the object.
        session_timeout (str): Time (in seconds) before the session times out.
        aggressive_aging (str): JSON object for aggressive aging settings.
            Example: {"enable": true, "timeout": 360, "use-default-timeout": false}.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-tcp-service-add command called with args: {demisto.args()}")
    tags = argToList(tags)
    aggressive_aging_obj = json.loads(aggressive_aging) if aggressive_aging else None

    result = client.add_service_tcp(
        identifier=identifier,
        port=port,
        comments=comments,
        color=color,
        session_timeout=arg_to_number(session_timeout),
        aggressive_aging=aggressive_aging_obj,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "read-only",
        "groups",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding a TCP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-tcp-service-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.TCPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_udp_service_add_command(
    client: Client,
    identifier: str,
    port: str = None,
    comments: str = None,
    color: str = None,
    session_timeout: str = None,
    aggressive_aging: str = None,
    tags=None,
) -> CommandResults:
    """
    Create a new UDP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object name. Must be unique in the domain.
        port (str): The number of the port used to provide this service.
        comments (str): Comments string.
        color (str): Color of the object.
        session_timeout (str): Time (in seconds) before the session times out.
        aggressive_aging (str): JSON object for aggressive aging settings.
            Example: {"enable": true, "timeout": 360, "use-default-timeout": false}.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-udp-service-add command called with args: {demisto.args()}")
    tags = argToList(tags)
    aggressive_aging_obj = json.loads(aggressive_aging) if aggressive_aging else None

    result = client.add_service_udp(
        identifier=identifier,
        port=port,
        comments=comments,
        color=color,
        session_timeout=arg_to_number(session_timeout),
        aggressive_aging=aggressive_aging_obj,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "read-only",
        "groups",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding a UDP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-udp-service-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.UDPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_icmp_service_add_command(
    client: Client,
    identifier: str,
    icmp_type: str = None,
    icmp_code: str = None,
    comments: str = None,
    color: str = None,
    tags=None,
) -> CommandResults:
    """
    Create a new ICMP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object name. Must be unique in the domain.
        icmp_type (str): ICMP type as listed in RFC 792.
        icmp_code (str): ICMP code as listed in RFC 792.
        comments (str): Comments string.
        color (str): Color of the object.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-icmp-service-add command called with args: {demisto.args()}")
    tags = argToList(tags)

    result = client.add_service_icmp(
        identifier=identifier,
        icmp_type=arg_to_number(icmp_type),
        icmp_code=arg_to_number(icmp_code),
        comments=comments,
        color=color,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "last-modifier",
        "read-only",
        "groups",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding an ICMP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-icmp-service-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ICMPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_tcp_service_update_command(
    client: Client,
    identifier: str,
    new_identifier: str = None,
    port: str = None,
    comments: str = None,
    color: str = None,
    session_timeout: str = None,
    aggressive_aging: str = None,
    tags=None,
) -> CommandResults:
    """
    Update an existing TCP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        new_identifier (str): New name of the object.
        port (str): The number of the port used to provide this service.
        comments (str): Comments string.
        color (str): Color of the object.
        session_timeout (str): Time (in seconds) before the session times out.
        aggressive_aging (str): JSON object for aggressive aging settings.
            Example: {"enable": true, "timeout": 360, "use-default-timeout": false}.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-tcp-service-update command called with args: {demisto.args()}")
    tags = argToList(tags)
    aggressive_aging_obj = json.loads(aggressive_aging) if aggressive_aging else None

    result = client.update_service_tcp(
        identifier=identifier,
        new_identifier=new_identifier,
        port=port,
        comments=comments,
        color=color,
        session_timeout=arg_to_number(session_timeout),
        aggressive_aging=aggressive_aging_obj,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "last-modifier",
        "read-only",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating a TCP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-tcp-service-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.TCPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_udp_service_update_command(
    client: Client,
    identifier: str,
    new_identifier: str = None,
    port: str = None,
    comments: str = None,
    color: str = None,
    session_timeout: str = None,
    aggressive_aging: str = None,
    tags=None,
) -> CommandResults:
    """
    Update an existing UDP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        new_identifier (str): New name of the object.
        port (str): The number of the port used to provide this service.
        comments (str): Comments string.
        color (str): Color of the object.
        session_timeout (str): Time (in seconds) before the session times out.
        aggressive_aging (str): JSON object for aggressive aging settings.
            Example: {"enable": true, "timeout": 360, "use-default-timeout": false}.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-udp-service-update command called with args: {demisto.args()}")
    tags = argToList(tags)
    aggressive_aging_obj = json.loads(aggressive_aging) if aggressive_aging else None

    result = client.update_service_udp(
        identifier=identifier,
        new_identifier=new_identifier,
        port=port,
        comments=comments,
        color=color,
        session_timeout=arg_to_number(session_timeout),
        aggressive_aging=aggressive_aging_obj,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "last-modifier",
        "read-only",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating a UDP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-udp-service-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.UDPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_icmp_service_update_command(
    client: Client,
    identifier: str,
    new_identifier: str = None,
    icmp_type: str = None,
    icmp_code: str = None,
    comments: str = None,
    color: str = None,
    tags=None,
) -> CommandResults:
    """
    Update an existing ICMP service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        new_identifier (str): New name of the object.
        port (str): The number of the port used to provide this service.
        icmp_type (str): ICMP type as listed in RFC 792.
        icmp_code (str): ICMP code as listed in RFC 792.
        comments (str): Comments string.
        color (str): Color of the object.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-icmp-service-update command called with args: {demisto.args()}")
    tags = argToList(tags)

    result = client.update_service_icmp(
        identifier=identifier,
        new_identifier=new_identifier,
        icmp_type=arg_to_number(icmp_type),
        icmp_code=arg_to_number(icmp_code),
        comments=comments,
        color=color,
        tags=tags or None,
    )

    headers = [
        "name",
        "uid",
        "type",
        "domain-name",
        "domain-type",
        "domain-uid",
        "creator",
        "comments",
        "last-modifier",
        "read-only",
    ]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating an ICMP service:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-icmp-service-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ICMPService",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_delete_command(
    client: Client, identifier: str, service_type: str, ignore_warnings: Union[bool, str] = False
) -> CommandResults:
    """
    Delete a service object.

    Args:
        client (Client): CheckPoint client.
        identifier (str): uid or name.
        service_type (str): The service type (tcp, udp, or icmp).
        ignore_warnings (bool): Whether to ignore warnings when deleting the service object.
    """
    demisto.debug(f"checkpoint-service-delete command called with args: {demisto.args()}")
    ignore_warnings = argToBoolean(ignore_warnings)

    client.delete_service(identifier, service_type, ignore_warnings)

    demisto.debug("checkpoint-service-delete command completed successfully")
    return CommandResults(
        readable_output="Service deleted successfully.",
    )


def checkpoint_nat_rule_get_command(client: Client, identifier: str, package: str) -> CommandResults:
    """
    Show existing NAT rule using object unique identifier or name.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object unique identifier or name.
        package (str): Name of the package.
    """
    demisto.debug(f"checkpoint-nat-rule-get command called with args: {demisto.args()}")
    result = client.show_nat_rule(identifier, package)

    readable_output = tableToMarkdown(f"CheckPoint data for NAT rule {identifier}:", result, removeNull=True)

    demisto.debug("checkpoint-nat-rule-get command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.NatRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_nat_rule_list_command(
    client: Client,
    package: str,
    limit: str = "50",
    offset: str = "0",
    filter: str = None,  # noqa: A002
) -> CommandResults:
    """
    Retrieve all NAT rules from the rulebase.

    Args:
        client (Client): CheckPoint client.
        package (str): Name of the package.
        limit (str): The maximal number of returned results. default is 50.
        offset (str): Number of the results to initially skip. default is 0.
        filter (str): Search expression to filter the rulebase.
    """
    demisto.debug(f"checkpoint-nat-rule-list command called with args: {demisto.args()}")
    limit_int = arg_to_number(limit) or 50
    offset_int = arg_to_number(offset) or 0

    result = client.list_nat_rulebase(package, limit_int, offset_int, filter)

    rules: list = []
    readable_output = ""

    if result:
        if result.get("total") == 0:
            readable_output = "No NAT rules were found."
        else:
            rulebase = result.get("rulebase", [])
            for entry in rulebase:
                if entry.get("type") == "nat-rule":
                    rules.append(entry)
                elif entry.get("rulebase"):
                    for sub_entry in entry.get("rulebase", []):
                        if sub_entry.get("type") == "nat-rule":
                            rules.append(sub_entry)

            readable_output = tableToMarkdown("CheckPoint NAT rules:", rules, removeNull=True)

    demisto.debug("checkpoint-nat-rule-list command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.NatRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=rules,
        raw_response=result,
    )


def checkpoint_nat_rule_add_command(
    client: Client,
    package: str,
    position: str,
    position_rule: str = None,
    name: str = None,
    original_source: str = None,
    original_destination: str = None,
    original_service: str = None,
    translated_source: str = None,
    translated_destination: str = None,
    translated_service: str = None,
    install_on=None,
    comments: str = None,
    enabled: str = None,
    nat_method: str = None,
    tags=None,
) -> CommandResults:
    """
    Add a new NAT rule.

    Args:
        client (Client): CheckPoint client.
        package (str): Name of the package.
        position (str): Position in the rulebase. Can be an integer, "top", "bottom", "above", or "below".
        position_rule (str): The name of the rule or section to position relative to.
            Required when position is "above" or "below".
            Optional when position is "top" or "bottom" (used as a reference section name).
        name (str): Rule name.
        original_source (str): Original source.
        original_destination (str): Original destination.
        original_service (str): Original service.
        translated_source (str): Translated source.
        translated_destination (str): Translated destination.
        translated_service (str): Translated service.
        install_on: Which Gateways to install the policy on.
        comments (str): Comments string.
        enabled (str): Enable/Disable the rule.
        nat_method (str): NAT translation method.
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-nat-rule-add command called with args: {demisto.args()}")

    """
    According to API docs:
    - "above"/"below" require position_rule (reference rule/section name)
    - "top"/"bottom" can optionally use position_rule (reference section name)
    - integer position is sent as-is (no position_rule needed)
    """
    if position in ("above", "below") and not position_rule:
        raise DemistoException(
            f"The 'position_rule' argument is required when position is '{position}'. "
            f"Provide the name of the rule or section to position relative to."
        )
    if position_rule:
        position_obj: str | int | dict = {position: position_rule}
    elif position.isdigit():
        position_obj = int(position)
    else:
        position_obj = position

    install_on = argToList(install_on)
    tags = argToList(tags)

    result = client.add_nat_rule(
        package=package,
        position=position_obj,
        name=name,
        original_source=original_source,
        original_destination=original_destination,
        original_service=original_service,
        translated_source=translated_source,
        translated_destination=translated_destination,
        translated_service=translated_service,
        install_on=install_on or None,
        comments=comments,
        enabled=argToBoolean(enabled) if enabled else None,
        method=nat_method,
        tags=tags or None,
    )

    readable_output = tableToMarkdown("CheckPoint data for adding a NAT rule:", result, removeNull=True)

    demisto.debug("checkpoint-nat-rule-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.NatRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_nat_rule_update_command(
    client: Client,
    identifier: str,
    package: str,
    original_source: str = None,
    original_destination: str = None,
    translated_source: str = None,
    translated_destination: str = None,
    original_service: str = None,
    translated_service: str = None,
    comments: str = None,
    enabled: str = None,
    nat_method: str = None,
    new_position: str = None,
    new_position_rule: str = None,
    tags=None,
) -> CommandResults:
    """
    Update an existing NAT rule.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object unique identifier or name.
        package (str): Name of the package.
        original_source (str): Original source.
        original_destination (str): Original destination.
        translated_source (str): Translated source.
        translated_destination (str): Translated destination.
        original_service (str): Original service.
        translated_service (str): Translated service.
        comments (str): Comments string.
        enabled (str): Enable/Disable the rule.
        nat_method (str): NAT translation method.
        new_position (str): New position in the rulebase. Can be an integer, "top", "bottom", "above", or "below".
        new_position_rule (str): The name of the rule or section to position relative to.
            Required when new_position is "above" or "below".
            Optional when new_position is "top" or "bottom" (used as a reference section name).
        tags: Collection of tag identifiers.
    """
    demisto.debug(f"checkpoint-nat-rule-update command called with args: {demisto.args()}")

    # Build new_position object
    new_position_obj: str | int | dict | None = None
    if new_position is not None:
        if new_position in ("above", "below") and not new_position_rule:
            raise DemistoException(
                f"The 'new_position_rule' argument is required when new_position is '{new_position}'. "
                f"Provide the name of the rule or section to position relative to."
            )
        if new_position_rule:
            new_position_obj = {new_position: new_position_rule}
        elif new_position.isdigit():
            new_position_obj = int(new_position)
        else:
            new_position_obj = new_position

    tags = argToList(tags)

    result = client.update_nat_rule(
        identifier=identifier,
        package=package,
        original_source=original_source,
        original_destination=original_destination,
        translated_source=translated_source,
        translated_destination=translated_destination,
        original_service=original_service,
        translated_service=translated_service,
        comments=comments,
        enabled=argToBoolean(enabled) if enabled else None,
        method=nat_method,
        tags=tags or None,
        new_position=new_position_obj,
    )

    readable_output = tableToMarkdown("CheckPoint data for updating a NAT rule:", result, removeNull=True)

    demisto.debug("checkpoint-nat-rule-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.NatRule",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_nat_rule_delete_command(client: Client, identifier: str, package: str) -> CommandResults:
    """
    Delete a NAT rule.

    Args:
        client (Client): CheckPoint client.
        identifier (str): Object unique identifier or name.
        package (str): Name of the package.
    """
    demisto.debug(f"checkpoint-nat-rule-delete command called with args: {demisto.args()}")
    client.delete_nat_rule(
        identifier=identifier,
        package=package,
    )

    demisto.debug("checkpoint-nat-rule-delete command completed successfully")
    return CommandResults(
        readable_output="Nat Rule deleted successfully.",
    )


def build_member_data(result: dict, readable_output: str, printable_result: dict):
    """helper function. Builds the member data for group endpoints."""
    members = result.get("members")
    members_printable_result = []

    if members:
        for member in members:
            current_object_data = {
                "member-name": member.get("name"),
                "member-uid": member.get("uid"),
                "member-type": member.get("type"),
            }
            if member.get("ipv4-address"):
                current_object_data["member-ipv4-address"] = member.get("ipv4-address")
            if member.get("ipv6-address"):
                current_object_data["member-ipv6-address"] = member.get("ipv6-address")

            member_domain = member.get("domain")
            if member_domain:
                current_object_data.update(
                    {
                        "member-domain-name": member_domain.get("name"),
                        "member-domain-uid": member_domain.get("uid"),
                        "member-domain-type": member_domain.get("type"),
                    }
                )

            members_printable_result.append(current_object_data)
        printable_result["members"] = members_printable_result
        member_readable_output = tableToMarkdown(
            "CheckPoint member data:",
            members_printable_result,
            [
                "member-name",
                "member-uid",
                "member-type",
                "member-ipv4-address",
                "member-ipv6-address",
                "member-domain-name",
                "member-domain-uid",
            ],
            removeNull=True,
        )
        readable_output = readable_output + member_readable_output
    return readable_output, printable_result


def build_nat_settings(
    nat_auto_rule: str | None = None,
    nat_method: str | None = None,
    nat_ip: str | None = None,
    nat_install_on: str | None = None,
    nat_hide_behind: str | None = None,
    require_auto_rule: bool = True,
) -> dict | None:
    """Build the nat-settings dict for the Check Point API from individual arguments.

    Returns None if no NAT arguments are provided.

    Args:
        require_auto_rule: When True, raises ValueError if nat_auto_rule is missing
            when other nat_* arguments are provided. Set to False for commands that
            do not expose nat_auto_rule (e.g. checkpoint-address-range-update).

    Raises:
        ValueError: If nat_auto_rule is missing when other nat_* arguments are provided
            and require_auto_rule is True.
        ValueError: If nat_hide_behind is provided when nat_method is 'static'.
        ValueError: If nat_ip is missing when nat_method is 'hide' and nat_hide_behind is 'ip_address'.
        ValueError: If nat_ip is provided when nat_method is 'hide' and nat_hide_behind is 'gateway'.
    """
    has_any_nat_arg = any([nat_method, nat_ip, nat_install_on, nat_hide_behind])

    # nat_auto_rule is required when any other nat_* argument is provided
    if require_auto_rule and has_any_nat_arg and nat_auto_rule is None:
        raise ValueError(
            "The 'nat_auto_rule' argument is required when any NAT argument "
            "(nat_method, nat_ip, nat_install_on, nat_hide_behind) is provided. "
            "Please provide 'nat_auto_rule'."
        )

    # nat_hide_behind is forbidden when nat_method is 'static'
    if nat_method == "static" and nat_hide_behind:
        raise ValueError(
            "The 'nat_hide_behind' argument is forbidden when 'nat_method' is 'static'. "
            "Please remove 'nat_hide_behind' or change 'nat_method'."
        )

    # When nat_method is 'hide' and nat_hide_behind is 'gateway', nat_ip must not be provided
    if nat_method == "hide" and nat_hide_behind == "gateway" and nat_ip:
        raise ValueError(
            "The 'nat_ip' argument must not be provided when 'nat_method' is 'hide' and "
            "'nat_hide_behind' is 'gateway'. Please remove 'nat_ip' or change 'nat_hide_behind'."
            " This prevents ambiguity and matches SmartConsole behavior"
        )

    # When nat_method is 'hide' and nat_hide_behind is 'ip_address', nat_ip is required
    if nat_method == "hide" and nat_hide_behind == "ip_address" and not nat_ip:
        raise ValueError(
            "The 'nat_ip' argument is required when 'nat_method' is 'hide' and "
            "'nat_hide_behind' is 'ip_address'. Please provide 'nat_ip'."
            " This prevents ambiguity and matches SmartConsole behavior."
        )

    nat_settings: dict = {}
    if nat_auto_rule is not None:
        nat_settings["auto-rule"] = argToBoolean(nat_auto_rule)
    if nat_method:
        nat_settings["method"] = nat_method
    if nat_ip:
        nat_settings["ipv4-address"] = nat_ip
    if nat_install_on:
        nat_settings["install-on"] = nat_install_on
    if nat_hide_behind:
        nat_settings["hide-behind"] = nat_hide_behind
    return nat_settings if nat_settings else None


def build_interfaces_list(
    interfaces_name: str | None = None,
    interfaces_subnet: str | None = None,
    interfaces_mask_length: str | None = None,
) -> list | None:
    """Build the interfaces list for the Check Point API from individual arguments.

    Returns None if no interface arguments are provided.

    Raises:
        ValueError: If any interfaces_* argument is provided but interfaces_name,
            interfaces_subnet, or interfaces_mask_length is missing.
    """
    has_any_interface_arg = any([interfaces_name, interfaces_subnet, interfaces_mask_length])
    if not has_any_interface_arg:
        return None

    missing = []
    if not interfaces_name:
        missing.append("interfaces_name")
    if not interfaces_subnet:
        missing.append("interfaces_subnet")
    if not interfaces_mask_length:
        missing.append("interfaces_mask_length")
    if missing:
        raise ValueError(f"When defining interfaces, all interface arguments are required. " f"Missing: {', '.join(missing)}.")

    interface: dict = {}
    if interfaces_name:
        interface["name"] = interfaces_name
    if interfaces_subnet:
        interface["subnet4"] = interfaces_subnet
    if interfaces_mask_length:
        interface["mask-length4"] = int(interfaces_mask_length)
    return [interface]


def build_printable_result(headers: list, result: dict) -> dict:
    """helper function. Builds the printable results."""

    printable_result = {}
    for endpoint in headers:
        printable_result[endpoint] = result.get(endpoint)

        domain_data = result.get("domain")
        if domain_data:
            printable_result.update(
                {
                    "domain-name": domain_data.get("name"),
                    "domain-uid": domain_data.get("uid"),
                    "domain-type": domain_data.get("type") or domain_data.get("domain-type"),
                }
            )

        profile_overrides_data = result.get("profile-overrides")
        if profile_overrides_data:
            printable_result.update({"profile-overrides": profile_overrides_data})

        nat_data = result.get("nat-settings")
        if nat_data:
            printable_result.update(
                {
                    "nat-auto-rule": nat_data.get("auto-rule"),
                    "nat-method": nat_data.get("method"),
                    "nat-ipv4-address": nat_data.get("ipv4-address"),
                    "nat-install-on": nat_data.get("install-on"),
                    "nat-hide-behind": nat_data.get("hide-behind"),
                }
            )

        interface_data = result.get("interfaces")
        if interface_data:
            printable_result.update({"interfaces": interface_data})

        meta_info = result.get("meta-info")
        if meta_info:
            result.update(
                {
                    "creator": meta_info.get("creator"),
                    "last-modifier": meta_info.get("last-modifier"),
                }
            )

        groups = result.get("groups")
        if groups:
            group_list = []
            for group_object in groups:
                group_list.append(group_object.get("name"))
            printable_result["groups"] = group_list

    return printable_result


def build_group_data(result: dict, readable_output: str, printable_result: dict):
    """helper function. Builds new table of group objects related to an object."""
    groups_printable_result = []
    groups_info = result.get("groups")
    if groups_info:
        for group in groups_info:
            current_object_data = {
                "name": group.get("name"),
                "uid": group.get("uid"),
            }
            groups_printable_result.append(current_object_data)
        printable_result["groups"] = groups_printable_result
        groups_readable_output = tableToMarkdown("Additional group data:", groups_printable_result, removeNull=True)
        readable_output = readable_output + groups_readable_output

    return readable_output, printable_result


def parse_order_argument(order: str) -> list[dict]:
    """Parse a comma-separated order string into the API's expected format.

    Args:
        order: Comma-separated direction:field pairs (e.g., "ASC:name" or "ASC:type,DESC:uid").

    Returns:
        list[dict]: List of order objects (e.g., [{"ASC": "name"}, {"DESC": "uid"}]).

    Raises:
        DemistoException: If the order format is invalid or direction is not ASC/DESC.
    """
    order_list: list[dict] = []
    for pair in argToList(order):
        if ":" not in pair:
            raise DemistoException(
                f"Invalid order format: '{pair}'. Expected 'direction:field' format "
                f"(e.g., 'ASC:name'). Direction must be ASC or DESC."
            )
        direction, field = pair.split(":", 1)
        direction = direction.strip().upper()
        if direction not in ("ASC", "DESC"):
            raise DemistoException(f"Invalid order direction: '{direction}'. Must be 'ASC' or 'DESC'.")
        order_list.append({direction: field.strip()})
    return order_list


def checkpoint_service_group_add_command(
    client: Client,
    name: str,
    members=None,
    color: str = None,
    comments: str = None,
    details_level: str = None,
    groups=None,
    tags=None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
) -> CommandResults:
    """Add a new service group object.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-add command called with args: {demisto.args()}")

    members_list = argToList(members) or None
    groups_list = argToList(groups) or None
    tags_list = argToList(tags) or None
    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    result = client.add_service_group(
        name=name,
        members=members_list,
        color=color,
        comments=comments,
        details_level=details_level,
        groups=groups_list,
        tags=tags_list,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier", "read-only"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding a service group:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_member_data(result, readable_output, printable_result)
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-service-group-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ServiceGroup",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_group_get_command(
    client: Client,
    identifier: str,
    show_as_ranges: str = None,
    details_level: str = None,
) -> CommandResults:
    """Show existing service group object using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-get command called with args: {demisto.args()}")

    show_as_ranges_bool = argToBoolean(show_as_ranges) if show_as_ranges is not None else None

    result = client.get_service_group(
        identifier=identifier,
        show_as_ranges=show_as_ranges_bool,
        details_level=details_level,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier", "read-only"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for service group {identifier}:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_member_data(result, readable_output, printable_result)
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-service-group-get command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ServiceGroup",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_group_list_command(
    client: Client,
    filter: str = None,
    limit: str = None,
    offset: str = None,
    order: str = None,
    show_as_ranges: str = None,
    dereference_group_members: str = None,
    show_membership: str = None,
    details_level: str = None,
    domains_to_process: str = None,
) -> CommandResults:
    """Retrieve all service group objects.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-list command called with args: {demisto.args()}")

    limit_int = arg_to_number(limit)
    offset_int = arg_to_number(offset)
    show_as_ranges_bool = argToBoolean(show_as_ranges) if show_as_ranges is not None else None
    dereference_group_members_bool = argToBoolean(dereference_group_members) if dereference_group_members is not None else None
    show_membership_bool = argToBoolean(show_membership) if show_membership is not None else None
    domains_to_process_list = argToList(domains_to_process) or None

    # domains_to_process cannot be used with details-level full
    if domains_to_process_list is not None and details_level == "full":
        raise DemistoException("The 'domains_to_process' argument cannot be used with details_level set to 'full'.")
    order_list = parse_order_argument(order) if order else None

    result = client.list_service_groups(
        filter_search=filter,
        limit=limit_int,
        offset=offset_int,
        order=order_list,
        show_as_ranges=show_as_ranges_bool,
        dereference_group_members=dereference_group_members_bool,
        show_membership=show_membership_bool,
        details_level=details_level,
        domains_to_process=domains_to_process_list,
    )

    printable_result = []
    readable_output = ""

    objects = result.get("objects")
    headers = ["name", "uid", "type"]
    if objects:
        for element in objects:
            current_printable_result = {}
            for endpoint in headers:
                current_printable_result[endpoint] = element.get(endpoint)
            printable_result.append(current_printable_result)

        readable_output = tableToMarkdown("CheckPoint data for all service groups:", printable_result, headers, removeNull=True)
    else:
        readable_output = "No service group objects were found."

    demisto.debug("checkpoint-service-group-list command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ServiceGroup",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=objects,
        raw_response=result,
    )


def checkpoint_service_group_update_command(
    client: Client,
    identifier: str,
    members_action: str = None,
    members=None,
    new_name: str = None,
    color: str = None,
    comments: str = None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
    details_level: str = None,
    groups_action: str = None,
    groups=None,
    tags_action: str = None,
    tags=None,
) -> CommandResults:
    """Edit existing service group using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-update command called with args: {demisto.args()}")

    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    members_raw = argToList(members) or None
    members_parsed = {members_action: members_raw} if members_raw and members_action else members_raw

    groups_raw = argToList(groups) or None
    groups_parsed = {groups_action: groups_raw} if groups_raw and groups_action else groups_raw

    tags_raw = argToList(tags) or None
    tags_parsed = {tags_action: tags_raw} if tags_raw and tags_action else tags_raw

    result = client.update_service_group(
        identifier=identifier,
        members=members_parsed,
        new_name=new_name,
        color=color,
        comments=comments,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
        details_level=details_level,
        groups=groups_parsed,
        tags=tags_parsed,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier", "read-only"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating a service group:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_member_data(result, readable_output, printable_result)
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-service-group-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ServiceGroup",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_group_clone_command(
    client: Client,
    identifier: str,
    members_action: str = None,
    members=None,
    new_name: str = None,
    color: str = None,
    comments: str = None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
    details_level: str = None,
    groups_action: str = None,
    groups=None,
    tags_action: str = None,
    tags=None,
) -> CommandResults:
    """Clone existing service group object.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-clone command called with args: {demisto.args()}")

    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    members_raw = argToList(members) or None
    members_parsed = {members_action: members_raw} if members_raw and members_action else members_raw

    groups_raw = argToList(groups) or None
    groups_parsed = {groups_action: groups_raw} if groups_raw and groups_action else groups_raw

    tags_raw = argToList(tags) or None
    tags_parsed = {tags_action: tags_raw} if tags_raw and tags_action else tags_raw

    result = client.clone_service_group(
        identifier=identifier,
        members=members_parsed,
        new_name=new_name,
        color=color,
        comments=comments,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
        details_level=details_level,
        groups=groups_parsed,
        tags=tags_parsed,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier", "read-only"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for cloning a service group:", printable_result, headers=headers, removeNull=True
    )
    readable_output, printable_result = build_member_data(result, readable_output, printable_result)
    readable_output, printable_result = build_group_data(result, readable_output, printable_result)

    demisto.debug("checkpoint-service-group-clone command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.ServiceGroup",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_service_group_delete_command(
    client: Client,
    identifier: str,
    details_level: str = None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
) -> CommandResults:
    """Delete service group object using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-service-group-delete command called with args: {demisto.args()}")

    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    result = client.delete_service_group(
        identifier=identifier,
        details_level=details_level,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
    )

    demisto.debug("checkpoint-service-group-delete command completed successfully")
    return CommandResults(readable_output="Service group deleted successfully", raw_response=result)


def checkpoint_access_section_add_command(
    client: Client,
    layer: str,
    position: str,
    position_rule: str = None,
    details_level: str = None,
    name: str = None,
    tags=None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
) -> CommandResults:
    """Add a new access section.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-access-section-add command called with args: {demisto.args()}")

    """
    According to API docs:
    - "above"/"below" require position_rule (reference rule/section name)
    - "top"/"bottom" can optionally use position_rule (reference section name)
    - integer position is sent as-is (no position_rule needed)
    """
    if position in ("above", "below") and not position_rule:
        raise DemistoException(
            f"The 'position_rule' argument is required when position is '{position}'. "
            f"Provide the name of the rule or section to position relative to."
        )
    if position_rule:
        position_obj: str | int | dict = {position: position_rule}
    elif position.isdigit():
        position_obj = int(position)
    else:
        position_obj = position
    tags_list = argToList(tags) or None
    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    result = client.add_access_section(
        layer=layer,
        position=position_obj,
        details_level=details_level,
        name=name,
        tags=tags_list,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for adding an access section:", printable_result, headers=headers, removeNull=True
    )

    demisto.debug("checkpoint-access-section-add command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.AccessSection",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_access_section_get_command(
    client: Client,
    layer: str,
    identifier: str,
    details_level: str = None,
) -> CommandResults:
    """Show existing access section using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-access-section-get command called with args: {demisto.args()}")

    result = client.get_access_section(
        layer=layer,
        identifier=identifier,
        details_level=details_level,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        f"CheckPoint data for access section {identifier}:", printable_result, headers=headers, removeNull=True
    )

    demisto.debug("checkpoint-access-section-get command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.AccessSection",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_access_section_update_command(
    client: Client,
    identifier: str,
    layer: str,
    new_name: str = None,
    details_level: str = None,
    tags_action: str = None,
    tags=None,
    ignore_warnings: str = None,
    ignore_errors: str = None,
) -> CommandResults:
    """Edit existing access section using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-access-section-update command called with args: {demisto.args()}")

    tags_raw = argToList(tags) or None
    tags_parsed = {tags_action: tags_raw} if tags_raw and tags_action else tags_raw

    ignore_warnings_bool = argToBoolean(ignore_warnings) if ignore_warnings is not None else None
    ignore_errors_bool = argToBoolean(ignore_errors) if ignore_errors is not None else None

    result = client.update_access_section(
        identifier=identifier,
        layer=layer,
        new_name=new_name,
        details_level=details_level,
        tags=tags_parsed,
        ignore_warnings=ignore_warnings_bool,
        ignore_errors=ignore_errors_bool,
    )

    headers = ["name", "uid", "type", "domain-name", "domain-uid", "domain-type", "creator", "last-modifier"]
    printable_result = build_printable_result(headers, result)
    readable_output = tableToMarkdown(
        "CheckPoint data for updating an access section:", printable_result, headers=headers, removeNull=True
    )

    demisto.debug("checkpoint-access-section-update command completed successfully")
    return CommandResults(
        outputs_prefix="CheckPoint.AccessSection",
        outputs_key_field="uid",
        readable_output=readable_output,
        outputs=result,
        raw_response=result,
    )


def checkpoint_access_section_delete_command(
    client: Client,
    identifier: str,
    layer: str,
    details_level: str = None,
) -> CommandResults:
    """Delete access section using object name or uid.

    Args:
        client (Client): CheckPoint client.

    Returns:
        CommandResults: The command results.
    """
    demisto.debug(f"checkpoint-access-section-delete command called with args: {demisto.args()}")

    result = client.delete_access_section(
        identifier=identifier,
        layer=layer,
        details_level=details_level,
    )

    demisto.debug("checkpoint-access-section-delete command completed successfully")
    return CommandResults(readable_output="Access section deleted successfully.", raw_response=result)


def checkpoint_logout_command(client: Client, sid: str = None) -> str:
    """logout from given session"""
    if sid is not None:
        client.sid = sid

    return client.logout()


def main():  # pragma: no cover
    """
    Client is created with a session id. if a session id was given as argument
    use it, else use the session id from the integration context.
    """
    params = demisto.params()
    args = demisto.args()

    username = demisto.get(params, "username.identifier")
    password = demisto.get(params, "username.password")
    domain_arg = params.get("domain", "")
    sid_arg = args.pop("session_id", None)

    login_args = {
        "username": username,
        "password": password,
        "session_timeout": args.get("session_timeout", 600),
        "domain_arg": domain_arg,
    }

    server = params.get("server")
    port = params.get("port")
    proxy = params.get("proxy", False)
    verify_certificate = not params.get("insecure", False)

    if server.startswith("https://"):
        server = server[len("https://") :]

    if server.endswith("/"):
        server = server[:-1]

    client = Client(base_url=f"https://{server}:{port}/web_api/", use_ssl=verify_certificate, use_proxy=proxy, sid=sid_arg)

    try:
        # commands that perform login
        command = demisto.command()
        if demisto.command() == "test-module":
            client.login(**login_args)
            return_results(client.test_connection())
            client.logout()
            return

        elif command == "checkpoint-login-and-get-session-id":
            return_results(client.login(**login_args))
            # note that the "if client.has_logged in: client.logout()" mechanism is NOT used here, to allow sid reuse
            return

        elif command == "checkpoint-logout":
            return_results(checkpoint_logout_command(client, sid_arg))
            return

        else:
            if not client.sid:  # client.sid is None if `sid_arg in {None, "None"}`
                client.restore_sid_from_context_or_login(**login_args)

        demisto.info(f"Command being called is {demisto.command()}")

        if command == "checkpoint-host-list":
            return_results(checkpoint_list_hosts_command(client, **args))

        elif command == "checkpoint-host-get":
            return_results(checkpoint_get_host_command(client, **args))

        elif command == "checkpoint-host-add":
            return_results(checkpoint_add_host_command(client, **args))

        elif command == "checkpoint-host-update":
            return_results(checkpoint_update_host_command(client, **args))

        elif command == "checkpoint-host-delete":
            return_results(checkpoint_delete_host_command(client, **args))

        elif command == "checkpoint-group-list":
            return_results(checkpoint_list_groups_command(client, **args))

        elif command == "checkpoint-group-get":
            return_results(checkpoint_get_group_command(client, **args))

        elif command == "checkpoint-group-add":
            return_results(checkpoint_add_group_command(client, **args))

        elif command == "checkpoint-group-update":
            return_results(checkpoint_update_group_command(client, **args))

        elif command == "checkpoint-group-delete":
            return_results(checkpoint_delete_group_command(client, **args))

        elif command == "checkpoint-address-range-list":
            return_results(checkpoint_list_address_range_command(client, **args))

        elif command == "checkpoint-address-range-get":
            return_results(checkpoint_get_address_range_command(client, **args))

        elif command == "checkpoint-address-range-add":
            return_results(checkpoint_add_address_range_command(client, **args))

        elif command == "checkpoint-address-range-update":
            return_results(checkpoint_update_address_range_command(client, **args))

        elif command == "checkpoint-address-range-delete":
            return_results(checkpoint_delete_address_range_command(client, **args))

        elif command == "checkpoint-threat-indicator-list":
            return_results(checkpoint_list_threat_indicator_command(client, **args))

        elif command == "checkpoint-threat-indicator-get":
            return_results(checkpoint_get_threat_indicator_command(client, **args))

        elif command == "checkpoint-threat-indicator-add":
            return_results(checkpoint_add_threat_indicator_command(client, **args))

        elif command == "checkpoint-threat-indicator-update":
            return_results(checkpoint_update_threat_indicator_command(client, **args))

        elif command == "checkpoint-threat-indicator-delete":
            return_results(checkpoint_delete_threat_indicator_command(client, **args))

        elif command == "checkpoint-access-rule-list":
            return_results(checkpoint_list_access_rule_command(client, **args))

        elif command == "checkpoint-access-rule-add":
            return_results(checkpoint_add_access_rule_command(client, **args))

        elif command == "checkpoint-access-rule-update":
            return_results(checkpoint_update_access_rule_command(client, **args))

        elif command == "checkpoint-access-rule-delete":
            return_results(checkpoint_delete_access_rule_command(client, **args))

        elif command == "checkpoint-application-site-list":
            return_results(checkpoint_list_application_site_command(client, **args))

        elif command == "checkpoint-application-site-add":
            return_results(checkpoint_add_application_site_command(client, **args))

        elif command == "checkpoint-application-site-update":
            return_results(checkpoint_update_application_site_command(client, **args))

        elif command == "checkpoint-application-site-delete":
            return_results(checkpoint_delete_application_site_command(client, **args))

        elif command == "checkpoint-application-site-category-list":
            return_results(checkpoint_list_application_site_categories_command(client, **args))

        elif command == "checkpoint-application-site-category-get":
            return_results(checkpoint_get_application_site_category_command(client, **args))

        elif command == "checkpoint-application-site-category-add":
            return_results(checkpoint_add_application_site_category_command(client, **args))

        elif command == "checkpoint-packages-list":
            return_results(checkpoint_list_packages_command(client, **args))

        elif command == "checkpoint-gateways-list":
            return_results(checkpoint_list_gateways_command(client, **args))

        elif command == "checkpoint-show-objects":
            return_results(checkpoint_list_objects_command(client, **args))

        elif command == "checkpoint-show-task":
            return_results(checkpoint_show_task_command(client, **args))

        elif command == "checkpoint-publish":
            return_results(checkpoint_publish_command(client))

        elif command == "checkpoint-install-policy":
            return_results(checkpoint_install_policy_command(client, **args))

        elif command == "checkpoint-verify-policy":
            return_results(checkpoint_verify_policy_command(client, **args))

        elif command == "checkpoint-package-list":
            return_results(checkpoint_list_package_command(client, **args))

        elif command == "checkpoint-add-objects-batch":
            return_results(checkpoint_add_objects_batch_command(client, **args))

        elif command == "checkpoint-delete-objects-batch":
            return_results(checkpoint_delete_objects_batch_command(client, **args))

        elif command == "checkpoint-show-threat-protection":
            return_results(checkpoint_show_threat_protection_command(client, args))

        elif command == "checkpoint-show-threat-protections":
            return_results(checkpoint_show_threat_protections_command(client, args))

        elif command == "checkpoint-add-threat-profile":
            return_results(checkpoint_add_threat_profile_command(client, args))

        elif command == "checkpoint-delete-threat-protections":
            return_results(checkpoint_delete_threat_protections_command(client, args))

        elif command == "checkpoint-set-threat-protection":
            return_results(checkpoint_set_threat_protections_command(client, args))
        elif command == "checkpoint-service-group-add":
            return_results(checkpoint_service_group_add_command(client, **args))

        elif command == "checkpoint-service-group-get":
            return_results(checkpoint_service_group_get_command(client, **args))

        elif command == "checkpoint-service-group-list":
            return_results(checkpoint_service_group_list_command(client, **args))

        elif command == "checkpoint-service-group-update":
            return_results(checkpoint_service_group_update_command(client, **args))

        elif command == "checkpoint-service-group-clone":
            return_results(checkpoint_service_group_clone_command(client, **args))

        elif command == "checkpoint-service-group-delete":
            return_results(checkpoint_service_group_delete_command(client, **args))

        elif command == "checkpoint-access-section-add":
            return_results(checkpoint_access_section_add_command(client, **args))

        elif command == "checkpoint-access-section-get":
            return_results(checkpoint_access_section_get_command(client, **args))

        elif command == "checkpoint-access-section-update":
            return_results(checkpoint_access_section_update_command(client, **args))

        elif command == "checkpoint-access-section-delete":
            return_results(checkpoint_access_section_delete_command(client, **args))

        elif command == "checkpoint-network-get":
            return_results(checkpoint_network_get_command(client, **args))

        elif command == "checkpoint-network-list":
            return_results(checkpoint_network_list_command(client, **args))

        elif command == "checkpoint-network-add":
            return_results(checkpoint_network_add_command(client, **args))

        elif command == "checkpoint-network-update":
            return_results(checkpoint_network_update_command(client, **args))

        elif command == "checkpoint-network-delete":
            return_results(checkpoint_network_delete_command(client, **args))

        elif command == "checkpoint-service-get":
            return_results(checkpoint_service_get_command(client, **args))

        elif command == "checkpoint-service-list":
            return_results(checkpoint_service_list_command(client, **args))

        elif command == "checkpoint-tcp-service-add":
            return_results(checkpoint_tcp_service_add_command(client, **args))

        elif command == "checkpoint-udp-service-add":
            return_results(checkpoint_udp_service_add_command(client, **args))

        elif command == "checkpoint-icmp-service-add":
            return_results(checkpoint_icmp_service_add_command(client, **args))

        elif command == "checkpoint-tcp-service-update":
            return_results(checkpoint_tcp_service_update_command(client, **args))

        elif command == "checkpoint-udp-service-update":
            return_results(checkpoint_udp_service_update_command(client, **args))

        elif command == "checkpoint-icmp-service-update":
            return_results(checkpoint_icmp_service_update_command(client, **args))

        elif command == "checkpoint-service-delete":
            return_results(checkpoint_service_delete_command(client, **args))

        elif command == "checkpoint-nat-rule-get":
            return_results(checkpoint_nat_rule_get_command(client, **args))

        elif command == "checkpoint-nat-rule-list":
            return_results(checkpoint_nat_rule_list_command(client, **args))

        elif command == "checkpoint-nat-rule-add":
            return_results(checkpoint_nat_rule_add_command(client, **args))

        elif command == "checkpoint-nat-rule-update":
            return_results(checkpoint_nat_rule_update_command(client, **args))

        elif command == "checkpoint-nat-rule-delete":
            return_results(checkpoint_nat_rule_delete_command(client, **args))
        else:
            raise NotImplementedError(f"Unknown command {command}.")

        if client.has_performed_login:
            # this part is not reached when login() is explicitly called
            demisto.debug("main: client.has_performed_login==True, logging out.")
            client.logout()

    except DemistoException as e:
        error_text_parts = [f"Failed to execute {demisto.command()} command."]
        e_message = e.args[0]

        if e.res:
            status = e.res.http_status
            if status == 401:
                error_text_parts.extend(
                    (
                        "The current session is unreachable.  All changes done after last publish are saved.",
                        "Please contact IT for more information.",
                    )
                )
                demisto.setIntegrationContext({})

            elif status == 500:
                error_text_parts.append("Server Error: make sure Server URL and Server Port are correctly set")
                demisto.setIntegrationContext({})

        elif "Missing header: [X-chkp-sid]" in e_message or "Authentication to server failed" in e_message:
            error_text_parts.append("Wrong credentials! Please check the username and password you entered and try again.")
            demisto.setIntegrationContext({})

        error_text_parts.append(f"\nError: {e!s}")
        return_error("\n".join(error_text_parts))

    except Exception as e:
        return_error(f"Failed to execute {demisto.command()} command. Error: {e!s}")


if __name__ in ("__main__", "__builtin__", "builtins"):
    main()