/*
 * Cloudera Manager API
 * <h1>Cloudera Manager API v57</h1>       <p>Introduced in Cloudera Manager 7.13.1</p>       <p><a href=\"http://www.cloudera.com/documentation.html\">Cloudera Product Documentation</a></p>
 *
 * OpenAPI spec version: 7.13.1
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package com.cloudera.api.swagger;

import com.cloudera.api.swagger.client.ApiCallback;
import com.cloudera.api.swagger.client.ApiClient;
import com.cloudera.api.swagger.client.ApiException;
import com.cloudera.api.swagger.client.ApiResponse;
import com.cloudera.api.swagger.client.Configuration;
import com.cloudera.api.swagger.client.Pair;
import com.cloudera.api.swagger.client.ProgressRequestBody;
import com.cloudera.api.swagger.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.cloudera.api.swagger.model.ApiCommand;
import com.cloudera.api.swagger.model.ApiComponentInfo;
import com.cloudera.api.swagger.model.ApiConfigList;
import com.cloudera.api.swagger.model.ApiEntityTag;
import com.cloudera.api.swagger.model.ApiGenerateHostCertsArguments;
import com.cloudera.api.swagger.model.ApiGenericResponse;
import com.cloudera.api.swagger.model.ApiHost;
import com.cloudera.api.swagger.model.ApiHostList;
import com.cloudera.api.swagger.model.ApiHostMaintenanceResponseList;
import com.cloudera.api.swagger.model.ApiHostNameList;
import com.cloudera.api.swagger.model.ApiHostsToRemoveArgs;
import com.cloudera.api.swagger.model.ApiMetricList;
import com.cloudera.api.swagger.model.ApiMigrateRolesArguments;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HostsResourceApi {
    private ApiClient apiClient;

    public HostsResourceApi() {
        this(Configuration.getDefaultApiClient());
    }

    public HostsResourceApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Build call for addTags
     * @param hostname Name of the host (required)
     * @param body List of tags to add to the host (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call addTagsCall(String hostname, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostname}/tags"
            .replaceAll("\\{" + "hostname" + "\\}", apiClient.escapeString(hostname.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call addTagsValidateBeforeCall(String hostname, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostname' is set
        if (hostname == null) {
            throw new ApiException("Missing the required parameter 'hostname' when calling addTags(Async)");
        }

        okhttp3.Call call = addTagsCall(hostname, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param hostname Name of the host (required)
     * @param body List of tags to add to the host (optional)
     * @return List&lt;ApiEntityTag&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<ApiEntityTag> addTags(String hostname, List<ApiEntityTag> body) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = addTagsWithHttpInfo(hostname, body);
        return resp.getData();
    }

    /**
     * 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.
     * @param hostname Name of the host (required)
     * @param body List of tags to add to the host (optional)
     * @return ApiResponse&lt;List&lt;ApiEntityTag&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<ApiEntityTag>> addTagsWithHttpInfo(String hostname, List<ApiEntityTag> body) throws ApiException {
        okhttp3.Call call = addTagsValidateBeforeCall(hostname, body, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Attach tags to the host. (asynchronously)
     * Attach tags to the host. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param hostname Name of the host (required)
     * @param body List of tags to add to the host (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call addTagsAsync(String hostname, List<ApiEntityTag> body, final ApiCallback<List<ApiEntityTag>> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = addTagsValidateBeforeCall(hostname, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for createHosts
     * @param body The list of hosts to create (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call createHostsCall(ApiHostList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call createHostsValidateBeforeCall(ApiHostList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = createHostsCall(body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * .
     * &lt;p&gt;Create one or more hosts.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt;
     * @param body The list of hosts to create (optional)
     * @return ApiHostList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostList createHosts(ApiHostList body) throws ApiException {
        ApiResponse<ApiHostList> resp = createHostsWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * .
     * &lt;p&gt;Create one or more hosts.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt;
     * @param body The list of hosts to create (optional)
     * @return ApiResponse&lt;ApiHostList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostList> createHostsWithHttpInfo(ApiHostList body) throws ApiException {
        okhttp3.Call call = createHostsValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * . (asynchronously)
     * &lt;p&gt;Create one or more hosts.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt;
     * @param body The list of hosts to create (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call createHostsAsync(ApiHostList body, final ApiCallback<ApiHostList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = createHostsValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteAllHosts
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call deleteAllHostsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteAllHostsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = deleteAllHostsCall(progressListener, progressRequestListener);
        return call;

    }

    /**
     * Delete all hosts in the system.
     * Delete all hosts in the system
     * @return ApiHostList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostList deleteAllHosts() throws ApiException {
        ApiResponse<ApiHostList> resp = deleteAllHostsWithHttpInfo();
        return resp.getData();
    }

    /**
     * Delete all hosts in the system.
     * Delete all hosts in the system
     * @return ApiResponse&lt;ApiHostList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostList> deleteAllHostsWithHttpInfo() throws ApiException {
        okhttp3.Call call = deleteAllHostsValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete all hosts in the system. (asynchronously)
     * Delete all hosts in the system
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call deleteAllHostsAsync(final ApiCallback<ApiHostList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = deleteAllHostsValidateBeforeCall(progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteHost
     * @param hostId The ID of the host to remove (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call deleteHostCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteHostValidateBeforeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling deleteHost(Async)");
        }

        okhttp3.Call call = deleteHostCall(hostId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Delete a host from the system.
     * Delete a host from the system
     * @param hostId The ID of the host to remove (required)
     * @return ApiHost
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHost deleteHost(String hostId) throws ApiException {
        ApiResponse<ApiHost> resp = deleteHostWithHttpInfo(hostId);
        return resp.getData();
    }

    /**
     * Delete a host from the system.
     * Delete a host from the system
     * @param hostId The ID of the host to remove (required)
     * @return ApiResponse&lt;ApiHost&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHost> deleteHostWithHttpInfo(String hostId) throws ApiException {
        okhttp3.Call call = deleteHostValidateBeforeCall(hostId, null, null);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete a host from the system. (asynchronously)
     * Delete a host from the system
     * @param hostId The ID of the host to remove (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call deleteHostAsync(String hostId, final ApiCallback<ApiHost> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = deleteHostValidateBeforeCall(hostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteTags
     * @param hostname Name of the host to remove tags from (required)
     * @param body List of tags to remove from the host (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call deleteTagsCall(String hostname, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostname}/tags"
            .replaceAll("\\{" + "hostname" + "\\}", apiClient.escapeString(hostname.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteTagsValidateBeforeCall(String hostname, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostname' is set
        if (hostname == null) {
            throw new ApiException("Missing the required parameter 'hostname' when calling deleteTags(Async)");
        }

        okhttp3.Call call = deleteTagsCall(hostname, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param hostname Name of the host to remove tags from (required)
     * @param body List of tags to remove from the host (optional)
     * @return List&lt;ApiEntityTag&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<ApiEntityTag> deleteTags(String hostname, List<ApiEntityTag> body) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = deleteTagsWithHttpInfo(hostname, body);
        return resp.getData();
    }

    /**
     * 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.
     * @param hostname Name of the host to remove tags from (required)
     * @param body List of tags to remove from the host (optional)
     * @return ApiResponse&lt;List&lt;ApiEntityTag&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<ApiEntityTag>> deleteTagsWithHttpInfo(String hostname, List<ApiEntityTag> body) throws ApiException {
        okhttp3.Call call = deleteTagsValidateBeforeCall(hostname, body, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Remove the tags associated with the host. (asynchronously)
     * Remove the tags associated with the host. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param hostname Name of the host to remove tags from (required)
     * @param body List of tags to remove from the host (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call deleteTagsAsync(String hostname, List<ApiEntityTag> body, final ApiCallback<List<ApiEntityTag>> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = deleteTagsValidateBeforeCall(hostname, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for enterMaintenanceMode
     * @param hostId The ID of the host (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call enterMaintenanceModeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/commands/enterMaintenanceMode"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call enterMaintenanceModeValidateBeforeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling enterMaintenanceMode(Async)");
        }

        okhttp3.Call call = enterMaintenanceModeCall(hostId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Put the host into maintenance mode.
     * Put the host into maintenance mode. This is a synchronous command. The result is known immediately upon return.  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand enterMaintenanceMode(String hostId) throws ApiException {
        ApiResponse<ApiCommand> resp = enterMaintenanceModeWithHttpInfo(hostId);
        return resp.getData();
    }

    /**
     * Put the host into maintenance mode.
     * Put the host into maintenance mode. This is a synchronous command. The result is known immediately upon return.  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> enterMaintenanceModeWithHttpInfo(String hostId) throws ApiException {
        okhttp3.Call call = enterMaintenanceModeValidateBeforeCall(hostId, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Put the host into maintenance mode. (asynchronously)
     * Put the host into maintenance mode. This is a synchronous command. The result is known immediately upon return.  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call enterMaintenanceModeAsync(String hostId, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = enterMaintenanceModeValidateBeforeCall(hostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for exitMaintenanceMode
     * @param hostId The ID of the host (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call exitMaintenanceModeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/commands/exitMaintenanceMode"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call exitMaintenanceModeValidateBeforeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling exitMaintenanceMode(Async)");
        }

        okhttp3.Call call = exitMaintenanceModeCall(hostId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.  &lt;p&gt; Available since API v2. &lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand exitMaintenanceMode(String hostId) throws ApiException {
        ApiResponse<ApiCommand> resp = exitMaintenanceModeWithHttpInfo(hostId);
        return resp.getData();
    }

    /**
     * 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.  &lt;p&gt; Available since API v2. &lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> exitMaintenanceModeWithHttpInfo(String hostId) throws ApiException {
        okhttp3.Call call = exitMaintenanceModeValidateBeforeCall(hostId, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Take the host out of maintenance mode. (asynchronously)
     * Take the host out of maintenance mode. This is a synchronous command. The result is known immediately upon return.  &lt;p&gt; Available since API v2. &lt;/p&gt;
     * @param hostId The ID of the host (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call exitMaintenanceModeAsync(String hostId, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = exitMaintenanceModeValidateBeforeCall(hostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for generateHostCerts
     * @param hostId The ID of the host to generate a certificate for. (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call generateHostCertsCall(String hostId, ApiGenerateHostCertsArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/commands/generateHostCerts"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call generateHostCertsValidateBeforeCall(String hostId, ApiGenerateHostCertsArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling generateHostCerts(Async)");
        }

        okhttp3.Call call = generateHostCertsCall(hostId, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param hostId The ID of the host to generate a certificate for. (required)
     * @param body  (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand generateHostCerts(String hostId, ApiGenerateHostCertsArguments body) throws ApiException {
        ApiResponse<ApiCommand> resp = generateHostCertsWithHttpInfo(hostId, body);
        return resp.getData();
    }

    /**
     * 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.
     * @param hostId The ID of the host to generate a certificate for. (required)
     * @param body  (optional)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> generateHostCertsWithHttpInfo(String hostId, ApiGenerateHostCertsArguments body) throws ApiException {
        okhttp3.Call call = generateHostCertsValidateBeforeCall(hostId, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled. (asynchronously)
     * Generates (or regenerates) a key and certificate for this host if Auto-TLS is enabled.
     * @param hostId The ID of the host to generate a certificate for. (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call generateHostCertsAsync(String hostId, ApiGenerateHostCertsArguments body, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = generateHostCertsValidateBeforeCall(hostId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getHostComponents
     * @param hostId The ID of the host. (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call getHostComponentsCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/components"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getHostComponentsValidateBeforeCall(String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling getHostComponents(Async)");
        }

        okhttp3.Call call = getHostComponentsCall(hostId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns the list of Component details on the requested host.
     * Returns the list of Component details on the requested host.
     * @param hostId The ID of the host. (required)
     * @return List&lt;ApiComponentInfo&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<ApiComponentInfo> getHostComponents(String hostId) throws ApiException {
        ApiResponse<List<ApiComponentInfo>> resp = getHostComponentsWithHttpInfo(hostId);
        return resp.getData();
    }

    /**
     * Returns the list of Component details on the requested host.
     * Returns the list of Component details on the requested host.
     * @param hostId The ID of the host. (required)
     * @return ApiResponse&lt;List&lt;ApiComponentInfo&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<ApiComponentInfo>> getHostComponentsWithHttpInfo(String hostId) throws ApiException {
        okhttp3.Call call = getHostComponentsValidateBeforeCall(hostId, null, null);
        Type localVarReturnType = new TypeToken<List<ApiComponentInfo>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the list of Component details on the requested host. (asynchronously)
     * Returns the list of Component details on the requested host.
     * @param hostId The ID of the host. (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call getHostComponentsAsync(String hostId, final ApiCallback<List<ApiComponentInfo>> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = getHostComponentsValidateBeforeCall(hostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiComponentInfo>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getMetrics
     * @param hostId The host&#x27;s ID. (required)
     * @param from Start of the period to query. (optional)
     * @param ifs Network interfaces to query for metrics (default &#x3D; all). (optional)
     * @param metrics Filter for which metrics to query. (optional)
     * @param queryNw Whether to query for network interface metrics. (optional, default to true)
     * @param queryStorage Whether to query for storage metrics. (optional, default to true)
     * @param storageIds Storage context IDs to query for metrics (default &#x3D; all). (optional)
     * @param to End of the period to query. (optional, default to now)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call getMetricsCall(String hostId, String from, List<String> ifs, List<String> metrics, Boolean queryNw, Boolean queryStorage, List<String> storageIds, String to, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/metrics"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (from != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("from", from));
        if (ifs != null)
        localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "ifs", ifs));
        if (metrics != null)
        localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "metrics", metrics));
        if (queryNw != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("queryNw", queryNw));
        if (queryStorage != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("queryStorage", queryStorage));
        if (storageIds != null)
        localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "storageIds", storageIds));
        if (to != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("to", to));
        if (view != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("view", view));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @Deprecated
    @SuppressWarnings("rawtypes")
    private okhttp3.Call getMetricsValidateBeforeCall(String hostId, String from, List<String> ifs, List<String> metrics, Boolean queryNw, Boolean queryStorage, List<String> storageIds, String to, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling getMetrics(Async)");
        }

        okhttp3.Call call = getMetricsCall(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Fetch metric readings for a host.
     * Fetch metric readings for a host. &lt;p&gt; By default, this call will look up all metrics available for the host. If only specific metrics are desired, use the &lt;i&gt;metrics&lt;/i&gt; parameter. &lt;p&gt; 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 &lt;i&gt;from&lt;/i&gt; and &lt;i&gt;to&lt;/i&gt; parameters can be used to control the window being queried. A maximum window of 3 hours is enforced. &lt;p&gt; When requesting a \&quot;full\&quot; 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. &lt;p&gt; 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. &lt;p&gt; Storage metrics are collected at different levels; for example, per-disk and per-partition metrics are available. The \&quot;storageIds\&quot; parameter can be used to filter specific storage IDs. &lt;p&gt; In the returned data, the network interfaces and storage IDs can be identified by looking at the \&quot;context\&quot; property of the metric objects.
     * @param hostId The host&#x27;s ID. (required)
     * @param from Start of the period to query. (optional)
     * @param ifs Network interfaces to query for metrics (default &#x3D; all). (optional)
     * @param metrics Filter for which metrics to query. (optional)
     * @param queryNw Whether to query for network interface metrics. (optional, default to true)
     * @param queryStorage Whether to query for storage metrics. (optional, default to true)
     * @param storageIds Storage context IDs to query for metrics (default &#x3D; all). (optional)
     * @param to End of the period to query. (optional, default to now)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiMetricList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiMetricList getMetrics(String hostId, String from, List<String> ifs, List<String> metrics, Boolean queryNw, Boolean queryStorage, List<String> storageIds, String to, String view) throws ApiException {
        ApiResponse<ApiMetricList> resp = getMetricsWithHttpInfo(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view);
        return resp.getData();
    }

    /**
     * Fetch metric readings for a host.
     * Fetch metric readings for a host. &lt;p&gt; By default, this call will look up all metrics available for the host. If only specific metrics are desired, use the &lt;i&gt;metrics&lt;/i&gt; parameter. &lt;p&gt; 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 &lt;i&gt;from&lt;/i&gt; and &lt;i&gt;to&lt;/i&gt; parameters can be used to control the window being queried. A maximum window of 3 hours is enforced. &lt;p&gt; When requesting a \&quot;full\&quot; 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. &lt;p&gt; 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. &lt;p&gt; Storage metrics are collected at different levels; for example, per-disk and per-partition metrics are available. The \&quot;storageIds\&quot; parameter can be used to filter specific storage IDs. &lt;p&gt; In the returned data, the network interfaces and storage IDs can be identified by looking at the \&quot;context\&quot; property of the metric objects.
     * @param hostId The host&#x27;s ID. (required)
     * @param from Start of the period to query. (optional)
     * @param ifs Network interfaces to query for metrics (default &#x3D; all). (optional)
     * @param metrics Filter for which metrics to query. (optional)
     * @param queryNw Whether to query for network interface metrics. (optional, default to true)
     * @param queryStorage Whether to query for storage metrics. (optional, default to true)
     * @param storageIds Storage context IDs to query for metrics (default &#x3D; all). (optional)
     * @param to End of the period to query. (optional, default to now)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiResponse&lt;ApiMetricList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiMetricList> getMetricsWithHttpInfo(String hostId, String from, List<String> ifs, List<String> metrics, Boolean queryNw, Boolean queryStorage, List<String> storageIds, String to, String view) throws ApiException {
        okhttp3.Call call = getMetricsValidateBeforeCall(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view, null, null);
        Type localVarReturnType = new TypeToken<ApiMetricList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Fetch metric readings for a host. (asynchronously)
     * Fetch metric readings for a host. &lt;p&gt; By default, this call will look up all metrics available for the host. If only specific metrics are desired, use the &lt;i&gt;metrics&lt;/i&gt; parameter. &lt;p&gt; 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 &lt;i&gt;from&lt;/i&gt; and &lt;i&gt;to&lt;/i&gt; parameters can be used to control the window being queried. A maximum window of 3 hours is enforced. &lt;p&gt; When requesting a \&quot;full\&quot; 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. &lt;p&gt; 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. &lt;p&gt; Storage metrics are collected at different levels; for example, per-disk and per-partition metrics are available. The \&quot;storageIds\&quot; parameter can be used to filter specific storage IDs. &lt;p&gt; In the returned data, the network interfaces and storage IDs can be identified by looking at the \&quot;context\&quot; property of the metric objects.
     * @param hostId The host&#x27;s ID. (required)
     * @param from Start of the period to query. (optional)
     * @param ifs Network interfaces to query for metrics (default &#x3D; all). (optional)
     * @param metrics Filter for which metrics to query. (optional)
     * @param queryNw Whether to query for network interface metrics. (optional, default to true)
     * @param queryStorage Whether to query for storage metrics. (optional, default to true)
     * @param storageIds Storage context IDs to query for metrics (default &#x3D; all). (optional)
     * @param to End of the period to query. (optional, default to now)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call getMetricsAsync(String hostId, String from, List<String> ifs, List<String> metrics, Boolean queryNw, Boolean queryStorage, List<String> storageIds, String to, String view, final ApiCallback<ApiMetricList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = getMetricsValidateBeforeCall(hostId, from, ifs, metrics, queryNw, queryStorage, storageIds, to, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiMetricList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for hostsEnterMaintenanceMode
     * @param body The List of Host Names that needs to go into the maintenance mode. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call hostsEnterMaintenanceModeCall(ApiHostNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/enterMaintenanceMode";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call hostsEnterMaintenanceModeValidateBeforeCall(ApiHostNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = hostsEnterMaintenanceModeCall(body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Puts a set of hosts into Maintenance mode.
     * Puts a set of hosts into Maintenance mode  &lt;p&gt; 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. &lt;/p&gt;
     * @param body The List of Host Names that needs to go into the maintenance mode. (optional)
     * @return ApiHostMaintenanceResponseList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostMaintenanceResponseList hostsEnterMaintenanceMode(ApiHostNameList body) throws ApiException {
        ApiResponse<ApiHostMaintenanceResponseList> resp = hostsEnterMaintenanceModeWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * Puts a set of hosts into Maintenance mode.
     * Puts a set of hosts into Maintenance mode  &lt;p&gt; 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. &lt;/p&gt;
     * @param body The List of Host Names that needs to go into the maintenance mode. (optional)
     * @return ApiResponse&lt;ApiHostMaintenanceResponseList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostMaintenanceResponseList> hostsEnterMaintenanceModeWithHttpInfo(ApiHostNameList body) throws ApiException {
        okhttp3.Call call = hostsEnterMaintenanceModeValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<ApiHostMaintenanceResponseList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Puts a set of hosts into Maintenance mode. (asynchronously)
     * Puts a set of hosts into Maintenance mode  &lt;p&gt; 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. &lt;/p&gt;
     * @param body The List of Host Names that needs to go into the maintenance mode. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call hostsEnterMaintenanceModeAsync(ApiHostNameList body, final ApiCallback<ApiHostMaintenanceResponseList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = hostsEnterMaintenanceModeValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostMaintenanceResponseList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for migrateRoles
     * @param hostId The ID of the host on which the roles to migrate currently reside (required)
     * @param body Arguments for the command. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call migrateRolesCall(String hostId, ApiMigrateRolesArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/commands/migrateRoles"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call migrateRolesValidateBeforeCall(String hostId, ApiMigrateRolesArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling migrateRoles(Async)");
        }

        okhttp3.Call call = migrateRolesCall(hostId, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Migrate roles to a different host.
     * Migrate roles to a different host. &lt;p&gt; This command applies only to HDFS NameNode, JournalNode, and Failover Controller roles. In order to migrate these roles: &lt;ul&gt; &lt;li&gt;HDFS High Availability must be enabled, using quorum-based storage.&lt;/li&gt; &lt;li&gt;HDFS must not be configured to use a federated nameservice.&lt;/li&gt; &lt;/ul&gt; &lt;b&gt;Migrating a NameNode or JournalNode role requires cluster downtime&lt;/b&gt;. HDFS, along with all of its dependent services, will be stopped at the beginning of the migration process, and restarted at its conclusion. &lt;p&gt;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. &lt;p&gt;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. &lt;p&gt; Available since API v10.
     * @param hostId The ID of the host on which the roles to migrate currently reside (required)
     * @param body Arguments for the command. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand migrateRoles(String hostId, ApiMigrateRolesArguments body) throws ApiException {
        ApiResponse<ApiCommand> resp = migrateRolesWithHttpInfo(hostId, body);
        return resp.getData();
    }

    /**
     * Migrate roles to a different host.
     * Migrate roles to a different host. &lt;p&gt; This command applies only to HDFS NameNode, JournalNode, and Failover Controller roles. In order to migrate these roles: &lt;ul&gt; &lt;li&gt;HDFS High Availability must be enabled, using quorum-based storage.&lt;/li&gt; &lt;li&gt;HDFS must not be configured to use a federated nameservice.&lt;/li&gt; &lt;/ul&gt; &lt;b&gt;Migrating a NameNode or JournalNode role requires cluster downtime&lt;/b&gt;. HDFS, along with all of its dependent services, will be stopped at the beginning of the migration process, and restarted at its conclusion. &lt;p&gt;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. &lt;p&gt;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. &lt;p&gt; Available since API v10.
     * @param hostId The ID of the host on which the roles to migrate currently reside (required)
     * @param body Arguments for the command. (optional)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> migrateRolesWithHttpInfo(String hostId, ApiMigrateRolesArguments body) throws ApiException {
        okhttp3.Call call = migrateRolesValidateBeforeCall(hostId, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Migrate roles to a different host. (asynchronously)
     * Migrate roles to a different host. &lt;p&gt; This command applies only to HDFS NameNode, JournalNode, and Failover Controller roles. In order to migrate these roles: &lt;ul&gt; &lt;li&gt;HDFS High Availability must be enabled, using quorum-based storage.&lt;/li&gt; &lt;li&gt;HDFS must not be configured to use a federated nameservice.&lt;/li&gt; &lt;/ul&gt; &lt;b&gt;Migrating a NameNode or JournalNode role requires cluster downtime&lt;/b&gt;. HDFS, along with all of its dependent services, will be stopped at the beginning of the migration process, and restarted at its conclusion. &lt;p&gt;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. &lt;p&gt;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. &lt;p&gt; Available since API v10.
     * @param hostId The ID of the host on which the roles to migrate currently reside (required)
     * @param body Arguments for the command. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call migrateRolesAsync(String hostId, ApiMigrateRolesArguments body, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = migrateRolesValidateBeforeCall(hostId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readHost
     * @param hostId The ID of the host to read. (required)
     * @param view The view to materialize. Defaults to &#x27;full&#x27;. (optional, default to full)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call readHostCall(String hostId, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (view != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("view", view));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call readHostValidateBeforeCall(String hostId, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling readHost(Async)");
        }

        okhttp3.Call call = readHostCall(hostId, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns a specific Host in the system.
     * Returns a specific Host in the system.
     * @param hostId The ID of the host to read. (required)
     * @param view The view to materialize. Defaults to &#x27;full&#x27;. (optional, default to full)
     * @return ApiHost
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHost readHost(String hostId, String view) throws ApiException {
        ApiResponse<ApiHost> resp = readHostWithHttpInfo(hostId, view);
        return resp.getData();
    }

    /**
     * Returns a specific Host in the system.
     * Returns a specific Host in the system.
     * @param hostId The ID of the host to read. (required)
     * @param view The view to materialize. Defaults to &#x27;full&#x27;. (optional, default to full)
     * @return ApiResponse&lt;ApiHost&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHost> readHostWithHttpInfo(String hostId, String view) throws ApiException {
        okhttp3.Call call = readHostValidateBeforeCall(hostId, view, null, null);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns a specific Host in the system. (asynchronously)
     * Returns a specific Host in the system.
     * @param hostId The ID of the host to read. (required)
     * @param view The view to materialize. Defaults to &#x27;full&#x27;. (optional, default to full)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call readHostAsync(String hostId, String view, final ApiCallback<ApiHost> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = readHostValidateBeforeCall(hostId, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readHostConfig
     * @param hostId The ID of the host. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call readHostConfigCall(String hostId, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/config"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (view != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("view", view));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call readHostConfigValidateBeforeCall(String hostId, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling readHostConfig(Async)");
        }

        okhttp3.Call call = readHostConfigCall(hostId, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Retrieves the configuration of a specific host.
     * Retrieves the configuration of a specific host.
     * @param hostId The ID of the host. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiConfigList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiConfigList readHostConfig(String hostId, String view) throws ApiException {
        ApiResponse<ApiConfigList> resp = readHostConfigWithHttpInfo(hostId, view);
        return resp.getData();
    }

    /**
     * Retrieves the configuration of a specific host.
     * Retrieves the configuration of a specific host.
     * @param hostId The ID of the host. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiResponse&lt;ApiConfigList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiConfigList> readHostConfigWithHttpInfo(String hostId, String view) throws ApiException {
        okhttp3.Call call = readHostConfigValidateBeforeCall(hostId, view, null, null);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Retrieves the configuration of a specific host. (asynchronously)
     * Retrieves the configuration of a specific host.
     * @param hostId The ID of the host. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call readHostConfigAsync(String hostId, String view, final ApiCallback<ApiConfigList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = readHostConfigValidateBeforeCall(hostId, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readHosts
     * @param configName Optional host config name to filter hosts by. Available from v40. (optional)
     * @param configValue host config value associated with config name. Available from v40. (optional)
     * @param view The view to materialize (optional, default to summary)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call readHostsCall(String configName, String configValue, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (configName != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("configName", configName));
        if (configValue != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("configValue", configValue));
        if (view != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("view", view));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call readHostsValidateBeforeCall(String configName, String configValue, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = readHostsCall(configName, configValue, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param configName Optional host config name to filter hosts by. Available from v40. (optional)
     * @param configValue host config value associated with config name. Available from v40. (optional)
     * @param view The view to materialize (optional, default to summary)
     * @return ApiHostList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostList readHosts(String configName, String configValue, String view) throws ApiException {
        ApiResponse<ApiHostList> resp = readHostsWithHttpInfo(configName, configValue, view);
        return resp.getData();
    }

    /**
     * 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.
     * @param configName Optional host config name to filter hosts by. Available from v40. (optional)
     * @param configValue host config value associated with config name. Available from v40. (optional)
     * @param view The view to materialize (optional, default to summary)
     * @return ApiResponse&lt;ApiHostList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostList> readHostsWithHttpInfo(String configName, String configValue, String view) throws ApiException {
        okhttp3.Call call = readHostsValidateBeforeCall(configName, configValue, view, null, null);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns hosts in the system filtered by optional host configuration parameters, if specified. (asynchronously)
     * Returns hosts in the system filtered by optional host configuration parameters, if specified.
     * @param configName Optional host config name to filter hosts by. Available from v40. (optional)
     * @param configValue host config value associated with config name. Available from v40. (optional)
     * @param view The view to materialize (optional, default to summary)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call readHostsAsync(String configName, String configValue, String view, final ApiCallback<ApiHostList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = readHostsValidateBeforeCall(configName, configValue, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readTags
     * @param hostname The name of the host (required)
     * @param limit Number of tags (optional, default to 10)
     * @param offset Index of the first tag to retrieve (optional, default to 0)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call readTagsCall(String hostname, java.math.BigDecimal limit, java.math.BigDecimal offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostname}/tags"
            .replaceAll("\\{" + "hostname" + "\\}", apiClient.escapeString(hostname.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (limit != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
        if (offset != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call readTagsValidateBeforeCall(String hostname, java.math.BigDecimal limit, java.math.BigDecimal offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostname' is set
        if (hostname == null) {
            throw new ApiException("Missing the required parameter 'hostname' when calling readTags(Async)");
        }

        okhttp3.Call call = readTagsCall(hostname, limit, offset, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param hostname The name of the host (required)
     * @param limit Number of tags (optional, default to 10)
     * @param offset Index of the first tag to retrieve (optional, default to 0)
     * @return List&lt;ApiEntityTag&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List<ApiEntityTag> readTags(String hostname, java.math.BigDecimal limit, java.math.BigDecimal offset) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = readTagsWithHttpInfo(hostname, limit, offset);
        return resp.getData();
    }

    /**
     * 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.
     * @param hostname The name of the host (required)
     * @param limit Number of tags (optional, default to 10)
     * @param offset Index of the first tag to retrieve (optional, default to 0)
     * @return ApiResponse&lt;List&lt;ApiEntityTag&gt;&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<List<ApiEntityTag>> readTagsWithHttpInfo(String hostname, java.math.BigDecimal limit, java.math.BigDecimal offset) throws ApiException {
        okhttp3.Call call = readTagsValidateBeforeCall(hostname, limit, offset, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the tags associated with this host. (asynchronously)
     * Returns the tags associated with this host. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param hostname The name of the host (required)
     * @param limit Number of tags (optional, default to 10)
     * @param offset Index of the first tag to retrieve (optional, default to 0)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call readTagsAsync(String hostname, java.math.BigDecimal limit, java.math.BigDecimal offset, final ApiCallback<List<ApiEntityTag>> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = readTagsValidateBeforeCall(hostname, limit, offset, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for reallocateMemory
     * @param body A list of hosts identified by
hostnames to perform reallocation on. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call reallocateMemoryCall(ApiHostNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/reallocateMemory";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call reallocateMemoryValidateBeforeCall(ApiHostNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = reallocateMemoryCall(body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Performs memory reallocation on set of hosts.
     * Performs memory reallocation on set of hosts
     * @param body A list of hosts identified by
hostnames to perform reallocation on. (optional)
     * @return ApiGenericResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiGenericResponse reallocateMemory(ApiHostNameList body) throws ApiException {
        ApiResponse<ApiGenericResponse> resp = reallocateMemoryWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * Performs memory reallocation on set of hosts.
     * Performs memory reallocation on set of hosts
     * @param body A list of hosts identified by
hostnames to perform reallocation on. (optional)
     * @return ApiResponse&lt;ApiGenericResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiGenericResponse> reallocateMemoryWithHttpInfo(ApiHostNameList body) throws ApiException {
        okhttp3.Call call = reallocateMemoryValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<ApiGenericResponse>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Performs memory reallocation on set of hosts. (asynchronously)
     * Performs memory reallocation on set of hosts
     * @param body A list of hosts identified by
hostnames to perform reallocation on. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call reallocateMemoryAsync(ApiHostNameList body, final ApiCallback<ApiGenericResponse> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = reallocateMemoryValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiGenericResponse>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for removeHostsFromCluster
     * @param body The list of hosts to remove from cluster or delete from CM (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call removeHostsFromClusterCall(ApiHostsToRemoveArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/removeHostsFromCluster";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call removeHostsFromClusterValidateBeforeCall(ApiHostsToRemoveArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = removeHostsFromClusterCall(body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param body The list of hosts to remove from cluster or delete from CM (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand removeHostsFromCluster(ApiHostsToRemoveArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = removeHostsFromClusterWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * 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.
     * @param body The list of hosts to remove from cluster or delete from CM (optional)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> removeHostsFromClusterWithHttpInfo(ApiHostsToRemoveArgs body) throws ApiException {
        okhttp3.Call call = removeHostsFromClusterValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Decommissions and deletes all non management roles from the list of hosts and removes the hosts from the cluster. (asynchronously)
     * 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.
     * @param body The list of hosts to remove from cluster or delete from CM (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call removeHostsFromClusterAsync(ApiHostsToRemoveArgs body, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = removeHostsFromClusterValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for resetHostId
     * @param hostId The ID of the host that should be affected. (required)
     * @param newHostId New ID the the host should report. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call resetHostIdCall(String hostId, String newHostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/commands/resetHostId"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (newHostId != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("newHostId", newHostId));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call resetHostIdValidateBeforeCall(String hostId, String newHostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling resetHostId(Async)");
        }

        okhttp3.Call call = resetHostIdCall(hostId, newHostId, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 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.
     * @param hostId The ID of the host that should be affected. (required)
     * @param newHostId New ID the the host should report. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand resetHostId(String hostId, String newHostId) throws ApiException {
        ApiResponse<ApiCommand> resp = resetHostIdWithHttpInfo(hostId, newHostId);
        return resp.getData();
    }

    /**
     * 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.
     * @param hostId The ID of the host that should be affected. (required)
     * @param newHostId New ID the the host should report. (optional)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> resetHostIdWithHttpInfo(String hostId, String newHostId) throws ApiException {
        okhttp3.Call call = resetHostIdValidateBeforeCall(hostId, newHostId, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Forces agent on specified host to switch to reporting a different host id. (asynchronously)
     * Forces agent on specified host to switch to reporting a different host id.
     * @param hostId The ID of the host that should be affected. (required)
     * @param newHostId New ID the the host should report. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call resetHostIdAsync(String hostId, String newHostId, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = resetHostIdValidateBeforeCall(hostId, newHostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for stopAllRolesOnNodeGracefully
     * @param hostname The name of the host on which all the roles needs to be stopped. (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call stopAllRolesOnNodeGracefullyCall(String hostname, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/hosts/{hostname}/commands/stopAllRolesGracefully"
            .replaceAll("\\{" + "hostname" + "\\}", apiClient.escapeString(hostname.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call stopAllRolesOnNodeGracefullyValidateBeforeCall(String hostname, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostname' is set
        if (hostname == null) {
            throw new ApiException("Missing the required parameter 'hostname' when calling stopAllRolesOnNodeGracefully(Async)");
        }

        okhttp3.Call call = stopAllRolesOnNodeGracefullyCall(hostname, progressListener, progressRequestListener);
        return call;

    }

    /**
     * .
     * &lt;p&gt;&lt;/p&gt;Gracefully stops all roles that support it; otherwise, performs a simple stop on the provided host.&lt;/p&gt;
     * @param hostname The name of the host on which all the roles needs to be stopped. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand stopAllRolesOnNodeGracefully(String hostname) throws ApiException {
        ApiResponse<ApiCommand> resp = stopAllRolesOnNodeGracefullyWithHttpInfo(hostname);
        return resp.getData();
    }

    /**
     * .
     * &lt;p&gt;&lt;/p&gt;Gracefully stops all roles that support it; otherwise, performs a simple stop on the provided host.&lt;/p&gt;
     * @param hostname The name of the host on which all the roles needs to be stopped. (required)
     * @return ApiResponse&lt;ApiCommand&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommand> stopAllRolesOnNodeGracefullyWithHttpInfo(String hostname) throws ApiException {
        okhttp3.Call call = stopAllRolesOnNodeGracefullyValidateBeforeCall(hostname, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * . (asynchronously)
     * &lt;p&gt;&lt;/p&gt;Gracefully stops all roles that support it; otherwise, performs a simple stop on the provided host.&lt;/p&gt;
     * @param hostname The name of the host on which all the roles needs to be stopped. (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call stopAllRolesOnNodeGracefullyAsync(String hostname, final ApiCallback<ApiCommand> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = stopAllRolesOnNodeGracefullyValidateBeforeCall(hostname, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateHost
     * @param hostId The hostId to update (required)
     * @param body The updated host object. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call updateHostCall(String hostId, ApiHost body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateHostValidateBeforeCall(String hostId, ApiHost body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling updateHost(Async)");
        }

        okhttp3.Call call = updateHostCall(hostId, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * .
     * &lt;p&gt;Update an existing host in the system.&lt;/p&gt; &lt;p&gt;Currently, only updating the rackId is supported.  All other fields of the host will be ignored.&lt;/p&gt;
     * @param hostId The hostId to update (required)
     * @param body The updated host object. (optional)
     * @return ApiHost
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHost updateHost(String hostId, ApiHost body) throws ApiException {
        ApiResponse<ApiHost> resp = updateHostWithHttpInfo(hostId, body);
        return resp.getData();
    }

    /**
     * .
     * &lt;p&gt;Update an existing host in the system.&lt;/p&gt; &lt;p&gt;Currently, only updating the rackId is supported.  All other fields of the host will be ignored.&lt;/p&gt;
     * @param hostId The hostId to update (required)
     * @param body The updated host object. (optional)
     * @return ApiResponse&lt;ApiHost&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHost> updateHostWithHttpInfo(String hostId, ApiHost body) throws ApiException {
        okhttp3.Call call = updateHostValidateBeforeCall(hostId, body, null, null);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * . (asynchronously)
     * &lt;p&gt;Update an existing host in the system.&lt;/p&gt; &lt;p&gt;Currently, only updating the rackId is supported.  All other fields of the host will be ignored.&lt;/p&gt;
     * @param hostId The hostId to update (required)
     * @param body The updated host object. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call updateHostAsync(String hostId, ApiHost body, final ApiCallback<ApiHost> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = updateHostValidateBeforeCall(hostId, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHost>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateHostConfig
     * @param hostId The ID of the host. (required)
     * @param body Configuration changes. (optional)
     * @param message Optional message describing the changes. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call updateHostConfigCall(String hostId, ApiConfigList body, String message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/hosts/{hostId}/config"
            .replaceAll("\\{" + "hostId" + "\\}", apiClient.escapeString(hostId.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (message != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("message", message));

        Map<String, String> localVarHeaderParams = new HashMap<String, String>();

        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "basic" };
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateHostConfigValidateBeforeCall(String hostId, ApiConfigList body, String message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling updateHostConfig(Async)");
        }

        okhttp3.Call call = updateHostConfigCall(hostId, body, message, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Updates the host configuration with the given values.
     * Updates the host configuration with the given values. &lt;p&gt; If a value is set in the given configuration, it will be added to the host&#x27;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. &lt;p&gt; Attributes that are not listed in the input will maintain their current values in the configuration.
     * @param hostId The ID of the host. (required)
     * @param body Configuration changes. (optional)
     * @param message Optional message describing the changes. (optional)
     * @return ApiConfigList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiConfigList updateHostConfig(String hostId, ApiConfigList body, String message) throws ApiException {
        ApiResponse<ApiConfigList> resp = updateHostConfigWithHttpInfo(hostId, body, message);
        return resp.getData();
    }

    /**
     * Updates the host configuration with the given values.
     * Updates the host configuration with the given values. &lt;p&gt; If a value is set in the given configuration, it will be added to the host&#x27;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. &lt;p&gt; Attributes that are not listed in the input will maintain their current values in the configuration.
     * @param hostId The ID of the host. (required)
     * @param body Configuration changes. (optional)
     * @param message Optional message describing the changes. (optional)
     * @return ApiResponse&lt;ApiConfigList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiConfigList> updateHostConfigWithHttpInfo(String hostId, ApiConfigList body, String message) throws ApiException {
        okhttp3.Call call = updateHostConfigValidateBeforeCall(hostId, body, message, null, null);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates the host configuration with the given values. (asynchronously)
     * Updates the host configuration with the given values. &lt;p&gt; If a value is set in the given configuration, it will be added to the host&#x27;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. &lt;p&gt; Attributes that are not listed in the input will maintain their current values in the configuration.
     * @param hostId The ID of the host. (required)
     * @param body Configuration changes. (optional)
     * @param message Optional message describing the changes. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call updateHostConfigAsync(String hostId, ApiConfigList body, String message, final ApiCallback<ApiConfigList> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = updateHostConfigValidateBeforeCall(hostId, body, message, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
