cm_client.HostTemplatesResourceApi

All URIs are relative to https://localhost/api/v43

Method HTTP request Description
apply_host_template POST /clusters/{clusterName}/hostTemplates/{hostTemplateName}/commands/applyHostTemplate Applies a host template to a collection of hosts.
create_host_templates POST /clusters/{clusterName}/hostTemplates Creates new host templates.
delete_host_template DELETE /clusters/{clusterName}/hostTemplates/{hostTemplateName} Deletes a host template.
read_host_template GET /clusters/{clusterName}/hostTemplates/{hostTemplateName} Retrieves information about a host template.
read_host_templates GET /clusters/{clusterName}/hostTemplates Lists all host templates in a cluster.
update_host_template PUT /clusters/{clusterName}/hostTemplates/{hostTemplateName} Updates an existing host template.

apply_host_template

ApiCommand apply_host_template(cluster_name, host_template_name, start_roles=start_roles, body=body)

Applies a host template to a collection of hosts.

Applies a host template to a collection of hosts. This will create a role for each role config group on each of the hosts.

The provided hosts must not have any existing roles on them and if the cluster is not using parcels, the hosts must have a CDH version matching that of the cluster version.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 
host_template_name = 'host_template_name_example' # str | Host template to apply.
start_roles = true # bool | Whether to start the newly created roles or not. (optional)
body = cm_client.ApiHostRefList() # ApiHostRefList | List of hosts to apply the host template to. (optional)

try:
    # Applies a host template to a collection of hosts.
    api_response = api_instance.apply_host_template(cluster_name, host_template_name, start_roles=start_roles, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->apply_host_template: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str
host_template_name str Host template to apply.
start_roles bool Whether to start the newly created roles or not. [optional]
body ApiHostRefList List of hosts to apply the host template to. [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_host_templates

ApiHostTemplateList create_host_templates(cluster_name, body=body)

Creates new host templates.

Creates new host templates.

Host template names must be unique across clusters.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 
body = cm_client.ApiHostTemplateList() # ApiHostTemplateList | The list of host templates to create. (optional)

try:
    # Creates new host templates.
    api_response = api_instance.create_host_templates(cluster_name, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->create_host_templates: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str
body ApiHostTemplateList The list of host templates to create. [optional]

Return type

ApiHostTemplateList

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_host_template

ApiHostTemplate delete_host_template(cluster_name, host_template_name)

Deletes a host template.

Deletes a host template.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 
host_template_name = 'host_template_name_example' # str | Host template to delete.

try:
    # Deletes a host template.
    api_response = api_instance.delete_host_template(cluster_name, host_template_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->delete_host_template: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str
host_template_name str Host template to delete.

Return type

ApiHostTemplate

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

read_host_template

ApiHostTemplate read_host_template(cluster_name, host_template_name)

Retrieves information about a host template.

Retrieves information about a host template.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 
host_template_name = 'host_template_name_example' # str | 

try:
    # Retrieves information about a host template.
    api_response = api_instance.read_host_template(cluster_name, host_template_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->read_host_template: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str
host_template_name str

Return type

ApiHostTemplate

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

read_host_templates

ApiHostTemplateList read_host_templates(cluster_name)

Lists all host templates in a cluster.

Lists all host templates in a cluster.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 

try:
    # Lists all host templates in a cluster.
    api_response = api_instance.read_host_templates(cluster_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->read_host_templates: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str

Return type

ApiHostTemplateList

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_host_template

ApiHostTemplate update_host_template(cluster_name, host_template_name, body=body)

Updates an existing host template.

Updates an existing host template.

Can be used to update the role config groups in a host template or rename it.

Available since API v3.

Example

from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.HostTemplatesResourceApi(cm_client.ApiClient(configuration))
cluster_name = 'cluster_name_example' # str | 
host_template_name = 'host_template_name_example' # str | Host template with updated fields.
body = cm_client.ApiHostTemplate() # ApiHostTemplate |  (optional)

try:
    # Updates an existing host template.
    api_response = api_instance.update_host_template(cluster_name, host_template_name, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostTemplatesResourceApi->update_host_template: %s\n" % e)

Parameters

Name Type Description Notes
cluster_name str
host_template_name str Host template with updated fields.
body ApiHostTemplate [optional]

Return type

ApiHostTemplate

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]