HostsResourceApi

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

Method HTTP request Description
addTags PUT /hosts/{hostname}/tags Attach tags to the host.
createHosts POST /hosts .
deleteAllHosts DELETE /hosts Delete all hosts in the system.
deleteHost DELETE /hosts/{hostId} Delete a host from the system.
deleteTags DELETE /hosts/{hostname}/tags Remove the tags associated with the host.
enterMaintenanceMode POST /hosts/{hostId}/commands/enterMaintenanceMode Put the host into maintenance mode.
exitMaintenanceMode POST /hosts/{hostId}/commands/exitMaintenanceMode Take the host out of maintenance mode.
generateHostCerts POST /hosts/{hostId}/commands/generateHostCerts Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.
getHostComponents GET /hosts/{hostId}/components Returns the list of Component details on the requested host.
getMetrics GET /hosts/{hostId}/metrics Fetch metric readings for a host.
hostsEnterMaintenanceMode POST /hosts/enterMaintenanceMode Puts a set of hosts into Maintenance mode.
migrateRoles POST /hosts/{hostId}/commands/migrateRoles Migrate roles to a different host.
readHost GET /hosts/{hostId} Returns a specific Host in the system.
readHostConfig GET /hosts/{hostId}/config Retrieves the configuration of a specific host.
readHosts GET /hosts Returns hosts in the system filtered by optional host configuration parameters, if specified.
readTags GET /hosts/{hostname}/tags Returns the tags associated with this host.
removeHostsFromCluster POST /hosts/removeHostsFromCluster Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster.
resetHostId POST /hosts/{hostId}/commands/resetHostId Forces agent on specified host to switch to reporting a different host id.
updateHost PUT /hosts/{hostId} .
updateHostConfig PUT /hosts/{hostId}/config Updates the host configuration with the given values.

addTags

List<ApiEntityTag> addTags(hostname, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostname = "hostname_example"; // String | Name of the host
List<ApiEntityTag> body = Arrays.asList(new ApiEntityTag()); // List<ApiEntityTag> | List of tags to add to the host
try {
    List<ApiEntityTag> result = apiInstance.addTags(hostname, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#addTags");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostname String 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

createHosts

ApiHostList createHosts(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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
ApiHostList body = new ApiHostList(); // ApiHostList | The list of hosts to create
try {
    ApiHostList result = apiInstance.createHosts(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#createHosts");
    e.printStackTrace();
}

Parameters

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

Return type

ApiHostList

Authorization

basic

HTTP request headers

deleteAllHosts

ApiHostList deleteAllHosts()

Delete all hosts in the system.

Delete all hosts in the system

Example

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
try {
    ApiHostList result = apiInstance.deleteAllHosts();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#deleteAllHosts");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

ApiHostList

Authorization

basic

HTTP request headers

deleteHost

ApiHost deleteHost(hostId)

Delete a host from the system.

Delete a host from the system

Example

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host to remove
try {
    ApiHost result = apiInstance.deleteHost(hostId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#deleteHost");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host to remove

Return type

ApiHost

Authorization

basic

HTTP request headers

deleteTags

List<ApiEntityTag> deleteTags(hostname, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostname = "hostname_example"; // String | Name of the host to remove tags from
List<ApiEntityTag> body = Arrays.asList(new ApiEntityTag()); // List<ApiEntityTag> | List of tags to remove from the host
try {
    List<ApiEntityTag> result = apiInstance.deleteTags(hostname, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#deleteTags");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostname String 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

enterMaintenanceMode

ApiCommand enterMaintenanceMode(hostId)

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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host
try {
    ApiCommand result = apiInstance.enterMaintenanceMode(hostId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#enterMaintenanceMode");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host

Return type

ApiCommand

Authorization

basic

HTTP request headers

exitMaintenanceMode

ApiCommand exitMaintenanceMode(hostId)

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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host
try {
    ApiCommand result = apiInstance.exitMaintenanceMode(hostId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#exitMaintenanceMode");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host

Return type

ApiCommand

Authorization

basic

HTTP request headers

generateHostCerts

ApiCommand generateHostCerts(hostId, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host to generate a certificate for.
ApiGenerateHostCertsArguments body = new ApiGenerateHostCertsArguments(); // ApiGenerateHostCertsArguments | 
try {
    ApiCommand result = apiInstance.generateHostCerts(hostId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#generateHostCerts");
    e.printStackTrace();
}

Parameters

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

Return type

ApiCommand

Authorization

basic

HTTP request headers

getHostComponents

List<ApiComponentInfo> getHostComponents(hostId)

Returns the list of Component details on the requested host.

Returns the list of Component details on the requested host.

Example

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host.
try {
    List<ApiComponentInfo> result = apiInstance.getHostComponents(hostId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#getHostComponents");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host.

Return type

List<ApiComponentInfo>

Authorization

basic

HTTP request headers

getMetrics

ApiMetricList getMetrics(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The host's ID.
String from = "from_example"; // String | Start of the period to query.
List<String> ifs = Arrays.asList("ifs_example"); // List<String> | Network interfaces to query for metrics (default = all).
List<String> metrics = Arrays.asList("metrics_example"); // List<String> | Filter for which metrics to query.
Boolean queryNw = true; // Boolean | Whether to query for network interface metrics.
Boolean queryStorage = true; // Boolean | Whether to query for storage metrics.
List<String> storageIds = Arrays.asList("storageIds_example"); // List<String> | Storage context IDs to query for metrics (default = all).
String to = "now"; // String | End of the period to query.
String view = "summary"; // String | The view of the data to materialize, either \"summary\" or \"full\".
try {
    ApiMetricList result = apiInstance.getMetrics(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#getMetrics");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The host's ID.
from String Start of the period to query. [optional]
ifs List<String> Network interfaces to query for metrics (default = all). [optional]
metrics List<String> Filter for which metrics to query. [optional]
queryNw Boolean Whether to query for network interface metrics. [optional] [default to true]
queryStorage Boolean Whether to query for storage metrics. [optional] [default to true]
storageIds List<String> Storage context IDs to query for metrics (default = all). [optional]
to String End of the period to query. [optional] [default to now]
view String The view of the data to materialize, either "summary" or "full". [optional] [default to summary] [enum: EXPORT, EXPORT_REDACTED, FULL, FULL_WITH_HEALTH_CHECK_EXPLANATION, SUMMARY]

Return type

ApiMetricList

Authorization

basic

HTTP request headers

hostsEnterMaintenanceMode

ApiHostMaintenanceResponseList hostsEnterMaintenanceMode(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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
ApiHostNameList body = new ApiHostNameList(); // ApiHostNameList | The List of Host Names that needs to go into the maintenance mode.
try {
    ApiHostMaintenanceResponseList result = apiInstance.hostsEnterMaintenanceMode(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#hostsEnterMaintenanceMode");
    e.printStackTrace();
}

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

migrateRoles

ApiCommand migrateRoles(hostId, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host on which the roles to migrate currently reside
ApiMigrateRolesArguments body = new ApiMigrateRolesArguments(); // ApiMigrateRolesArguments | Arguments for the command.
try {
    ApiCommand result = apiInstance.migrateRoles(hostId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#migrateRoles");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String 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

readHost

ApiHost readHost(hostId, view)

Returns a specific Host in the system.

Returns a specific Host in the system.

Example

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host to read.
String view = "full"; // String | The view to materialize. Defaults to 'full'.
try {
    ApiHost result = apiInstance.readHost(hostId, view);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#readHost");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host to read.
view String The view to materialize. Defaults to 'full'. [optional] [default to full] [enum: EXPORT, EXPORT_REDACTED, FULL, FULL_WITH_HEALTH_CHECK_EXPLANATION, SUMMARY]

Return type

ApiHost

Authorization

basic

HTTP request headers

readHostConfig

ApiConfigList readHostConfig(hostId, view)

Retrieves the configuration of a specific host.

Retrieves the configuration of a specific host.

Example

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host.
String view = "summary"; // String | The view of the data to materialize, either \"summary\" or \"full\".
try {
    ApiConfigList result = apiInstance.readHostConfig(hostId, view);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#readHostConfig");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host.
view String The view of the data to materialize, either "summary" or "full". [optional] [default to summary] [enum: EXPORT, EXPORT_REDACTED, FULL, FULL_WITH_HEALTH_CHECK_EXPLANATION, SUMMARY]

Return type

ApiConfigList

Authorization

basic

HTTP request headers

readHosts

ApiHostList readHosts(configName, configValue, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String configName = "configName_example"; // String | Optional host config name to filter hosts by. Available from v40.
String configValue = "configValue_example"; // String | host config value associated with config name. Available from v40.
String view = "summary"; // String | The view to materialize
try {
    ApiHostList result = apiInstance.readHosts(configName, configValue, view);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#readHosts");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
configName String Optional host config name to filter hosts by. Available from v40. [optional]
configValue String host config value associated with config name. Available from v40. [optional]
view String The view to materialize [optional] [default to summary] [enum: EXPORT, EXPORT_REDACTED, FULL, FULL_WITH_HEALTH_CHECK_EXPLANATION, SUMMARY]

Return type

ApiHostList

Authorization

basic

HTTP request headers

readTags

List<ApiEntityTag> readTags(hostname, limit, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostname = "hostname_example"; // String | The name of the host
java.math.BigDecimal limit = new java.math.BigDecimal(); // java.math.BigDecimal | Number of tags
java.math.BigDecimal offset = new java.math.BigDecimal(); // java.math.BigDecimal | Index of the first tag to retrieve
try {
    List<ApiEntityTag> result = apiInstance.readTags(hostname, limit, offset);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#readTags");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostname String The name of the host
limit java.math.BigDecimal Number of tags [optional] [default to 10]
offset java.math.BigDecimal Index of the first tag to retrieve [optional] [default to 0]

Return type

List<ApiEntityTag>

Authorization

basic

HTTP request headers

removeHostsFromCluster

ApiCommand removeHostsFromCluster(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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
ApiHostsToRemoveArgs body = new ApiHostsToRemoveArgs(); // ApiHostsToRemoveArgs | The list of hosts to remove from cluster or delete from CM
try {
    ApiCommand result = apiInstance.removeHostsFromCluster(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#removeHostsFromCluster");
    e.printStackTrace();
}

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

resetHostId

ApiCommand resetHostId(hostId, newHostId)

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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host that should be affected.
String newHostId = "newHostId_example"; // String | New ID the the host should report.
try {
    ApiCommand result = apiInstance.resetHostId(hostId, newHostId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#resetHostId");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
hostId String The ID of the host that should be affected.
newHostId String New ID the the host should report. [optional]

Return type

ApiCommand

Authorization

basic

HTTP request headers

updateHost

ApiHost updateHost(hostId, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The hostId to update
ApiHost body = new ApiHost(); // ApiHost | The updated host object.
try {
    ApiHost result = apiInstance.updateHost(hostId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#updateHost");
    e.printStackTrace();
}

Parameters

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

Return type

ApiHost

Authorization

basic

HTTP request headers

updateHostConfig

ApiConfigList updateHostConfig(hostId, message, 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

// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.HostsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

HostsResourceApi apiInstance = new HostsResourceApi();
String hostId = "hostId_example"; // String | The ID of the host.
String message = "message_example"; // String | Optional message describing the changes.
ApiConfigList body = new ApiConfigList(); // ApiConfigList | Configuration changes.
try {
    ApiConfigList result = apiInstance.updateHostConfig(hostId, message, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#updateHostConfig");
    e.printStackTrace();
}

Parameters

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

Return type

ApiConfigList

Authorization

basic

HTTP request headers