<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Delete a host object in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/38895#M2368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;P&gt;The purpose of this code it to show delete a host object while taking into consideration questions like: is the object a member of an existing group, is the object participating in a rulebase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Description&lt;/H2&gt;&lt;P&gt;If the host object is not a member of a group and is not used in a rule-base - delete the host object.&lt;/P&gt;&lt;P&gt;If the host is being used in a rulebase - remove the host from the rulebase.&lt;/P&gt;&lt;P&gt;If the host object was the last object-in its cell - disable thr rule.&lt;/P&gt;&lt;P&gt;if the host object was a member of a group - remove it from the group.&lt;/P&gt;&lt;P&gt;If the group is now an empty group - delete the group.&lt;/P&gt;&lt;P&gt;If the deleted group appeared in a rulebase - remove it from the rulebase.&lt;/P&gt;&lt;P&gt;if the deleted group was the last object in the cell - disable the rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Instructions&lt;/H2&gt;&lt;P&gt;run delete_host.py (python 2.7 code).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Code Version&lt;/H2&gt;&lt;P&gt;Code version 1.0.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Tested on version&lt;/H2&gt;&lt;P&gt;R80, API version 1.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 13px; color: #ff0000;"&gt;&lt;STRONG&gt;NOTICE: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.6667px; color: #999999;"&gt;&lt;STRONG&gt;By using this sample code you agree to terms and conditions in this &lt;A href="https://community.checkpoint.com/docs/DOC-1042"&gt;Terms and Conditions&lt;/A&gt;​&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Dec 2015 07:30:01 GMT</pubDate>
    <dc:creator>Uri_Bialik</dc:creator>
    <dc:date>2015-12-17T07:30:01Z</dc:date>
    <item>
      <title>Delete a host object</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/38895#M2368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;P&gt;The purpose of this code it to show delete a host object while taking into consideration questions like: is the object a member of an existing group, is the object participating in a rulebase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Description&lt;/H2&gt;&lt;P&gt;If the host object is not a member of a group and is not used in a rule-base - delete the host object.&lt;/P&gt;&lt;P&gt;If the host is being used in a rulebase - remove the host from the rulebase.&lt;/P&gt;&lt;P&gt;If the host object was the last object-in its cell - disable thr rule.&lt;/P&gt;&lt;P&gt;if the host object was a member of a group - remove it from the group.&lt;/P&gt;&lt;P&gt;If the group is now an empty group - delete the group.&lt;/P&gt;&lt;P&gt;If the deleted group appeared in a rulebase - remove it from the rulebase.&lt;/P&gt;&lt;P&gt;if the deleted group was the last object in the cell - disable the rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Instructions&lt;/H2&gt;&lt;P&gt;run delete_host.py (python 2.7 code).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Code Version&lt;/H2&gt;&lt;P&gt;Code version 1.0.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Tested on version&lt;/H2&gt;&lt;P&gt;R80, API version 1.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 13px; color: #ff0000;"&gt;&lt;STRONG&gt;NOTICE: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.6667px; color: #999999;"&gt;&lt;STRONG&gt;By using this sample code you agree to terms and conditions in this &lt;A href="https://community.checkpoint.com/docs/DOC-1042"&gt;Terms and Conditions&lt;/A&gt;​&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2015 07:30:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/38895#M2368</guid>
      <dc:creator>Uri_Bialik</dc:creator>
      <dc:date>2015-12-17T07:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a host object</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/78190#M4582</link>
      <description>Does this script actually work on R80.20? Specifically on MDS? I sort of got it to work on SC but never on MDS. I can never match the fingerprint. api fingerprint value never matches what the server returns. I eventually gave up and wrote a bash hack to do the same but I'd actually like to use python and the web api instead of mgmt_cli</description>
      <pubDate>Fri, 13 Mar 2020 09:18:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/78190#M4582</guid>
      <dc:creator>fwmeister</dc:creator>
      <dc:date>2020-03-13T09:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a host object</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/176100#M7574</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/38"&gt;@Uri_Bialik&lt;/a&gt;&amp;nbsp;please help how can I get the rulebasecsv?&amp;nbsp; I also tried to write another code to bypass the rulebase library requirement but I am having issues with pulling the UID. I am using Jupyter notebook through Anaconda for development environment. Error code&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;"Error: Key 'uid' is missing in rule dictionary: {'rule': {'uid': '09bf0dea-5d3c-429d-890f-4bf9b5eb99b5', 'name': 'Sterling Access', '&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'access-rule', 'domain': {'uid': '41e821a0-3720-11e3-aa6e-0800200c9fde', 'name': 'SMC User', 'domain-&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'domain'}}, 'rule-columns': ['source'], 'position': '13', 'layer': {'uid': 'e06bc425-1f8b-4487-a64f-661f85084a6d', 'name': 'Pennsylvania Security', '&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'access-layer', 'domain': {'uid': '41e821a0-3720-11e3-aa6e-0800200c9fde', 'name': 'SMC User', 'domain-&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'domain'}}, 'layer-position': 1, 'package': {'uid': '93b650bc-8b28-4587-8641-73f25d7e3c8c', 'name': 'Pennsylvania', '&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'package', 'domain': {'uid': '41e821a0-3720-11e3-aa6e-0800200c9fde', 'name': 'SMC User', 'domain-&lt;SPAN class=""&gt;type&lt;/SPAN&gt;': 'domain'}}}" Error: 'object'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 14:52:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/176100#M7574</guid>
      <dc:creator>scripting_guru</dc:creator>
      <dc:date>2023-03-24T14:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Delete a host object</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/176101#M7575</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/40884"&gt;@fwmeister&lt;/a&gt;&amp;nbsp;can you please share your code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 14:51:24 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Delete-a-host-object/m-p/176101#M7575</guid>
      <dc:creator>scripting_guru</dc:creator>
      <dc:date>2023-03-24T14:51:24Z</dc:date>
    </item>
  </channel>
</rss>

