# HostsResourceApi

All URIs are relative to */api/v57*

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

<a name="addTags"></a>
# **addTags**
> List&lt;ApiEntityTag&gt; 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
```java
// 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&lt;ApiEntityTag&gt;**](ApiEntityTag.md)| List of tags to add to the host | [optional]

### Return type

[**List&lt;ApiEntityTag&gt;**](ApiEntityTag.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="createHosts"></a>
# **createHosts**
> ApiHostList createHosts(body)

.

<p>Create one or more hosts.</p> <p>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.</p>

### Example
```java
// 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**](ApiHostList.md)| The list of hosts to create | [optional]

### Return type

[**ApiHostList**](ApiHostList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="deleteAllHosts"></a>
# **deleteAllHosts**
> ApiHostList deleteAllHosts()

Delete all hosts in the system.

Delete all hosts in the system

### Example
```java
// 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**](ApiHostList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="deleteHost"></a>
# **deleteHost**
> ApiHost deleteHost(hostId)

Delete a host from the system.

Delete a host from the system

### Example
```java
// 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**](ApiHost.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="deleteTags"></a>
# **deleteTags**
> List&lt;ApiEntityTag&gt; 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
```java
// 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&lt;ApiEntityTag&gt;**](ApiEntityTag.md)| List of tags to remove from the host | [optional]

### Return type

[**List&lt;ApiEntityTag&gt;**](ApiEntityTag.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="enterMaintenanceMode"></a>
# **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.  <p>Available since API v2.</p>

### Example
```java
// 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**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="exitMaintenanceMode"></a>
# **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.  <p> Available since API v2. </p>

### Example
```java
// 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**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="generateHostCerts"></a>
# **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
```java
// 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**](ApiGenerateHostCertsArguments.md)|  | [optional]

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getHostComponents"></a>
# **getHostComponents**
> List&lt;ApiComponentInfo&gt; getHostComponents(hostId)

Returns the list of Component details on the requested host.

Returns the list of Component details on the requested host.

### Example
```java
// 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&lt;ApiComponentInfo&gt;**](ApiComponentInfo.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getMetrics"></a>
# **getMetrics**
> ApiMetricList getMetrics(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view)

Fetch metric readings for a host.

Fetch metric readings for a host. <p> By default, this call will look up all metrics available for the host. If only specific metrics are desired, use the <i>metrics</i> parameter. <p> 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 <i>from</i> and <i>to</i> parameters can be used to control the window being queried. A maximum window of 3 hours is enforced. <p> 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. <p> 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. <p> 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. <p> In the returned data, the network interfaces and storage IDs can be identified by looking at the \"context\" property of the metric objects.

### Example
```java
// 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&lt;String&gt;**](String.md)| Network interfaces to query for metrics (default = all). | [optional]
 **metrics** | [**List&lt;String&gt;**](String.md)| 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&lt;String&gt;**](String.md)| 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, FULL_WITH_NO_HEALTH_CHECK, SUMMARY, SUMMARY_WITH_NO_HEALTH_CHECK]

### Return type

[**ApiMetricList**](ApiMetricList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="hostsEnterMaintenanceMode"></a>
# **hostsEnterMaintenanceMode**
> ApiHostMaintenanceResponseList hostsEnterMaintenanceMode(body)

Puts a set of hosts into Maintenance mode.

Puts a set of hosts into Maintenance mode  <p> 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. </p>

### Example
```java
// 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**](ApiHostNameList.md)| The List of Host Names that needs to go into the maintenance mode. | [optional]

### Return type

[**ApiHostMaintenanceResponseList**](ApiHostMaintenanceResponseList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="migrateRoles"></a>
# **migrateRoles**
> ApiCommand migrateRoles(hostId, body)

Migrate roles to a different host.

Migrate roles to a different host. <p> This command applies only to HDFS NameNode, JournalNode, and Failover Controller roles. In order to migrate these roles: <ul> <li>HDFS High Availability must be enabled, using quorum-based storage.</li> <li>HDFS must not be configured to use a federated nameservice.</li> </ul> <b>Migrating a NameNode or JournalNode role requires cluster downtime</b>. HDFS, along with all of its dependent services, will be stopped at the beginning of the migration process, and restarted at its conclusion. <p>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. <p>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. <p> Available since API v10.

### Example
```java
// 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**](ApiMigrateRolesArguments.md)| Arguments for the command. | [optional]

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="readHost"></a>
# **readHost**
> ApiHost readHost(hostId, view)

Returns a specific Host in the system.

Returns a specific Host in the system.

### Example
```java
// 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, FULL_WITH_NO_HEALTH_CHECK, SUMMARY, SUMMARY_WITH_NO_HEALTH_CHECK]

### Return type

[**ApiHost**](ApiHost.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="readHostConfig"></a>
# **readHostConfig**
> ApiConfigList readHostConfig(hostId, view)

Retrieves the configuration of a specific host.

Retrieves the configuration of a specific host.

### Example
```java
// 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, FULL_WITH_NO_HEALTH_CHECK, SUMMARY, SUMMARY_WITH_NO_HEALTH_CHECK]

### Return type

[**ApiConfigList**](ApiConfigList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="readHosts"></a>
# **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
```java
// 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, FULL_WITH_NO_HEALTH_CHECK, SUMMARY, SUMMARY_WITH_NO_HEALTH_CHECK]

### Return type

[**ApiHostList**](ApiHostList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="readTags"></a>
# **readTags**
> List&lt;ApiEntityTag&gt; 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
```java
// 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&lt;ApiEntityTag&gt;**](ApiEntityTag.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="reallocateMemory"></a>
# **reallocateMemory**
> ApiGenericResponse reallocateMemory(body)

Performs memory reallocation on set of hosts.

Performs memory reallocation on set of hosts

### Example
```java
// 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 | A list of hosts identified by
hostnames to perform reallocation on.
try {
    ApiGenericResponse result = apiInstance.reallocateMemory(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#reallocateMemory");
    e.printStackTrace();
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**ApiHostNameList**](ApiHostNameList.md)| A list of hosts identified by
hostnames to perform reallocation on. | [optional]

### Return type

[**ApiGenericResponse**](ApiGenericResponse.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="removeHostsFromCluster"></a>
# **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
```java
// 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**](ApiHostsToRemoveArgs.md)| The list of hosts to remove from cluster or delete from CM | [optional]

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="resetHostId"></a>
# **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
```java
// 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**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="stopAllRolesOnNodeGracefully"></a>
# **stopAllRolesOnNodeGracefully**
> ApiCommand stopAllRolesOnNodeGracefully(hostname)

.

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

### Example
```java
// 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 on which all the roles needs to be stopped.
try {
    ApiCommand result = apiInstance.stopAllRolesOnNodeGracefully(hostname);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling HostsResourceApi#stopAllRolesOnNodeGracefully");
    e.printStackTrace();
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **hostname** | **String**| The name of the host on which all the roles needs to be stopped. |

### Return type

[**ApiCommand**](ApiCommand.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="updateHost"></a>
# **updateHost**
> ApiHost updateHost(hostId, body)

.

<p>Update an existing host in the system.</p> <p>Currently, only updating the rackId is supported.  All other fields of the host will be ignored.</p>

### Example
```java
// 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**](ApiHost.md)| The updated host object. | [optional]

### Return type

[**ApiHost**](ApiHost.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="updateHostConfig"></a>
# **updateHostConfig**
> ApiConfigList updateHostConfig(hostId, body, message)

Updates the host configuration with the given values.

Updates the host configuration with the given values. <p> 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. <p> Attributes that are not listed in the input will maintain their current values in the configuration.

### Example
```java
// 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.
ApiConfigList body = new ApiConfigList(); // ApiConfigList | Configuration changes.
String message = "message_example"; // String | Optional message describing the changes.
try {
    ApiConfigList result = apiInstance.updateHostConfig(hostId, body, message);
    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. |
 **body** | [**ApiConfigList**](ApiConfigList.md)| Configuration changes. | [optional]
 **message** | **String**| Optional message describing the changes. | [optional]

### Return type

[**ApiConfigList**](ApiConfigList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

