11#
2- # add_access_rule_with_api_key .py
2+ # add_group_with_api_key .py
33# version 1.0
44#
55#
66# This example demonstrates communication with Check Point Management server using Management API Library in Python.
7- # Login with api-key, and add access rule .
7+ # Login with api-key, and adding a group .
88# The demonstrated commands are:
99#
1010# 1. login with api-key
11- # 2. adding an access rule to the top of Network layer
11+ # 2. adding a group
1212# 3. publishing the changes
1313#
1414# Logout command is called automatically after the work with Management API Library is completed.
@@ -40,7 +40,7 @@ def main():
4040
4141 with APIClient (client_args ) as client :
4242
43- rule_name = input ("Enter the name of the access rule : " )
43+ group_name = input ("Enter the name of the group : " )
4444
4545 #
4646 # The API client, would look for the server's certificate SHA1 fingerprint in a file.
@@ -57,13 +57,13 @@ def main():
5757 print ("Login failed:\n {}" .format (login_res .error_message ))
5858 exit (1 )
5959
60- # add a rule to the top of the "Network" layer
61- add_rule_response = client .api_call ("add-access-rule " ,
62- {"name" : rule_name , "layer" : "Network" , "position" : "top" })
60+ # add the group
61+ add_group_response = client .api_call ("add-group " ,
62+ {"name" : group_name })
6363
64- if add_rule_response .success :
64+ if add_group_response .success :
6565
66- print ("The rule : '{}' has been added successfully" .format (rule_name ))
66+ print ("The group : '{}' has been added successfully" .format (group_name ))
6767
6868 # publish the result
6969 publish_res = client .api_call ("publish" , {})
@@ -72,7 +72,7 @@ def main():
7272 else :
7373 print ("Failed to publish the changes." )
7474 else :
75- print ("Failed to add the access-rule : '{}', Error:\n {}" .format (rule_name , add_rule_response .error_message ))
75+ print ("Failed to add the group : '{}', Error:\n {}" .format (group_name , add_group_response .error_message ))
7676
7777
7878if __name__ == "__main__" :
0 commit comments