Sample Python Code

You can perform the steps to export and import a cluster template programmatically using a client written in Python or other languages. (You can also use the curl commands provided above.)

Python export example:
resource = ApiResource("myCluster-1.myDomain.com", 7180, "admin", "admin", version=)
cluster = resource.get_cluster("Cluster1");
template = cluster.export(False)
pprint(template)
Python import example:
resource = ApiResource("localhost", 8180, "admin", "admin", version=)
 with open('~/cluster-template.json') as data_file:
   data = json.load(data_file)
template = ApiClusterTemplate(resource).from_json_dict(data, resource)
cms = ClouderaManager(resource)
cms.import_cluster_template(template)