cm_client.HostsResourceApi

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

Method HTTP request Description
add_tags PUT /hosts/{hostname}/tags Attach tags to the host.
create_hosts POST /hosts .
delete_all_hosts DELETE /hosts Delete all hosts in the system.
delete_host DELETE /hosts/{hostId} Delete a host from the system.
delete_tags DELETE /hosts/{hostname}/tags Remove the tags associated with the host.
enter_maintenance_mode POST /hosts/{hostId}/commands/enterMaintenanceMode Put the host into maintenance mode.
exit_maintenance_mode POST /hosts/{hostId}/commands/exitMaintenanceMode Take the host out of maintenance mode.
generate_host_certs POST /hosts/{hostId}/commands/generateHostCerts Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.
get_host_components GET /hosts/{hostId}/components Returns the list of Component details on the requested host.
get_metrics GET /hosts/{hostId}/metrics Fetch metric readings for a host.
hosts_enter_maintenance_mode POST /hosts/enterMaintenanceMode Puts a set of hosts into Maintenance mode.
migrate_roles POST /hosts/{hostId}/commands/migrateRoles Migrate roles to a different host.
read_host GET /hosts/{hostId} Returns a specific Host in the system.
read_host_config GET /hosts/{hostId}/config Retrieves the configuration of a specific host.
read_hosts GET /hosts Returns hosts in the system filtered by optional host configuration parameters, if specified.
read_tags GET /hosts/{hostname}/tags Returns the tags associated with this host.
remove_hosts_from_cluster POST /hosts/removeHostsFromCluster Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster.
reset_host_id POST /hosts/{hostId}/commands/resetHostId Forces agent on specified host to switch to reporting a different host id.
stop_all_roles_on_node_gracefully POST /hosts/{hostname}/commands/stopAllRolesGracefully .
update_host PUT /hosts/{hostId} .
update_host_config PUT /hosts/{hostId}/config Updates the host configuration with the given values.

add_tags

list[ApiEntityTag] add_tags(hostname, body=body)

Attach tags to the host.

Attach tags to the host. Tag names beginning with the prefix cldr (case insensitive) are reserved for internal use by Cloudera.

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.HostsResourceApi(cm_client.ApiClient(configuration))
hostname = 'hostname_example' # str | Name of the host
body = [cm_client.ApiEntityTag()] # list[ApiEntityTag] | List of tags to add to the host (optional)

try:
    # Attach tags to the host.
    api_response = api_instance.add_tags(hostname, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->add_tags: %s\n" % e)

Parameters

Name Type Description Notes
hostname str Name of the host
body list[ApiEntityTag] List of tags to add to the host [optional]

Return type

list[ApiEntityTag]

Authorization

basic

HTTP request headers

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

create_hosts

ApiHostList create_hosts(body=body)

.

Create one or more hosts.

You must specify at least the hostname and ipAddress in the request objects. If no hostId is specified, it will be set to the hostname. It is an error to try and create host with the same hostId as another host.

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.HostsResourceApi(cm_client.ApiClient(configuration))
body = cm_client.ApiHostList() # ApiHostList | The list of hosts to create (optional)

try:
    # .
    api_response = api_instance.create_hosts(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->create_hosts: %s\n" % e)

Parameters

Name Type Description Notes
body ApiHostList The list of hosts to create [optional]

Return type

ApiHostList

Authorization

basic

HTTP request headers

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

delete_all_hosts

ApiHostList delete_all_hosts()

Delete all hosts in the system.

Delete all hosts in the system

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.HostsResourceApi(cm_client.ApiClient(configuration))

try:
    # Delete all hosts in the system.
    api_response = api_instance.delete_all_hosts()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->delete_all_hosts: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

ApiHostList

Authorization

basic

HTTP request headers

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

delete_host

ApiHost delete_host(host_id)

Delete a host from the system.

Delete a host from the system

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host to remove

try:
    # Delete a host from the system.
    api_response = api_instance.delete_host(host_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->delete_host: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host to remove

Return type

ApiHost

Authorization

basic

HTTP request headers

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

delete_tags

list[ApiEntityTag] delete_tags(hostname, body=body)

Remove the tags associated with the host.

Remove the tags associated with the host. Tag names beginning with the prefix cldr (case insensitive) are reserved for internal use by Cloudera.

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.HostsResourceApi(cm_client.ApiClient(configuration))
hostname = 'hostname_example' # str | Name of the host to remove tags from
body = [cm_client.ApiEntityTag()] # list[ApiEntityTag] | List of tags to remove from the host (optional)

try:
    # Remove the tags associated with the host.
    api_response = api_instance.delete_tags(hostname, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->delete_tags: %s\n" % e)

Parameters

Name Type Description Notes
hostname str Name of the host to remove tags from
body list[ApiEntityTag] List of tags to remove from the host [optional]

Return type

list[ApiEntityTag]

Authorization

basic

HTTP request headers

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

enter_maintenance_mode

ApiCommand enter_maintenance_mode(host_id)

Put the host into maintenance mode.

Put the host into maintenance mode. This is a synchronous command. The result is known immediately upon return.

Available since API v2.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host

try:
    # Put the host into maintenance mode.
    api_response = api_instance.enter_maintenance_mode(host_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->enter_maintenance_mode: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

exit_maintenance_mode

ApiCommand exit_maintenance_mode(host_id)

Take the host out of maintenance mode.

Take the host out of maintenance mode. This is a synchronous command. The result is known immediately upon return.

Available since API v2.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host

try:
    # Take the host out of maintenance mode.
    api_response = api_instance.exit_maintenance_mode(host_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->exit_maintenance_mode: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

generate_host_certs

ApiCommand generate_host_certs(host_id, body=body)

Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.

Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host to generate a certificate for.
body = cm_client.ApiGenerateHostCertsArguments() # ApiGenerateHostCertsArguments |  (optional)

try:
    # Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.
    api_response = api_instance.generate_host_certs(host_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->generate_host_certs: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host to generate a certificate for.
body ApiGenerateHostCertsArguments [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

get_host_components

list[ApiComponentInfo] get_host_components(host_id)

Returns the list of Component details on the requested host.

Returns the list of Component details on the requested host.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host.

try:
    # Returns the list of Component details on the requested host.
    api_response = api_instance.get_host_components(host_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->get_host_components: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host.

Return type

list[ApiComponentInfo]

Authorization

basic

HTTP request headers

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

get_metrics

ApiMetricList get_metrics(host_id, _from=_from, ifs=ifs, metrics=metrics, query_nw=query_nw, query_storage=query_storage, storage_ids=storage_ids, to=to, view=view)

Fetch metric readings for a host.

Fetch metric readings for a host.

By default, this call will look up all metrics available for the host. If only specific metrics are desired, use the metrics parameter.

By default, the returned results correspond to a 5 minute window based on the provided end time (which defaults to the current server time). The from and to parameters can be used to control the window being queried. A maximum window of 3 hours is enforced.

When requesting a "full" view, aside from the extended properties of the returned metric data, the collection will also contain information about all metrics available for the role, even if no readings are available in the requested window.

Host metrics also include per-network interface and per-storage device metrics. Since collecting this data incurs in more overhead, query parameters can be used to choose which network interfaces and storage devices to query, or to these metrics altogether.

Storage metrics are collected at different levels; for example, per-disk and per-partition metrics are available. The "storageIds" parameter can be used to filter specific storage IDs.

In the returned data, the network interfaces and storage IDs can be identified by looking at the "context" property of the metric objects.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The host's ID.
_from = '_from_example' # str | Start of the period to query. (optional)
ifs = ['ifs_example'] # list[str] | Network interfaces to query for metrics (default = all). (optional)
metrics = ['metrics_example'] # list[str] | Filter for which metrics to query. (optional)
query_nw = true # bool | Whether to query for network interface metrics. (optional) (default to true)
query_storage = true # bool | Whether to query for storage metrics. (optional) (default to true)
storage_ids = ['storage_ids_example'] # list[str] | Storage context IDs to query for metrics (default = all). (optional)
to = 'now' # str | End of the period to query. (optional) (default to now)
view = 'summary' # str | The view of the data to materialize, either \"summary\" or \"full\". (optional) (default to summary)

try:
    # Fetch metric readings for a host.
    api_response = api_instance.get_metrics(host_id, _from=_from, ifs=ifs, metrics=metrics, query_nw=query_nw, query_storage=query_storage, storage_ids=storage_ids, to=to, view=view)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->get_metrics: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The host's ID.
_from str Start of the period to query. [optional]
ifs list[str] Network interfaces to query for metrics (default = all). [optional]
metrics list[str] Filter for which metrics to query. [optional]
query_nw bool Whether to query for network interface metrics. [optional] [default to true]
query_storage bool Whether to query for storage metrics. [optional] [default to true]
storage_ids list[str] Storage context IDs to query for metrics (default = all). [optional]
to str End of the period to query. [optional] [default to now]
view str The view of the data to materialize, either "summary" or "full". [optional] [default to summary]

Return type

ApiMetricList

Authorization

basic

HTTP request headers

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

hosts_enter_maintenance_mode

ApiHostMaintenanceResponseList hosts_enter_maintenance_mode(body=body)

Puts a set of hosts into Maintenance mode.

Puts a set of hosts into Maintenance mode

Available since API v49. Since this is a bulk API, the response may contain partial failures. The returned list contains a list of responses indicating the status of the maintenance mode of the hosts.

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.HostsResourceApi(cm_client.ApiClient(configuration))
body = cm_client.ApiHostNameList() # ApiHostNameList | The List of Host Names that needs to go into the maintenance mode. (optional)

try:
    # Puts a set of hosts into Maintenance mode.
    api_response = api_instance.hosts_enter_maintenance_mode(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->hosts_enter_maintenance_mode: %s\n" % e)

Parameters

Name Type Description Notes
body ApiHostNameList The List of Host Names that needs to go into the maintenance mode. [optional]

Return type

ApiHostMaintenanceResponseList

Authorization

basic

HTTP request headers

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

migrate_roles

ApiCommand migrate_roles(host_id, body=body)

Migrate roles to a different host.

Migrate roles to a different host.

This command applies only to HDFS NameNode, JournalNode, and Failover Controller roles. In order to migrate these roles:

Migrating a NameNode or JournalNode role requires cluster downtime. HDFS, along with all of its dependent services, will be stopped at the beginning of the migration process, and restarted at its conclusion.

If the active NameNode is selected for migration, a manual failover will be performed before the role is migrated. The role will remain in standby mode after the migration is complete.

When migrating a NameNode role, the co-located Failover Controller role must be migrated as well if automatic failover is enabled. The Failover Controller role name must be included in the list of role names to migrate specified in the arguments to this command (it will not be included implicitly). This command does not allow a Failover Controller role to be moved by itself, although it is possible to move a JournalNode independently.

Available since API v10.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host on which the roles to migrate currently reside
body = cm_client.ApiMigrateRolesArguments() # ApiMigrateRolesArguments | Arguments for the command. (optional)

try:
    # Migrate roles to a different host.
    api_response = api_instance.migrate_roles(host_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->migrate_roles: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host on which the roles to migrate currently reside
body ApiMigrateRolesArguments Arguments for the command. [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

read_host

ApiHost read_host(host_id, view=view)

Returns a specific Host in the system.

Returns a specific Host in the system.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host to read.
view = 'full' # str | The view to materialize. Defaults to 'full'. (optional) (default to full)

try:
    # Returns a specific Host in the system.
    api_response = api_instance.read_host(host_id, view=view)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->read_host: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host to read.
view str The view to materialize. Defaults to 'full'. [optional] [default to full]

Return type

ApiHost

Authorization

basic

HTTP request headers

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

read_host_config

ApiConfigList read_host_config(host_id, view=view)

Retrieves the configuration of a specific host.

Retrieves the configuration of a specific host.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host.
view = 'summary' # str | The view of the data to materialize, either \"summary\" or \"full\". (optional) (default to summary)

try:
    # Retrieves the configuration of a specific host.
    api_response = api_instance.read_host_config(host_id, view=view)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->read_host_config: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host.
view str The view of the data to materialize, either "summary" or "full". [optional] [default to summary]

Return type

ApiConfigList

Authorization

basic

HTTP request headers

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

read_hosts

ApiHostList read_hosts(config_name=config_name, config_value=config_value, view=view)

Returns hosts in the system filtered by optional host configuration parameters, if specified.

Returns hosts in the system filtered by optional host configuration parameters, if specified.

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.HostsResourceApi(cm_client.ApiClient(configuration))
config_name = 'config_name_example' # str | Optional host config name to filter hosts by. Available from v40. (optional)
config_value = 'config_value_example' # str | host config value associated with config name. Available from v40. (optional)
view = 'summary' # str | The view to materialize (optional) (default to summary)

try:
    # Returns hosts in the system filtered by optional host configuration parameters, if specified.
    api_response = api_instance.read_hosts(config_name=config_name, config_value=config_value, view=view)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->read_hosts: %s\n" % e)

Parameters

Name Type Description Notes
config_name str Optional host config name to filter hosts by. Available from v40. [optional]
config_value str host config value associated with config name. Available from v40. [optional]
view str The view to materialize [optional] [default to summary]

Return type

ApiHostList

Authorization

basic

HTTP request headers

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

read_tags

list[ApiEntityTag] read_tags(hostname, limit=limit, offset=offset)

Returns the tags associated with this host.

Returns the tags associated with this host. Tag names beginning with the prefix cldr (case insensitive) are reserved for internal use by Cloudera.

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.HostsResourceApi(cm_client.ApiClient(configuration))
hostname = 'hostname_example' # str | The name of the host
limit = 10 # int | Number of tags (optional) (default to 10)
offset = 0 # int | Index of the first tag to retrieve (optional) (default to 0)

try:
    # Returns the tags associated with this host.
    api_response = api_instance.read_tags(hostname, limit=limit, offset=offset)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->read_tags: %s\n" % e)

Parameters

Name Type Description Notes
hostname str The name of the host
limit int Number of tags [optional] [default to 10]
offset int Index of the first tag to retrieve [optional] [default to 0]

Return type

list[ApiEntityTag]

Authorization

basic

HTTP request headers

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

remove_hosts_from_cluster

ApiCommand remove_hosts_from_cluster(body=body)

Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster.

Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster. Also additionally delete the hosts if deleteHosts is set to true.

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.HostsResourceApi(cm_client.ApiClient(configuration))
body = cm_client.ApiHostsToRemoveArgs() # ApiHostsToRemoveArgs | The list of hosts to remove from cluster or delete from CM (optional)

try:
    # Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster.
    api_response = api_instance.remove_hosts_from_cluster(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->remove_hosts_from_cluster: %s\n" % e)

Parameters

Name Type Description Notes
body ApiHostsToRemoveArgs The list of hosts to remove from cluster or delete from CM [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

reset_host_id

ApiCommand reset_host_id(host_id, new_host_id=new_host_id)

Forces agent on specified host to switch to reporting a different host id.

Forces agent on specified host to switch to reporting a different host id.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host that should be affected.
new_host_id = 'new_host_id_example' # str | New ID the the host should report. (optional)

try:
    # Forces agent on specified host to switch to reporting a different host id.
    api_response = api_instance.reset_host_id(host_id, new_host_id=new_host_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->reset_host_id: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host that should be affected.
new_host_id str New ID the the host should report. [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

stop_all_roles_on_node_gracefully

ApiCommand stop_all_roles_on_node_gracefully(hostname)

.

Gracefully stops all roles that support it; otherwise, performs a simple stop on the provided host.

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.HostsResourceApi(cm_client.ApiClient(configuration))
hostname = 'hostname_example' # str | The name of the host on which all the roles needs to be stopped.

try:
    # .
    api_response = api_instance.stop_all_roles_on_node_gracefully(hostname)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->stop_all_roles_on_node_gracefully: %s\n" % e)

Parameters

Name Type Description Notes
hostname str The name of the host on which all the roles needs to be stopped.

Return type

ApiCommand

Authorization

basic

HTTP request headers

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

update_host

ApiHost update_host(host_id, body=body)

.

Update an existing host in the system.

Currently, only updating the rackId is supported. All other fields of the host will be ignored.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The hostId to update
body = cm_client.ApiHost() # ApiHost | The updated host object. (optional)

try:
    # .
    api_response = api_instance.update_host(host_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->update_host: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The hostId to update
body ApiHost The updated host object. [optional]

Return type

ApiHost

Authorization

basic

HTTP request headers

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

update_host_config

ApiConfigList update_host_config(host_id, message=message, body=body)

Updates the host configuration with the given values.

Updates the host configuration with the given values.

If a value is set in the given configuration, it will be added to the host's configuration, replacing any existing entries. If a value is unset (its value is null), the existing configuration for the attribute will be erased, if any.

Attributes that are not listed in the input will maintain their current values in the configuration.

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.HostsResourceApi(cm_client.ApiClient(configuration))
host_id = 'host_id_example' # str | The ID of the host.
message = 'message_example' # str | Optional message describing the changes. (optional)
body = cm_client.ApiConfigList() # ApiConfigList | Configuration changes. (optional)

try:
    # Updates the host configuration with the given values.
    api_response = api_instance.update_host_config(host_id, message=message, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling HostsResourceApi->update_host_config: %s\n" % e)

Parameters

Name Type Description Notes
host_id str The ID of the host.
message str Optional message describing the changes. [optional]
body ApiConfigList Configuration changes. [optional]

Return type

ApiConfigList

Authorization

basic

HTTP request headers

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