Here is the python code.
from cpapi import APIClient, APIClientArgs
import pprint
pp = pprint.PrettyPrinter(indent=4)
api_server='10.1.18.100'
username='admin'
password='somepw'
domain_name='Test_Domain'
def main():
client_args = APIClientArgs(server=api_server)
with APIClient(client_args) as domain_client:
login_res = domain_client.login(username, password, domain=domain_name)
if login_res.success is False:
print("Try upgrading to R81 maybe?")
exit(81)
json_data = { "name": "TestCluster",
"send-logs-to-server": "TestDomainLogServer" }
print("Calling set cluster api")
simple_cluster_output = domain_client.api_call("set-simple-cluster", json_data)
pp.pprint(simple_cluster_output)
print("Calling publish api")
publish_output = domain_client.api_call("publish",{})
pp.pprint(publish_output)
if __name__ == "__main__":
main()