/*
 * 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.ApiCdhUpgradeArgs;
import com.cloudera.api.swagger.model.ApiCluster;
import com.cloudera.api.swagger.model.ApiClusterList;
import com.cloudera.api.swagger.model.ApiClusterPerfInspectorArgs;
import com.cloudera.api.swagger.model.ApiClusterSupportToken;
import com.cloudera.api.swagger.model.ApiClusterTemplate;
import com.cloudera.api.swagger.model.ApiClusterUtilization;
import com.cloudera.api.swagger.model.ApiCommand;
import com.cloudera.api.swagger.model.ApiCommandList;
import com.cloudera.api.swagger.model.ApiConfigureForKerberosArguments;
import com.cloudera.api.swagger.model.ApiEcsDownloadAndDistributeArgs;
import com.cloudera.api.swagger.model.ApiEntityTag;
import com.cloudera.api.swagger.model.ApiHdfsUpgradeDomainList;
import com.cloudera.api.swagger.model.ApiHostList;
import com.cloudera.api.swagger.model.ApiHostRef;
import com.cloudera.api.swagger.model.ApiHostRefList;
import com.cloudera.api.swagger.model.ApiKerberosInfo;
import com.cloudera.api.swagger.model.ApiOzoneBucketInfo;
import com.cloudera.api.swagger.model.ApiOzoneS3GatewayInfo;
import com.cloudera.api.swagger.model.ApiRestartClusterArgs;
import com.cloudera.api.swagger.model.ApiRollingRestartClusterArgs;
import com.cloudera.api.swagger.model.ApiRollingUpgradeServicesArgs;
import com.cloudera.api.swagger.model.ApiRunSpecificHostInspectionsArgs;
import com.cloudera.api.swagger.model.ApiServiceList;
import com.cloudera.api.swagger.model.ApiServiceTypeList;
import java.io.File;

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

public class ClustersResourceApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for addHosts
     * @param clusterName  (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 addHostsCall(String clusterName, ApiHostRefList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/hosts"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 addHostsValidateBeforeCall(String clusterName, ApiHostRefList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling addHosts(Async)");
        }

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

    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @param body  (optional)
     * @return ApiHostRefList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostRefList addHosts(String clusterName, ApiHostRefList body) throws ApiException {
        ApiResponse<ApiHostRefList> resp = addHostsWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @param body  (optional)
     * @return ApiResponse&lt;ApiHostRefList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostRefList> addHostsWithHttpInfo(String clusterName, ApiHostRefList body) throws ApiException {
        okhttp3.Call call = addHostsValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiHostRefList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param clusterName  (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 addHostsAsync(String clusterName, ApiHostRefList body, final ApiCallback<ApiHostRefList> 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 = addHostsValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostRefList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for addTags
     * @param clusterName Name of the cluster (required)
     * @param body list of tags to add (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 clusterName, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/tags"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 clusterName, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling addTags(Async)");
        }

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

    }

    /**
     * Attach tags to the cluster.
     * Attach tags to the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster (required)
     * @param body list of tags to add (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 clusterName, List<ApiEntityTag> body) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = addTagsWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Attach tags to the cluster.
     * Attach tags to the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster (required)
     * @param body list of tags to add (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 clusterName, List<ApiEntityTag> body) throws ApiException {
        okhttp3.Call call = addTagsValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Attach tags to the cluster. (asynchronously)
     * Attach tags to the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster (required)
     * @param body list of tags to add (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 clusterName, 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(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for autoAssignRoles
     * @param clusterName The name of the cluster. (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 autoAssignRolesCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/autoAssignRoles"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 = {
            
        };
        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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

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

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

    }

    /**
     * Automatically assign roles to hosts and create the roles for all the services in a cluster.
     * Automatically assign roles to hosts and create the roles for all the services in a cluster. &lt;p&gt; Assignments are done based on services and hosts in the cluster, and hardware specifications. If no hosts are added to the cluster, an exception will be thrown preventing any role assignments. Existing roles will be taken into account and their assignments will be not be modified. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void autoAssignRoles(String clusterName) throws ApiException {
        autoAssignRolesWithHttpInfo(clusterName);
    }

    /**
     * Automatically assign roles to hosts and create the roles for all the services in a cluster.
     * Automatically assign roles to hosts and create the roles for all the services in a cluster. &lt;p&gt; Assignments are done based on services and hosts in the cluster, and hardware specifications. If no hosts are added to the cluster, an exception will be thrown preventing any role assignments. Existing roles will be taken into account and their assignments will be not be modified. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<Void> autoAssignRolesWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = autoAssignRolesValidateBeforeCall(clusterName, null, null);
        return apiClient.execute(call);
    }

    /**
     * Automatically assign roles to hosts and create the roles for all the services in a cluster. (asynchronously)
     * Automatically assign roles to hosts and create the roles for all the services in a cluster. &lt;p&gt; Assignments are done based on services and hosts in the cluster, and hardware specifications. If no hosts are added to the cluster, an exception will be thrown preventing any role assignments. Existing roles will be taken into account and their assignments will be not be modified. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (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 autoAssignRolesAsync(String clusterName, final ApiCallback<Void> 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 = autoAssignRolesValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for autoConfigure
     * @param clusterName The name of the cluster. (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 autoConfigureCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/autoConfigure"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 = {
            
        };
        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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

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

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

    }

    /**
     * Automatically configures roles and services in a cluster.
     * Automatically configures roles and services in a cluster. &lt;p&gt; Overwrites some existing configurations. Might create new role config groups. Only default role config groups must exist before calling this endpoint. Other role config groups must not exist. If they do, an exception will be thrown preventing any configuration. Ignores the Cloudera Management Service even if colocated with roles of this cluster. To avoid over-committing the heap on hosts, assign hosts to this cluster that are not being used by the Cloudera Management Service. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void autoConfigure(String clusterName) throws ApiException {
        autoConfigureWithHttpInfo(clusterName);
    }

    /**
     * Automatically configures roles and services in a cluster.
     * Automatically configures roles and services in a cluster. &lt;p&gt; Overwrites some existing configurations. Might create new role config groups. Only default role config groups must exist before calling this endpoint. Other role config groups must not exist. If they do, an exception will be thrown preventing any configuration. Ignores the Cloudera Management Service even if colocated with roles of this cluster. To avoid over-committing the heap on hosts, assign hosts to this cluster that are not being used by the Cloudera Management Service. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (required)
     * @return ApiResponse&lt;Void&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<Void> autoConfigureWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = autoConfigureValidateBeforeCall(clusterName, null, null);
        return apiClient.execute(call);
    }

    /**
     * Automatically configures roles and services in a cluster. (asynchronously)
     * Automatically configures roles and services in a cluster. &lt;p&gt; Overwrites some existing configurations. Might create new role config groups. Only default role config groups must exist before calling this endpoint. Other role config groups must not exist. If they do, an exception will be thrown preventing any configuration. Ignores the Cloudera Management Service even if colocated with roles of this cluster. To avoid over-committing the heap on hosts, assign hosts to this cluster that are not being used by the Cloudera Management Service. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster. (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 autoConfigureAsync(String clusterName, final ApiCallback<Void> 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 = autoConfigureValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for checkEcsPrerequisitesCommand
     * @param clusterName  (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 checkEcsPrerequisitesCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/checkEcsPrerequisites"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 checkEcsPrerequisitesCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling checkEcsPrerequisitesCommand(Async)");
        }

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

    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand checkEcsPrerequisitesCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = checkEcsPrerequisitesCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param clusterName  (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> checkEcsPrerequisitesCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = checkEcsPrerequisitesCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param clusterName  (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 checkEcsPrerequisitesCommandAsync(String clusterName, 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 = checkEcsPrerequisitesCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for configureAutoTlsServicesCommand
     * @param clusterName The name of the cluster. (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 configureAutoTlsServicesCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/configureAutoTlsServices"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 configureAutoTlsServicesCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling configureAutoTlsServicesCommand(Async)");
        }

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

    }

    /**
     * Configures all services in a cluster to use Auto-TLS.
     * Configures all services in a cluster to use Auto-TLS
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand configureAutoTlsServicesCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = configureAutoTlsServicesCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Configures all services in a cluster to use Auto-TLS.
     * Configures all services in a cluster to use Auto-TLS
     * @param clusterName The name of the cluster. (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> configureAutoTlsServicesCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = configureAutoTlsServicesCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Configures all services in a cluster to use Auto-TLS. (asynchronously)
     * Configures all services in a cluster to use Auto-TLS
     * @param clusterName The name of the cluster. (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 configureAutoTlsServicesCommandAsync(String clusterName, 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 = configureAutoTlsServicesCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for configureForKerberos
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the configure for kerberos 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 configureForKerberosCall(String clusterName, ApiConfigureForKerberosArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/configureForKerberos"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 configureForKerberosValidateBeforeCall(String clusterName, ApiConfigureForKerberosArguments body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling configureForKerberos(Async)");
        }

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

    }

    /**
     * Command to configure the cluster to use Kerberos for authentication.
     * Command to configure the cluster to use Kerberos for authentication.  This command will configure all relevant services on a cluster for Kerberos usage.  This command will trigger a GenerateCredentials command to create Kerberos keytabs for all roles in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the configure for kerberos command. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand configureForKerberos(String clusterName, ApiConfigureForKerberosArguments body) throws ApiException {
        ApiResponse<ApiCommand> resp = configureForKerberosWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Command to configure the cluster to use Kerberos for authentication.
     * Command to configure the cluster to use Kerberos for authentication.  This command will configure all relevant services on a cluster for Kerberos usage.  This command will trigger a GenerateCredentials command to create Kerberos keytabs for all roles in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the configure for kerberos 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> configureForKerberosWithHttpInfo(String clusterName, ApiConfigureForKerberosArguments body) throws ApiException {
        okhttp3.Call call = configureForKerberosValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Command to configure the cluster to use Kerberos for authentication. (asynchronously)
     * Command to configure the cluster to use Kerberos for authentication.  This command will configure all relevant services on a cluster for Kerberos usage.  This command will trigger a GenerateCredentials command to create Kerberos keytabs for all roles in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the configure for kerberos 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 configureForKerberosAsync(String clusterName, ApiConfigureForKerberosArguments 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 = configureForKerberosValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for createClusters
     * @param body List of clusters to created. (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 createClustersCall(ApiClusterList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

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

        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 createClustersValidateBeforeCall(ApiClusterList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

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

    }

    /**
     * Creates a collection of clusters.
     * Creates a collection of clusters.
     * @param body List of clusters to created. (optional)
     * @return ApiClusterList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiClusterList createClusters(ApiClusterList body) throws ApiException {
        ApiResponse<ApiClusterList> resp = createClustersWithHttpInfo(body);
        return resp.getData();
    }

    /**
     * Creates a collection of clusters.
     * Creates a collection of clusters.
     * @param body List of clusters to created. (optional)
     * @return ApiResponse&lt;ApiClusterList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiClusterList> createClustersWithHttpInfo(ApiClusterList body) throws ApiException {
        okhttp3.Call call = createClustersValidateBeforeCall(body, null, null);
        Type localVarReturnType = new TypeToken<ApiClusterList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Creates a collection of clusters. (asynchronously)
     * Creates a collection of clusters.
     * @param body List of clusters to created. (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 createClustersAsync(ApiClusterList body, final ApiCallback<ApiClusterList> 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 = createClustersValidateBeforeCall(body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiClusterList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteCluster
     * @param clusterName Name of cluster to delete. (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 deleteClusterCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 deleteClusterValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deleteCluster(Async)");
        }

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

    }

    /**
     * Deletes a cluster.
     * Deletes a cluster.
     * @param clusterName Name of cluster to delete. (required)
     * @return ApiCluster
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCluster deleteCluster(String clusterName) throws ApiException {
        ApiResponse<ApiCluster> resp = deleteClusterWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Deletes a cluster.
     * Deletes a cluster.
     * @param clusterName Name of cluster to delete. (required)
     * @return ApiResponse&lt;ApiCluster&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCluster> deleteClusterWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = deleteClusterValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Deletes a cluster. (asynchronously)
     * Deletes a cluster.
     * @param clusterName Name of cluster to delete. (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 deleteClusterAsync(String clusterName, final ApiCallback<ApiCluster> 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 = deleteClusterValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteClusterCredentialsCommand
     * @param clusterName cluster name (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 deleteClusterCredentialsCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/deleteCredentials"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 deleteClusterCredentialsCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deleteClusterCredentialsCommand(Async)");
        }

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

    }

    /**
     * Delete existing Kerberos credentials for the cluster.
     * Delete existing Kerberos credentials for the cluster. &lt;p&gt; This command will affect all services that have been configured to use Kerberos, and have existing credentials.
     * @param clusterName cluster name (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand deleteClusterCredentialsCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = deleteClusterCredentialsCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Delete existing Kerberos credentials for the cluster.
     * Delete existing Kerberos credentials for the cluster. &lt;p&gt; This command will affect all services that have been configured to use Kerberos, and have existing credentials.
     * @param clusterName cluster name (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> deleteClusterCredentialsCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = deleteClusterCredentialsCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete existing Kerberos credentials for the cluster. (asynchronously)
     * Delete existing Kerberos credentials for the cluster. &lt;p&gt; This command will affect all services that have been configured to use Kerberos, and have existing credentials.
     * @param clusterName cluster name (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 deleteClusterCredentialsCommandAsync(String clusterName, 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 = deleteClusterCredentialsCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteTags
     * @param clusterName Name of the cluster to remove tags from (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 deleteTagsCall(String clusterName, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/tags"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 clusterName, List<ApiEntityTag> body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deleteTags(Async)");
        }

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

    }

    /**
     * Remove the tags associated with the cluster.
     * Remove the tags associated with the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster to remove tags from (required)
     * @param body  (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 clusterName, List<ApiEntityTag> body) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = deleteTagsWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Remove the tags associated with the cluster.
     * Remove the tags associated with the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster to remove tags from (required)
     * @param body  (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 clusterName, List<ApiEntityTag> body) throws ApiException {
        okhttp3.Call call = deleteTagsValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Remove the tags associated with the cluster. (asynchronously)
     * Remove the tags associated with the cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName Name of the cluster to remove tags from (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 deleteTagsAsync(String clusterName, 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(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deployClientConfig
     * @param clusterName The name of the cluster (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 deployClientConfigCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/deployClientConfig"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 deployClientConfigValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deployClientConfig(Async)");
        }

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

    }

    /**
     * Deploy the cluster-wide client configuration.
     * Deploy the cluster-wide client configuration.  &lt;p&gt;For each service in the cluster, deploy the service&#x27;s client configuration to all the hosts that the service runs on.&lt;/p&gt;  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param clusterName The name of the cluster (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand deployClientConfig(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = deployClientConfigWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Deploy the cluster-wide client configuration.
     * Deploy the cluster-wide client configuration.  &lt;p&gt;For each service in the cluster, deploy the service&#x27;s client configuration to all the hosts that the service runs on.&lt;/p&gt;  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param clusterName The name of the cluster (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> deployClientConfigWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = deployClientConfigValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Deploy the cluster-wide client configuration. (asynchronously)
     * Deploy the cluster-wide client configuration.  &lt;p&gt;For each service in the cluster, deploy the service&#x27;s client configuration to all the hosts that the service runs on.&lt;/p&gt;  &lt;p&gt;Available since API v2.&lt;/p&gt;
     * @param clusterName The name of the cluster (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 deployClientConfigAsync(String clusterName, 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 = deployClientConfigValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deployClientConfigsAndRefresh
     * @param clusterName The name of the cluster. (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 deployClientConfigsAndRefreshCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/deployClientConfigsAndRefresh"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 deployClientConfigsAndRefreshValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deployClientConfigsAndRefresh(Async)");
        }

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

    }

    /**
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish.
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish.
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand deployClientConfigsAndRefresh(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = deployClientConfigsAndRefreshWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish.
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish.
     * @param clusterName The name of the cluster. (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> deployClientConfigsAndRefreshWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = deployClientConfigsAndRefreshValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish. (asynchronously)
     * Performs a command with the 2 steps - deploy cc - cluster refresh  This orchestration is needed for the staleness wizard, so it can invoke a single command at wizard finish.
     * @param clusterName The name of the cluster. (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 deployClientConfigsAndRefreshAsync(String clusterName, 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 = deployClientConfigsAndRefreshValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deployClusterClientConfig
     * @param clusterName The name of the cluster (required)
     * @param body Hosts in cluster to deploy to. If empty, will target all eligible
hosts in the cluster. (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 deployClusterClientConfigCall(String clusterName, ApiHostRefList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/deployClusterClientConfig"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 deployClusterClientConfigValidateBeforeCall(String clusterName, ApiHostRefList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling deployClusterClientConfig(Async)");
        }

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

    }

    /**
     * Deploy the Cluster&#x27;s Kerberos client configuration.
     * Deploy the Cluster&#x27;s Kerberos client configuration.  &lt;p&gt; Deploy krb5.conf to hosts in a cluster. Does not deploy to decommissioned hosts or hosts with active processes. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster (required)
     * @param body Hosts in cluster to deploy to. If empty, will target all eligible
hosts in the cluster. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand deployClusterClientConfig(String clusterName, ApiHostRefList body) throws ApiException {
        ApiResponse<ApiCommand> resp = deployClusterClientConfigWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Deploy the Cluster&#x27;s Kerberos client configuration.
     * Deploy the Cluster&#x27;s Kerberos client configuration.  &lt;p&gt; Deploy krb5.conf to hosts in a cluster. Does not deploy to decommissioned hosts or hosts with active processes. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster (required)
     * @param body Hosts in cluster to deploy to. If empty, will target all eligible
hosts in the cluster. (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> deployClusterClientConfigWithHttpInfo(String clusterName, ApiHostRefList body) throws ApiException {
        okhttp3.Call call = deployClusterClientConfigValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Deploy the Cluster&#x27;s Kerberos client configuration. (asynchronously)
     * Deploy the Cluster&#x27;s Kerberos client configuration.  &lt;p&gt; Deploy krb5.conf to hosts in a cluster. Does not deploy to decommissioned hosts or hosts with active processes. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster (required)
     * @param body Hosts in cluster to deploy to. If empty, will target all eligible
hosts in the cluster. (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 deployClusterClientConfigAsync(String clusterName, ApiHostRefList 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 = deployClusterClientConfigValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for disableTls
     * @param clusterName The name of the cluster (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 disableTlsCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/disableTls"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 disableTlsValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling disableTls(Async)");
        }

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

    }

    /**
     * Disables TLS settings on a cluster.
     * Disables TLS settings on a cluster.
     * @param clusterName The name of the cluster (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand disableTls(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = disableTlsWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Disables TLS settings on a cluster.
     * Disables TLS settings on a cluster.
     * @param clusterName The name of the cluster (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> disableTlsWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = disableTlsValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Disables TLS settings on a cluster. (asynchronously)
     * Disables TLS settings on a cluster.
     * @param clusterName The name of the cluster (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 disableTlsAsync(String clusterName, 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 = disableTlsValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for ecsDownloadAndDistribute
     * @param clusterName  (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 ecsDownloadAndDistributeCall(String clusterName, ApiEcsDownloadAndDistributeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/ecsDownloadAndDistribute"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 ecsDownloadAndDistributeValidateBeforeCall(String clusterName, ApiEcsDownloadAndDistributeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling ecsDownloadAndDistribute(Async)");
        }

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

    }

    /**
     * 
     * 
     * @param clusterName  (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 ecsDownloadAndDistribute(String clusterName, ApiEcsDownloadAndDistributeArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = ecsDownloadAndDistributeWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param clusterName  (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> ecsDownloadAndDistributeWithHttpInfo(String clusterName, ApiEcsDownloadAndDistributeArgs body) throws ApiException {
        okhttp3.Call call = ecsDownloadAndDistributeValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param clusterName  (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 ecsDownloadAndDistributeAsync(String clusterName, ApiEcsDownloadAndDistributeArgs 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 = ecsDownloadAndDistributeValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for enterMaintenanceMode
     * @param clusterName The name of the cluster (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 clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/enterMaintenanceMode"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling enterMaintenanceMode(Async)");
        }

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

    }

    /**
     * Put the cluster into maintenance mode.
     * Put the cluster 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 clusterName The name of the cluster (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 clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = enterMaintenanceModeWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Put the cluster into maintenance mode.
     * Put the cluster 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 clusterName The name of the cluster (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 clusterName) throws ApiException {
        okhttp3.Call call = enterMaintenanceModeValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Put the cluster into maintenance mode. (asynchronously)
     * Put the cluster 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 clusterName The name of the cluster (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 clusterName, 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(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for exitMaintenanceMode
     * @param clusterName The name of the cluster (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 clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/exitMaintenanceMode"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling exitMaintenanceMode(Async)");
        }

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

    }

    /**
     * Take the cluster out of maintenance mode.
     * Take the cluster 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 clusterName The name of the cluster (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 clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = exitMaintenanceModeWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Take the cluster out of maintenance mode.
     * Take the cluster 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 clusterName The name of the cluster (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 clusterName) throws ApiException {
        okhttp3.Call call = exitMaintenanceModeValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Take the cluster out of maintenance mode. (asynchronously)
     * Take the cluster 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 clusterName The name of the cluster (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 clusterName, 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(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for expireLogs
     * @param clusterName The name of the cluster. (required)
     * @param days Logs more than these many days old are purged. By default, it uses the value defined in the CM configuration. Set to -2 to explicitly set to default. (optional, default to -2)
     * @param scheduleNext Whether to schedule a next run for the command, or not. If set to , the next run will get scheduled after this one finished. If a schedule already exists, it will be updated. Can be omitted, the default value is false. (optional, default to false)
     * @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 expireLogsCall(String clusterName, java.math.BigDecimal days, Boolean scheduleNext, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

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

        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 expireLogsValidateBeforeCall(String clusterName, java.math.BigDecimal days, Boolean scheduleNext, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling expireLogs(Async)");
        }

        okhttp3.Call call = expireLogsCall(clusterName, days, scheduleNext, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Remove backup and disaster related log files in hdfs.
     * Remove backup and disaster related log files in hdfs.
     * @param clusterName The name of the cluster. (required)
     * @param days Logs more than these many days old are purged. By default, it uses the value defined in the CM configuration. Set to -2 to explicitly set to default. (optional, default to -2)
     * @param scheduleNext Whether to schedule a next run for the command, or not. If set to , the next run will get scheduled after this one finished. If a schedule already exists, it will be updated. Can be omitted, the default value is false. (optional, default to false)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand expireLogs(String clusterName, java.math.BigDecimal days, Boolean scheduleNext) throws ApiException {
        ApiResponse<ApiCommand> resp = expireLogsWithHttpInfo(clusterName, days, scheduleNext);
        return resp.getData();
    }

    /**
     * Remove backup and disaster related log files in hdfs.
     * Remove backup and disaster related log files in hdfs.
     * @param clusterName The name of the cluster. (required)
     * @param days Logs more than these many days old are purged. By default, it uses the value defined in the CM configuration. Set to -2 to explicitly set to default. (optional, default to -2)
     * @param scheduleNext Whether to schedule a next run for the command, or not. If set to , the next run will get scheduled after this one finished. If a schedule already exists, it will be updated. Can be omitted, the default value is false. (optional, default to false)
     * @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> expireLogsWithHttpInfo(String clusterName, java.math.BigDecimal days, Boolean scheduleNext) throws ApiException {
        okhttp3.Call call = expireLogsValidateBeforeCall(clusterName, days, scheduleNext, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Remove backup and disaster related log files in hdfs. (asynchronously)
     * Remove backup and disaster related log files in hdfs.
     * @param clusterName The name of the cluster. (required)
     * @param days Logs more than these many days old are purged. By default, it uses the value defined in the CM configuration. Set to -2 to explicitly set to default. (optional, default to -2)
     * @param scheduleNext Whether to schedule a next run for the command, or not. If set to , the next run will get scheduled after this one finished. If a schedule already exists, it will be updated. Can be omitted, the default value is false. (optional, default to false)
     * @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 expireLogsAsync(String clusterName, java.math.BigDecimal days, Boolean scheduleNext, 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 = expireLogsValidateBeforeCall(clusterName, days, scheduleNext, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for export
     * @param clusterName cluster name (required)
     * @param exportAutoConfig export configs set by the auto configuration (optional, default to false)
     * @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 exportCall(String clusterName, Boolean exportAutoConfig, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

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

        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 exportValidateBeforeCall(String clusterName, Boolean exportAutoConfig, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling export(Async)");
        }

        okhttp3.Call call = exportCall(clusterName, exportAutoConfig, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Export the cluster template for the given cluster.
     * Export the cluster template for the given cluster. If cluster does not have host templates defined it will export host templates based on roles assignment.
     * @param clusterName cluster name (required)
     * @param exportAutoConfig export configs set by the auto configuration (optional, default to false)
     * @return ApiClusterTemplate
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiClusterTemplate export(String clusterName, Boolean exportAutoConfig) throws ApiException {
        ApiResponse<ApiClusterTemplate> resp = exportWithHttpInfo(clusterName, exportAutoConfig);
        return resp.getData();
    }

    /**
     * Export the cluster template for the given cluster.
     * Export the cluster template for the given cluster. If cluster does not have host templates defined it will export host templates based on roles assignment.
     * @param clusterName cluster name (required)
     * @param exportAutoConfig export configs set by the auto configuration (optional, default to false)
     * @return ApiResponse&lt;ApiClusterTemplate&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiClusterTemplate> exportWithHttpInfo(String clusterName, Boolean exportAutoConfig) throws ApiException {
        okhttp3.Call call = exportValidateBeforeCall(clusterName, exportAutoConfig, null, null);
        Type localVarReturnType = new TypeToken<ApiClusterTemplate>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Export the cluster template for the given cluster. (asynchronously)
     * Export the cluster template for the given cluster. If cluster does not have host templates defined it will export host templates based on roles assignment.
     * @param clusterName cluster name (required)
     * @param exportAutoConfig export configs set by the auto configuration (optional, default to false)
     * @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 exportAsync(String clusterName, Boolean exportAutoConfig, final ApiCallback<ApiClusterTemplate> 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 = exportValidateBeforeCall(clusterName, exportAutoConfig, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiClusterTemplate>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for firstRun
     * @param clusterName The name of the cluster. (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 firstRunCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/firstRun"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 firstRunValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling firstRun(Async)");
        }

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

    }

    /**
     * Prepare and start services in a cluster.
     * Prepare and start services in a cluster.  &lt;p&gt; Perform all the steps needed to prepare each service in a cluster and start the services in order. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand firstRun(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = firstRunWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Prepare and start services in a cluster.
     * Prepare and start services in a cluster.  &lt;p&gt; Perform all the steps needed to prepare each service in a cluster and start the services in order. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster. (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> firstRunWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = firstRunValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Prepare and start services in a cluster. (asynchronously)
     * Prepare and start services in a cluster.  &lt;p&gt; Perform all the steps needed to prepare each service in a cluster and start the services in order. &lt;/p&gt;  &lt;p&gt; Available since API v7. &lt;/p&gt;
     * @param clusterName The name of the cluster. (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 firstRunAsync(String clusterName, 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 = firstRunValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getClientConfig
     * @param clusterName The cluster name. (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 getClientConfigCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/clientConfig"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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/octet-stream"
        };
        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 getClientConfigValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getClientConfig(Async)");
        }

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

    }

    /**
     * Download a zip-compressed archive of the client configuration, of a specific cluster.
     * Download a zip-compressed archive of the client configuration, of a specific cluster. Currently, this only includes Kerberos Client Configuration (krb5.conf). For client configuration of services, use the clientConfig endpoint of the services resource. This resource does not require any authentication.
     * @param clusterName The cluster name. (required)
     * @return File
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public File getClientConfig(String clusterName) throws ApiException {
        ApiResponse<File> resp = getClientConfigWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Download a zip-compressed archive of the client configuration, of a specific cluster.
     * Download a zip-compressed archive of the client configuration, of a specific cluster. Currently, this only includes Kerberos Client Configuration (krb5.conf). For client configuration of services, use the clientConfig endpoint of the services resource. This resource does not require any authentication.
     * @param clusterName The cluster name. (required)
     * @return ApiResponse&lt;File&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<File> getClientConfigWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = getClientConfigValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<File>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Download a zip-compressed archive of the client configuration, of a specific cluster. (asynchronously)
     * Download a zip-compressed archive of the client configuration, of a specific cluster. Currently, this only includes Kerberos Client Configuration (krb5.conf). For client configuration of services, use the clientConfig endpoint of the services resource. This resource does not require any authentication.
     * @param clusterName The cluster name. (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 getClientConfigAsync(String clusterName, final ApiCallback<File> 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 = getClientConfigValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<File>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getClusterSupportToken
     * @param clusterName The name of the cluster. (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 getClusterSupportTokenCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/clusterSupportToken"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 getClusterSupportTokenValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getClusterSupportToken(Async)");
        }

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

    }

    /**
     * Gets the support token for a cluster.
     * Gets the support token for a cluster.
     * @param clusterName The name of the cluster. (required)
     * @return ApiClusterSupportToken
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiClusterSupportToken getClusterSupportToken(String clusterName) throws ApiException {
        ApiResponse<ApiClusterSupportToken> resp = getClusterSupportTokenWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Gets the support token for a cluster.
     * Gets the support token for a cluster.
     * @param clusterName The name of the cluster. (required)
     * @return ApiResponse&lt;ApiClusterSupportToken&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiClusterSupportToken> getClusterSupportTokenWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = getClusterSupportTokenValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiClusterSupportToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Gets the support token for a cluster. (asynchronously)
     * Gets the support token for a cluster.
     * @param clusterName The name of the cluster. (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 getClusterSupportTokenAsync(String clusterName, final ApiCallback<ApiClusterSupportToken> 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 = getClusterSupportTokenValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiClusterSupportToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getKerberosInfo
     * @param clusterName The cluster name. (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 getKerberosInfoCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/kerberosInfo"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 getKerberosInfoValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getKerberosInfo(Async)");
        }

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

    }

    /**
     * Provides Cluster Kerberos information.
     * Provides Cluster Kerberos information
     * @param clusterName The cluster name. (required)
     * @return ApiKerberosInfo
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiKerberosInfo getKerberosInfo(String clusterName) throws ApiException {
        ApiResponse<ApiKerberosInfo> resp = getKerberosInfoWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Provides Cluster Kerberos information.
     * Provides Cluster Kerberos information
     * @param clusterName The cluster name. (required)
     * @return ApiResponse&lt;ApiKerberosInfo&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiKerberosInfo> getKerberosInfoWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = getKerberosInfoValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiKerberosInfo>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Provides Cluster Kerberos information. (asynchronously)
     * Provides Cluster Kerberos information
     * @param clusterName The cluster name. (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 getKerberosInfoAsync(String clusterName, final ApiCallback<ApiKerberosInfo> 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 = getKerberosInfoValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiKerberosInfo>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getOzoneBucketInfo
     * @param clusterName  (required)
     * @param bucketName  (optional)
     * @param volumeName  (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 getOzoneBucketInfoCall(String clusterName, String bucketName, String volumeName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

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

        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 getOzoneBucketInfoValidateBeforeCall(String clusterName, String bucketName, String volumeName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getOzoneBucketInfo(Async)");
        }

        okhttp3.Call call = getOzoneBucketInfoCall(clusterName, bucketName, volumeName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns the properties of the provided ozone bucket if the bucket exists.
     * Returns the properties of the provided ozone bucket if the bucket exists.
     * @param clusterName  (required)
     * @param bucketName  (optional)
     * @param volumeName  (optional)
     * @return ApiOzoneBucketInfo
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiOzoneBucketInfo getOzoneBucketInfo(String clusterName, String bucketName, String volumeName) throws ApiException {
        ApiResponse<ApiOzoneBucketInfo> resp = getOzoneBucketInfoWithHttpInfo(clusterName, bucketName, volumeName);
        return resp.getData();
    }

    /**
     * Returns the properties of the provided ozone bucket if the bucket exists.
     * Returns the properties of the provided ozone bucket if the bucket exists.
     * @param clusterName  (required)
     * @param bucketName  (optional)
     * @param volumeName  (optional)
     * @return ApiResponse&lt;ApiOzoneBucketInfo&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiOzoneBucketInfo> getOzoneBucketInfoWithHttpInfo(String clusterName, String bucketName, String volumeName) throws ApiException {
        okhttp3.Call call = getOzoneBucketInfoValidateBeforeCall(clusterName, bucketName, volumeName, null, null);
        Type localVarReturnType = new TypeToken<ApiOzoneBucketInfo>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the properties of the provided ozone bucket if the bucket exists. (asynchronously)
     * Returns the properties of the provided ozone bucket if the bucket exists.
     * @param clusterName  (required)
     * @param bucketName  (optional)
     * @param volumeName  (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 getOzoneBucketInfoAsync(String clusterName, String bucketName, String volumeName, final ApiCallback<ApiOzoneBucketInfo> 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 = getOzoneBucketInfoValidateBeforeCall(clusterName, bucketName, volumeName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiOzoneBucketInfo>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getOzoneS3GatewayInfo
     * @param clusterName The name of the cluster (required)
     * @param bucketName the name of the bucket 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 getOzoneS3GatewayInfoCall(String clusterName, String bucketName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

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

        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 getOzoneS3GatewayInfoValidateBeforeCall(String clusterName, String bucketName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getOzoneS3GatewayInfo(Async)");
        }

        okhttp3.Call call = getOzoneS3GatewayInfoCall(clusterName, bucketName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint.
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint. Additionally, creates a bucket with the specified name under the volume s3v. If no Ozone is present, or Ozone is not running, returns success with an empty response.  Currently, we get the credentials for the Hive kerberos principal, and give ownership of the created bucket to the same. This is likely not a permanent solution. If the cluster is not kerberizied, we return dummy credentials.  Requires CDH 7.2.1+ or CDH 7.1.3+
     * @param clusterName The name of the cluster (required)
     * @param bucketName the name of the bucket to create (optional)
     * @return ApiOzoneS3GatewayInfo
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiOzoneS3GatewayInfo getOzoneS3GatewayInfo(String clusterName, String bucketName) throws ApiException {
        ApiResponse<ApiOzoneS3GatewayInfo> resp = getOzoneS3GatewayInfoWithHttpInfo(clusterName, bucketName);
        return resp.getData();
    }

    /**
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint.
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint. Additionally, creates a bucket with the specified name under the volume s3v. If no Ozone is present, or Ozone is not running, returns success with an empty response.  Currently, we get the credentials for the Hive kerberos principal, and give ownership of the created bucket to the same. This is likely not a permanent solution. If the cluster is not kerberizied, we return dummy credentials.  Requires CDH 7.2.1+ or CDH 7.1.3+
     * @param clusterName The name of the cluster (required)
     * @param bucketName the name of the bucket to create (optional)
     * @return ApiResponse&lt;ApiOzoneS3GatewayInfo&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiOzoneS3GatewayInfo> getOzoneS3GatewayInfoWithHttpInfo(String clusterName, String bucketName) throws ApiException {
        okhttp3.Call call = getOzoneS3GatewayInfoValidateBeforeCall(clusterName, bucketName, null, null);
        Type localVarReturnType = new TypeToken<ApiOzoneS3GatewayInfo>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint. (asynchronously)
     * Returns the REST url for the Ozone S3 Gateway, as well as the AWS credentials needed to access the S3 endpoint. Additionally, creates a bucket with the specified name under the volume s3v. If no Ozone is present, or Ozone is not running, returns success with an empty response.  Currently, we get the credentials for the Hive kerberos principal, and give ownership of the created bucket to the same. This is likely not a permanent solution. If the cluster is not kerberizied, we return dummy credentials.  Requires CDH 7.2.1+ or CDH 7.1.3+
     * @param clusterName The name of the cluster (required)
     * @param bucketName the name of the bucket 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 getOzoneS3GatewayInfoAsync(String clusterName, String bucketName, final ApiCallback<ApiOzoneS3GatewayInfo> 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 = getOzoneS3GatewayInfoValidateBeforeCall(clusterName, bucketName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiOzoneS3GatewayInfo>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getUtilizationReport
     * @param clusterName cluster name (required)
     * @param daysOfWeek The days of the week for which the user wants to report utilization. Days is a list of number between 1 to 7, where 1 corresponds to Monday, and 7 corrensponds to Sunday. All 7 days are included if this is not specified. (optional)
     * @param endHourOfDay The end hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 23 if this is not specified. (optional, default to 23)
     * @param from Start of the time range to report utilization in ISO 8601 format. (optional)
     * @param startHourOfDay The start hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 0 if this is not specified. (optional, default to 0)
     * @param tenantType The type of the tenant (POOL or USER). (optional, default to POOL)
     * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). (optional, default to now)
     * @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 getUtilizationReportCall(String clusterName, List<String> daysOfWeek, java.math.BigDecimal endHourOfDay, String from, java.math.BigDecimal startHourOfDay, String tenantType, String to, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (daysOfWeek != null)
        localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("multi", "daysOfWeek", daysOfWeek));
        if (endHourOfDay != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("endHourOfDay", endHourOfDay));
        if (from != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("from", from));
        if (startHourOfDay != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("startHourOfDay", startHourOfDay));
        if (tenantType != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("tenantType", tenantType));
        if (to != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("to", to));

        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 getUtilizationReportValidateBeforeCall(String clusterName, List<String> daysOfWeek, java.math.BigDecimal endHourOfDay, String from, java.math.BigDecimal startHourOfDay, String tenantType, String to, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling getUtilizationReport(Async)");
        }

        okhttp3.Call call = getUtilizationReportCall(clusterName, daysOfWeek, endHourOfDay, from, startHourOfDay, tenantType, to, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant.
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName cluster name (required)
     * @param daysOfWeek The days of the week for which the user wants to report utilization. Days is a list of number between 1 to 7, where 1 corresponds to Monday, and 7 corrensponds to Sunday. All 7 days are included if this is not specified. (optional)
     * @param endHourOfDay The end hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 23 if this is not specified. (optional, default to 23)
     * @param from Start of the time range to report utilization in ISO 8601 format. (optional)
     * @param startHourOfDay The start hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 0 if this is not specified. (optional, default to 0)
     * @param tenantType The type of the tenant (POOL or USER). (optional, default to POOL)
     * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). (optional, default to now)
     * @return ApiClusterUtilization
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiClusterUtilization getUtilizationReport(String clusterName, List<String> daysOfWeek, java.math.BigDecimal endHourOfDay, String from, java.math.BigDecimal startHourOfDay, String tenantType, String to) throws ApiException {
        ApiResponse<ApiClusterUtilization> resp = getUtilizationReportWithHttpInfo(clusterName, daysOfWeek, endHourOfDay, from, startHourOfDay, tenantType, to);
        return resp.getData();
    }

    /**
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant.
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName cluster name (required)
     * @param daysOfWeek The days of the week for which the user wants to report utilization. Days is a list of number between 1 to 7, where 1 corresponds to Monday, and 7 corrensponds to Sunday. All 7 days are included if this is not specified. (optional)
     * @param endHourOfDay The end hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 23 if this is not specified. (optional, default to 23)
     * @param from Start of the time range to report utilization in ISO 8601 format. (optional)
     * @param startHourOfDay The start hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 0 if this is not specified. (optional, default to 0)
     * @param tenantType The type of the tenant (POOL or USER). (optional, default to POOL)
     * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). (optional, default to now)
     * @return ApiResponse&lt;ApiClusterUtilization&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiClusterUtilization> getUtilizationReportWithHttpInfo(String clusterName, List<String> daysOfWeek, java.math.BigDecimal endHourOfDay, String from, java.math.BigDecimal startHourOfDay, String tenantType, String to) throws ApiException {
        okhttp3.Call call = getUtilizationReportValidateBeforeCall(clusterName, daysOfWeek, endHourOfDay, from, startHourOfDay, tenantType, to, null, null);
        Type localVarReturnType = new TypeToken<ApiClusterUtilization>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant. (asynchronously)
     * Provides the resource utilization of the entire cluster as well as the resource utilization per tenant. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName cluster name (required)
     * @param daysOfWeek The days of the week for which the user wants to report utilization. Days is a list of number between 1 to 7, where 1 corresponds to Monday, and 7 corrensponds to Sunday. All 7 days are included if this is not specified. (optional)
     * @param endHourOfDay The end hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 23 if this is not specified. (optional, default to 23)
     * @param from Start of the time range to report utilization in ISO 8601 format. (optional)
     * @param startHourOfDay The start hour of a day for which the user wants to report utilization. The hour is a number between [0-23]. Default value is 0 if this is not specified. (optional, default to 0)
     * @param tenantType The type of the tenant (POOL or USER). (optional, default to POOL)
     * @param to End of the the time range to report utilization in ISO 8601 format (defaults to now). (optional, default to now)
     * @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 getUtilizationReportAsync(String clusterName, List<String> daysOfWeek, java.math.BigDecimal endHourOfDay, String from, java.math.BigDecimal startHourOfDay, String tenantType, String to, final ApiCallback<ApiClusterUtilization> 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 = getUtilizationReportValidateBeforeCall(clusterName, daysOfWeek, endHourOfDay, from, startHourOfDay, tenantType, to, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiClusterUtilization>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for inspectHostsCommand
     * @param clusterName The name of the cluster (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 inspectHostsCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/inspectHosts"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 inspectHostsCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling inspectHostsCommand(Async)");
        }

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

    }

    /**
     * Runs the host inspector on the configured hosts in the specified cluster.
     * Runs the host inspector on the configured hosts in the specified cluster.  Available since V8.
     * @param clusterName The name of the cluster (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand inspectHostsCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = inspectHostsCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Runs the host inspector on the configured hosts in the specified cluster.
     * Runs the host inspector on the configured hosts in the specified cluster.  Available since V8.
     * @param clusterName The name of the cluster (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> inspectHostsCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = inspectHostsCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Runs the host inspector on the configured hosts in the specified cluster. (asynchronously)
     * Runs the host inspector on the configured hosts in the specified cluster.  Available since V8.
     * @param clusterName The name of the cluster (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 inspectHostsCommandAsync(String clusterName, 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 = inspectHostsCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for isTlsEnabled
     * @param clusterName The name of the cluster (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 isTlsEnabledCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/isTlsEnabled"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 isTlsEnabledValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling isTlsEnabled(Async)");
        }

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

    }

    /**
     * Returns whether a cluster has any TLS settings enabled.
     * Returns whether a cluster has any TLS settings enabled. This only checks settings that would have been enabled by Auto-TLS.
     * @param clusterName The name of the cluster (required)
     * @return Boolean
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Boolean isTlsEnabled(String clusterName) throws ApiException {
        ApiResponse<Boolean> resp = isTlsEnabledWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Returns whether a cluster has any TLS settings enabled.
     * Returns whether a cluster has any TLS settings enabled. This only checks settings that would have been enabled by Auto-TLS.
     * @param clusterName The name of the cluster (required)
     * @return ApiResponse&lt;Boolean&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<Boolean> isTlsEnabledWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = isTlsEnabledValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<Boolean>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns whether a cluster has any TLS settings enabled. (asynchronously)
     * Returns whether a cluster has any TLS settings enabled. This only checks settings that would have been enabled by Auto-TLS.
     * @param clusterName The name of the cluster (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 isTlsEnabledAsync(String clusterName, final ApiCallback<Boolean> 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 = isTlsEnabledValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<Boolean>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for listActiveCommands
     * @param clusterName The cluster to which the role belongs. (required)
     * @param commandName the command name, unique for the command class RestartClusterCommand#COMMAND_NAME (optional)
     * @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 listActiveCommandsCall(String clusterName, String commandName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (commandName != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("commandName", commandName));
        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 listActiveCommandsValidateBeforeCall(String clusterName, String commandName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling listActiveCommands(Async)");
        }

        okhttp3.Call call = listActiveCommandsCall(clusterName, commandName, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * List active cluster commands.
     * List active cluster commands.
     * @param clusterName The cluster to which the role belongs. (required)
     * @param commandName the command name, unique for the command class RestartClusterCommand#COMMAND_NAME (optional)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiCommandList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommandList listActiveCommands(String clusterName, String commandName, String view) throws ApiException {
        ApiResponse<ApiCommandList> resp = listActiveCommandsWithHttpInfo(clusterName, commandName, view);
        return resp.getData();
    }

    /**
     * List active cluster commands.
     * List active cluster commands.
     * @param clusterName The cluster to which the role belongs. (required)
     * @param commandName the command name, unique for the command class RestartClusterCommand#COMMAND_NAME (optional)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiResponse&lt;ApiCommandList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCommandList> listActiveCommandsWithHttpInfo(String clusterName, String commandName, String view) throws ApiException {
        okhttp3.Call call = listActiveCommandsValidateBeforeCall(clusterName, commandName, view, null, null);
        Type localVarReturnType = new TypeToken<ApiCommandList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List active cluster commands. (asynchronously)
     * List active cluster commands.
     * @param clusterName The cluster to which the role belongs. (required)
     * @param commandName the command name, unique for the command class RestartClusterCommand#COMMAND_NAME (optional)
     * @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 listActiveCommandsAsync(String clusterName, String commandName, String view, final ApiCallback<ApiCommandList> 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 = listActiveCommandsValidateBeforeCall(clusterName, commandName, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommandList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for listDfsServices
     * @param clusterName cluster name (required)
     * @param view data view required for matching services (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 listDfsServicesCall(String clusterName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/dfsServices"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 listDfsServicesValidateBeforeCall(String clusterName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling listDfsServices(Async)");
        }

        okhttp3.Call call = listDfsServicesCall(clusterName, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * List the services that can provide distributed file system (DFS) capabilities in this cluster.
     * List the services that can provide distributed file system (DFS) capabilities in this cluster.
     * @param clusterName cluster name (required)
     * @param view data view required for matching services (optional, default to summary)
     * @return ApiServiceList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiServiceList listDfsServices(String clusterName, String view) throws ApiException {
        ApiResponse<ApiServiceList> resp = listDfsServicesWithHttpInfo(clusterName, view);
        return resp.getData();
    }

    /**
     * List the services that can provide distributed file system (DFS) capabilities in this cluster.
     * List the services that can provide distributed file system (DFS) capabilities in this cluster.
     * @param clusterName cluster name (required)
     * @param view data view required for matching services (optional, default to summary)
     * @return ApiResponse&lt;ApiServiceList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiServiceList> listDfsServicesWithHttpInfo(String clusterName, String view) throws ApiException {
        okhttp3.Call call = listDfsServicesValidateBeforeCall(clusterName, view, null, null);
        Type localVarReturnType = new TypeToken<ApiServiceList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List the services that can provide distributed file system (DFS) capabilities in this cluster. (asynchronously)
     * List the services that can provide distributed file system (DFS) capabilities in this cluster.
     * @param clusterName cluster name (required)
     * @param view data view required for matching services (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 listDfsServicesAsync(String clusterName, String view, final ApiCallback<ApiServiceList> 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 = listDfsServicesValidateBeforeCall(clusterName, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiServiceList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for listHosts
     * @param clusterName Name of the cluster (required)
     * @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 listHostsCall(String clusterName, 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 = "/clusters/{clusterName}/hosts"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()));

        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 listHostsValidateBeforeCall(String clusterName, String configName, String configValue, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling listHosts(Async)");
        }

        okhttp3.Call call = listHostsCall(clusterName, 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 clusterName Name of the cluster (required)
     * @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 listHosts(String clusterName, String configName, String configValue, String view) throws ApiException {
        ApiResponse<ApiHostList> resp = listHostsWithHttpInfo(clusterName, 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 clusterName Name of the cluster (required)
     * @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> listHostsWithHttpInfo(String clusterName, String configName, String configValue, String view) throws ApiException {
        okhttp3.Call call = listHostsValidateBeforeCall(clusterName, 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 clusterName Name of the cluster (required)
     * @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 listHostsAsync(String clusterName, 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 = listHostsValidateBeforeCall(clusterName, configName, configValue, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for listServiceTypes
     * @param clusterName The cluster. (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 listServiceTypesCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/serviceTypes"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 listServiceTypesValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling listServiceTypes(Async)");
        }

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

    }

    /**
     * List the supported service types for a cluster.
     * List the supported service types for a cluster.
     * @param clusterName The cluster. (required)
     * @return ApiServiceTypeList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiServiceTypeList listServiceTypes(String clusterName) throws ApiException {
        ApiResponse<ApiServiceTypeList> resp = listServiceTypesWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * List the supported service types for a cluster.
     * List the supported service types for a cluster.
     * @param clusterName The cluster. (required)
     * @return ApiResponse&lt;ApiServiceTypeList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiServiceTypeList> listServiceTypesWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = listServiceTypesValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiServiceTypeList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List the supported service types for a cluster. (asynchronously)
     * List the supported service types for a cluster.
     * @param clusterName The cluster. (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 listServiceTypesAsync(String clusterName, final ApiCallback<ApiServiceTypeList> 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 = listServiceTypesValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiServiceTypeList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for listUpgradeDomains
     * @param clusterName The name of the cluster. (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 listUpgradeDomainsCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/upgradeDomains"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 listUpgradeDomainsValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling listUpgradeDomains(Async)");
        }

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

    }

    /**
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain.
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain. Hosts without an Upgrade Domain set will default to using the rack assignment of the host.
     * @param clusterName The name of the cluster. (required)
     * @return ApiHdfsUpgradeDomainList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHdfsUpgradeDomainList listUpgradeDomains(String clusterName) throws ApiException {
        ApiResponse<ApiHdfsUpgradeDomainList> resp = listUpgradeDomainsWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain.
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain. Hosts without an Upgrade Domain set will default to using the rack assignment of the host.
     * @param clusterName The name of the cluster. (required)
     * @return ApiResponse&lt;ApiHdfsUpgradeDomainList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHdfsUpgradeDomainList> listUpgradeDomainsWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = listUpgradeDomainsValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiHdfsUpgradeDomainList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain. (asynchronously)
     * Returns the Upgrade Domains associated with the cluster and the host names that belong to each Upgrade Domain. Hosts without an Upgrade Domain set will default to using the rack assignment of the host.
     * @param clusterName The name of the cluster. (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 listUpgradeDomainsAsync(String clusterName, final ApiCallback<ApiHdfsUpgradeDomainList> 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 = listUpgradeDomainsValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHdfsUpgradeDomainList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for perfInspectorCommand
     * @param clusterName The name of the cluster. (required)
     * @param body Optional arguments for the command. See ApiClusterPerfInspectorArgs. (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 perfInspectorCommandCall(String clusterName, ApiClusterPerfInspectorArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/perfInspector"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 perfInspectorCommandValidateBeforeCall(String clusterName, ApiClusterPerfInspectorArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling perfInspectorCommand(Async)");
        }

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

    }

    /**
     * Run cluster performance diagnostics test.
     * Run cluster performance diagnostics test.
     * @param clusterName The name of the cluster. (required)
     * @param body Optional arguments for the command. See ApiClusterPerfInspectorArgs. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand perfInspectorCommand(String clusterName, ApiClusterPerfInspectorArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = perfInspectorCommandWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Run cluster performance diagnostics test.
     * Run cluster performance diagnostics test.
     * @param clusterName The name of the cluster. (required)
     * @param body Optional arguments for the command. See ApiClusterPerfInspectorArgs. (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> perfInspectorCommandWithHttpInfo(String clusterName, ApiClusterPerfInspectorArgs body) throws ApiException {
        okhttp3.Call call = perfInspectorCommandValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Run cluster performance diagnostics test. (asynchronously)
     * Run cluster performance diagnostics test.
     * @param clusterName The name of the cluster. (required)
     * @param body Optional arguments for the command. See ApiClusterPerfInspectorArgs. (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 perfInspectorCommandAsync(String clusterName, ApiClusterPerfInspectorArgs 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 = perfInspectorCommandValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for poolsRefresh
     * @param clusterName The name of the cluster (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 poolsRefreshCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/poolsRefresh"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 poolsRefreshValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling poolsRefresh(Async)");
        }

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

    }

    /**
     * Updates all refreshable configuration files for services with Dynamic Resource Pools.
     * Updates all refreshable configuration files for services with Dynamic Resource Pools. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand poolsRefresh(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = poolsRefreshWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Updates all refreshable configuration files for services with Dynamic Resource Pools.
     * Updates all refreshable configuration files for services with Dynamic Resource Pools. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (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> poolsRefreshWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = poolsRefreshValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates all refreshable configuration files for services with Dynamic Resource Pools. (asynchronously)
     * Updates all refreshable configuration files for services with Dynamic Resource Pools. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (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 poolsRefreshAsync(String clusterName, 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 = poolsRefreshValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for postClouderaRuntimeUpgrade
     * @param clusterName  (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 postClouderaRuntimeUpgradeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/postClouderaRuntimeUpgrade"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 postClouderaRuntimeUpgradeValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling postClouderaRuntimeUpgrade(Async)");
        }

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

    }

    /**
     * Post Cloudera Runtime upgrade API.
     * Post Cloudera Runtime upgrade API. &lt;p&gt; This API executes special finalization tasks (already part of regular CDH upgrade) after the installation of an updated build of Cloudera Runtime (no version change). No version change of Cloudera Rumtime means when first 3 digits of build remains the same (e.g. from 7.2.1.a to 7.2.1.b) during upgrade. Purpose of this is to automate manual tasks of CDH upgrade. &lt;p&gt;
     * @param clusterName  (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand postClouderaRuntimeUpgrade(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = postClouderaRuntimeUpgradeWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Post Cloudera Runtime upgrade API.
     * Post Cloudera Runtime upgrade API. &lt;p&gt; This API executes special finalization tasks (already part of regular CDH upgrade) after the installation of an updated build of Cloudera Runtime (no version change). No version change of Cloudera Rumtime means when first 3 digits of build remains the same (e.g. from 7.2.1.a to 7.2.1.b) during upgrade. Purpose of this is to automate manual tasks of CDH upgrade. &lt;p&gt;
     * @param clusterName  (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> postClouderaRuntimeUpgradeWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = postClouderaRuntimeUpgradeValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Post Cloudera Runtime upgrade API. (asynchronously)
     * Post Cloudera Runtime upgrade API. &lt;p&gt; This API executes special finalization tasks (already part of regular CDH upgrade) after the installation of an updated build of Cloudera Runtime (no version change). No version change of Cloudera Rumtime means when first 3 digits of build remains the same (e.g. from 7.2.1.a to 7.2.1.b) during upgrade. Purpose of this is to automate manual tasks of CDH upgrade. &lt;p&gt;
     * @param clusterName  (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 postClouderaRuntimeUpgradeAsync(String clusterName, 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 = postClouderaRuntimeUpgradeValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for preUpgradeCheckCommand
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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 preUpgradeCheckCommandCall(String clusterName, ApiCdhUpgradeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/preUpgradeCheck"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 preUpgradeCheckCommandValidateBeforeCall(String clusterName, ApiCdhUpgradeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling preUpgradeCheckCommand(Async)");
        }

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

    }

    /**
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other.
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other. &lt;p&gt; Allows the following upgrade checks: &lt;ul&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Major upgrades from any CDH 5 to any CDH 6&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 6 to any CDH 6&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt;
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand preUpgradeCheckCommand(String clusterName, ApiCdhUpgradeArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = preUpgradeCheckCommandWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other.
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other. &lt;p&gt; Allows the following upgrade checks: &lt;ul&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Major upgrades from any CDH 5 to any CDH 6&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 6 to any CDH 6&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt;
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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> preUpgradeCheckCommandWithHttpInfo(String clusterName, ApiCdhUpgradeArgs body) throws ApiException {
        okhttp3.Call call = preUpgradeCheckCommandValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other. (asynchronously)
     * Run cluster pre-upgrade check(s) when upgrading from specified version of CDH to the other. &lt;p&gt; Allows the following upgrade checks: &lt;ul&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Major upgrades from any CDH 5 to any CDH 6&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 6 to any CDH 6&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt;
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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 preUpgradeCheckCommandAsync(String clusterName, ApiCdhUpgradeArgs 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 = preUpgradeCheckCommandValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readCluster
     * @param clusterName Name of cluster to look up. (required)
     * @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 readClusterCall(String clusterName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 readClusterValidateBeforeCall(String clusterName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling readCluster(Async)");
        }

        okhttp3.Call call = readClusterCall(clusterName, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Reads information about a cluster.
     * Reads information about a cluster.
     * @param clusterName Name of cluster to look up. (required)
     * @param view The view to materialize (optional, default to summary)
     * @return ApiCluster
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCluster readCluster(String clusterName, String view) throws ApiException {
        ApiResponse<ApiCluster> resp = readClusterWithHttpInfo(clusterName, view);
        return resp.getData();
    }

    /**
     * Reads information about a cluster.
     * Reads information about a cluster.
     * @param clusterName Name of cluster to look up. (required)
     * @param view The view to materialize (optional, default to summary)
     * @return ApiResponse&lt;ApiCluster&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCluster> readClusterWithHttpInfo(String clusterName, String view) throws ApiException {
        okhttp3.Call call = readClusterValidateBeforeCall(clusterName, view, null, null);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Reads information about a cluster. (asynchronously)
     * Reads information about a cluster.
     * @param clusterName Name of cluster to look up. (required)
     * @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 readClusterAsync(String clusterName, String view, final ApiCallback<ApiCluster> 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 = readClusterValidateBeforeCall(clusterName, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readClusters
     * @param clusterType Type of cluster, either \&quot;any\&quot;, \&quot;base\&quot;, \&quot;compute\&quot; or \&quot;experience\&quot;. Default is \&quot;base\&quot;. (optional, default to base)
     * @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 readClustersCall(String clusterType, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        if (clusterType != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("clusterType", clusterType));
        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 readClustersValidateBeforeCall(String clusterType, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {

        okhttp3.Call call = readClustersCall(clusterType, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * List all known clusters.
     * List all known clusters.
     * @param clusterType Type of cluster, either \&quot;any\&quot;, \&quot;base\&quot;, \&quot;compute\&quot; or \&quot;experience\&quot;. Default is \&quot;base\&quot;. (optional, default to base)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiClusterList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiClusterList readClusters(String clusterType, String view) throws ApiException {
        ApiResponse<ApiClusterList> resp = readClustersWithHttpInfo(clusterType, view);
        return resp.getData();
    }

    /**
     * List all known clusters.
     * List all known clusters.
     * @param clusterType Type of cluster, either \&quot;any\&quot;, \&quot;base\&quot;, \&quot;compute\&quot; or \&quot;experience\&quot;. Default is \&quot;base\&quot;. (optional, default to base)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiResponse&lt;ApiClusterList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiClusterList> readClustersWithHttpInfo(String clusterType, String view) throws ApiException {
        okhttp3.Call call = readClustersValidateBeforeCall(clusterType, view, null, null);
        Type localVarReturnType = new TypeToken<ApiClusterList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List all known clusters. (asynchronously)
     * List all known clusters.
     * @param clusterType Type of cluster, either \&quot;any\&quot;, \&quot;base\&quot;, \&quot;compute\&quot; or \&quot;experience\&quot;. Default is \&quot;base\&quot;. (optional, default to base)
     * @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 readClustersAsync(String clusterType, String view, final ApiCallback<ApiClusterList> 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 = readClustersValidateBeforeCall(clusterType, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiClusterList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readTags
     * @param clusterName The name of the cluster (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 clusterName, 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 = "/clusters/{clusterName}/tags"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 clusterName, java.math.BigDecimal limit, java.math.BigDecimal offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling readTags(Async)");
        }

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

    }

    /**
     * Returns the tags associated with this cluster.
     * Returns the tags associated with this cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName The name of the cluster (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 clusterName, java.math.BigDecimal limit, java.math.BigDecimal offset) throws ApiException {
        ApiResponse<List<ApiEntityTag>> resp = readTagsWithHttpInfo(clusterName, limit, offset);
        return resp.getData();
    }

    /**
     * Returns the tags associated with this cluster.
     * Returns the tags associated with this cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName The name of the cluster (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 clusterName, java.math.BigDecimal limit, java.math.BigDecimal offset) throws ApiException {
        okhttp3.Call call = readTagsValidateBeforeCall(clusterName, limit, offset, null, null);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the tags associated with this cluster. (asynchronously)
     * Returns the tags associated with this cluster. Tag names beginning with the prefix _cldr_ (case insensitive) are reserved for internal use by Cloudera.
     * @param clusterName The name of the cluster (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 clusterName, 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(clusterName, limit, offset, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<List<ApiEntityTag>>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for refresh
     * @param clusterName The name of the cluster (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 refreshCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/refresh"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 refreshValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling refresh(Async)");
        }

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

    }

    /**
     * Updates all refreshable configuration files in the cluster.
     * Updates all refreshable configuration files in the cluster. Will not restart any roles. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand refresh(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = refreshWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Updates all refreshable configuration files in the cluster.
     * Updates all refreshable configuration files in the cluster. Will not restart any roles. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (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> refreshWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = refreshValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates all refreshable configuration files in the cluster. (asynchronously)
     * Updates all refreshable configuration files in the cluster. Will not restart any roles. &lt;p&gt; Available since API v6.
     * @param clusterName The name of the cluster (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 refreshAsync(String clusterName, 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 = refreshValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for removeAllHosts
     * @param clusterName  (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 removeAllHostsCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/hosts"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 removeAllHostsValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling removeAllHosts(Async)");
        }

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

    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @return ApiHostRefList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostRefList removeAllHosts(String clusterName) throws ApiException {
        ApiResponse<ApiHostRefList> resp = removeAllHostsWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @return ApiResponse&lt;ApiHostRefList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostRefList> removeAllHostsWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = removeAllHostsValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiHostRefList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param clusterName  (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 removeAllHostsAsync(String clusterName, final ApiCallback<ApiHostRefList> 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 = removeAllHostsValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostRefList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for removeHost
     * @param clusterName  (required)
     * @param hostId  (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 removeHostCall(String clusterName, String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/hosts/{hostId}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .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 removeHostValidateBeforeCall(String clusterName, String hostId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling removeHost(Async)");
        }
        // verify the required parameter 'hostId' is set
        if (hostId == null) {
            throw new ApiException("Missing the required parameter 'hostId' when calling removeHost(Async)");
        }

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

    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @param hostId  (required)
     * @return ApiHostRef
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiHostRef removeHost(String clusterName, String hostId) throws ApiException {
        ApiResponse<ApiHostRef> resp = removeHostWithHttpInfo(clusterName, hostId);
        return resp.getData();
    }

    /**
     * 
     * 
     * @param clusterName  (required)
     * @param hostId  (required)
     * @return ApiResponse&lt;ApiHostRef&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiHostRef> removeHostWithHttpInfo(String clusterName, String hostId) throws ApiException {
        okhttp3.Call call = removeHostValidateBeforeCall(clusterName, hostId, null, null);
        Type localVarReturnType = new TypeToken<ApiHostRef>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     *  (asynchronously)
     * 
     * @param clusterName  (required)
     * @param hostId  (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 removeHostAsync(String clusterName, String hostId, final ApiCallback<ApiHostRef> 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 = removeHostValidateBeforeCall(clusterName, hostId, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiHostRef>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for restartCommand
     * @param clusterName The name of the cluster. (required)
     * @param body arguments for the restart 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 restartCommandCall(String clusterName, ApiRestartClusterArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/restart"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 restartCommandValidateBeforeCall(String clusterName, ApiRestartClusterArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling restartCommand(Async)");
        }

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

    }

    /**
     * Restart all services in the cluster.
     * Restart all services in the cluster. &lt;p&gt; Services are stopped then started in the appropriate order given their dependencies. The command can optionally restart only stale services and their dependencies as well as redeploy client configuration on all services in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body arguments for the restart command. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand restartCommand(String clusterName, ApiRestartClusterArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = restartCommandWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Restart all services in the cluster.
     * Restart all services in the cluster. &lt;p&gt; Services are stopped then started in the appropriate order given their dependencies. The command can optionally restart only stale services and their dependencies as well as redeploy client configuration on all services in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body arguments for the restart 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> restartCommandWithHttpInfo(String clusterName, ApiRestartClusterArgs body) throws ApiException {
        okhttp3.Call call = restartCommandValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Restart all services in the cluster. (asynchronously)
     * Restart all services in the cluster. &lt;p&gt; Services are stopped then started in the appropriate order given their dependencies. The command can optionally restart only stale services and their dependencies as well as redeploy client configuration on all services in the cluster.
     * @param clusterName The name of the cluster. (required)
     * @param body arguments for the restart 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 restartCommandAsync(String clusterName, ApiRestartClusterArgs 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 = restartCommandValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for rollingRestart
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling restart 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 rollingRestartCall(String clusterName, ApiRollingRestartClusterArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/rollingRestart"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 rollingRestartValidateBeforeCall(String clusterName, ApiRollingRestartClusterArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling rollingRestart(Async)");
        }

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

    }

    /**
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i.
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i.e. it does plain restart of services that cannot be rolling restarted, followed by first rolling restarting non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since API v4. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling restart command. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand rollingRestart(String clusterName, ApiRollingRestartClusterArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = rollingRestartWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i.
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i.e. it does plain restart of services that cannot be rolling restarted, followed by first rolling restarting non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since API v4. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling restart 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> rollingRestartWithHttpInfo(String clusterName, ApiRollingRestartClusterArgs body) throws ApiException {
        okhttp3.Call call = rollingRestartValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i. (asynchronously)
     * Command to do a \&quot;best-effort\&quot; rolling restart of the given cluster, i.e. it does plain restart of services that cannot be rolling restarted, followed by first rolling restarting non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since API v4. Only available with Cloudera Manager Enterprise Edition.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling restart 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 rollingRestartAsync(String clusterName, ApiRollingRestartClusterArgs 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 = rollingRestartValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for rollingUpgrade
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling upgrade 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 rollingUpgradeCall(String clusterName, ApiRollingUpgradeServicesArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/rollingUpgrade"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 rollingUpgradeValidateBeforeCall(String clusterName, ApiRollingUpgradeServicesArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling rollingUpgrade(Async)");
        }

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

    }

    /**
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades.
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades. The command will throw an error and not start if upgrade of any such service is requested.  This command does not upgrade the full CDH Cluster. You should normally use the upgradeCDH Command for upgrading the cluster. This is primarily helpful if you need to need to recover from an upgrade failure or for advanced users to script an alternative to the upgradeCdhCommand.  This command expects the binaries to be available on hosts and activated. It does not change any binaries on the hosts.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling upgrade command. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand rollingUpgrade(String clusterName, ApiRollingUpgradeServicesArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = rollingUpgradeWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades.
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades. The command will throw an error and not start if upgrade of any such service is requested.  This command does not upgrade the full CDH Cluster. You should normally use the upgradeCDH Command for upgrading the cluster. This is primarily helpful if you need to need to recover from an upgrade failure or for advanced users to script an alternative to the upgradeCdhCommand.  This command expects the binaries to be available on hosts and activated. It does not change any binaries on the hosts.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling upgrade 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> rollingUpgradeWithHttpInfo(String clusterName, ApiRollingUpgradeServicesArgs body) throws ApiException {
        okhttp3.Call call = rollingUpgradeValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades. (asynchronously)
     * Command to do a rolling upgrade of specific services in the given cluster  This command does not handle any services that don&#x27;t support rolling upgrades. The command will throw an error and not start if upgrade of any such service is requested.  This command does not upgrade the full CDH Cluster. You should normally use the upgradeCDH Command for upgrading the cluster. This is primarily helpful if you need to need to recover from an upgrade failure or for advanced users to script an alternative to the upgradeCdhCommand.  This command expects the binaries to be available on hosts and activated. It does not change any binaries on the hosts.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the rolling upgrade 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 rollingUpgradeAsync(String clusterName, ApiRollingUpgradeServicesArgs 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 = rollingUpgradeValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for runOzoneCommand
     * @param clusterName The cluster to which the role belongs. (required)
     * @param bucketName name of the Ozone bucket (optional)
     * @param commandName The command to run on an Ozone Role. (optional)
     * @param volumeName name of the Ozone volume (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 runOzoneCommandCall(String clusterName, String bucketName, String commandName, String volumeName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

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

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

        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 runOzoneCommandValidateBeforeCall(String clusterName, String bucketName, String commandName, String volumeName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling runOzoneCommand(Async)");
        }

        okhttp3.Call call = runOzoneCommandCall(clusterName, bucketName, commandName, volumeName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Executes an Ozone shell command on an Ozone Role.
     * Executes an Ozone shell command on an Ozone Role. The command needs to be defined as a RoleCommand in CM (Eg GetOzoneBucketInfoCommand).
     * @param clusterName The cluster to which the role belongs. (required)
     * @param bucketName name of the Ozone bucket (optional)
     * @param commandName The command to run on an Ozone Role. (optional)
     * @param volumeName name of the Ozone volume (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand runOzoneCommand(String clusterName, String bucketName, String commandName, String volumeName) throws ApiException {
        ApiResponse<ApiCommand> resp = runOzoneCommandWithHttpInfo(clusterName, bucketName, commandName, volumeName);
        return resp.getData();
    }

    /**
     * Executes an Ozone shell command on an Ozone Role.
     * Executes an Ozone shell command on an Ozone Role. The command needs to be defined as a RoleCommand in CM (Eg GetOzoneBucketInfoCommand).
     * @param clusterName The cluster to which the role belongs. (required)
     * @param bucketName name of the Ozone bucket (optional)
     * @param commandName The command to run on an Ozone Role. (optional)
     * @param volumeName name of the Ozone volume (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> runOzoneCommandWithHttpInfo(String clusterName, String bucketName, String commandName, String volumeName) throws ApiException {
        okhttp3.Call call = runOzoneCommandValidateBeforeCall(clusterName, bucketName, commandName, volumeName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Executes an Ozone shell command on an Ozone Role. (asynchronously)
     * Executes an Ozone shell command on an Ozone Role. The command needs to be defined as a RoleCommand in CM (Eg GetOzoneBucketInfoCommand).
     * @param clusterName The cluster to which the role belongs. (required)
     * @param bucketName name of the Ozone bucket (optional)
     * @param commandName The command to run on an Ozone Role. (optional)
     * @param volumeName name of the Ozone volume (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 runOzoneCommandAsync(String clusterName, String bucketName, String commandName, String volumeName, 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 = runOzoneCommandValidateBeforeCall(clusterName, bucketName, commandName, volumeName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for runSpecificHostInspectionsCommand
     * @param clusterName the name of the cluster you want to run the host inspections (required)
     * @param body An object that contains the name of the list of inspections to be run. (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 runSpecificHostInspectionsCommandCall(String clusterName, ApiRunSpecificHostInspectionsArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/runSpecificHostInspections"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 runSpecificHostInspectionsCommandValidateBeforeCall(String clusterName, ApiRunSpecificHostInspectionsArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling runSpecificHostInspectionsCommand(Async)");
        }

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

    }

    /**
     * Runs a specific list of host inspections.
     * Runs a specific list of host inspections. &lt;p&gt; This command runs the ClusterInspectorCommand, which runs the host inspections for all the hosts in a cluster. More specifically, this command will run a specific list of host inspections specified by the user. If no host inspection list name is provided, the default list of inspections will be ran. &lt;/p&gt;
     * @param clusterName the name of the cluster you want to run the host inspections (required)
     * @param body An object that contains the name of the list of inspections to be run. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand runSpecificHostInspectionsCommand(String clusterName, ApiRunSpecificHostInspectionsArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = runSpecificHostInspectionsCommandWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Runs a specific list of host inspections.
     * Runs a specific list of host inspections. &lt;p&gt; This command runs the ClusterInspectorCommand, which runs the host inspections for all the hosts in a cluster. More specifically, this command will run a specific list of host inspections specified by the user. If no host inspection list name is provided, the default list of inspections will be ran. &lt;/p&gt;
     * @param clusterName the name of the cluster you want to run the host inspections (required)
     * @param body An object that contains the name of the list of inspections to be run. (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> runSpecificHostInspectionsCommandWithHttpInfo(String clusterName, ApiRunSpecificHostInspectionsArgs body) throws ApiException {
        okhttp3.Call call = runSpecificHostInspectionsCommandValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Runs a specific list of host inspections. (asynchronously)
     * Runs a specific list of host inspections. &lt;p&gt; This command runs the ClusterInspectorCommand, which runs the host inspections for all the hosts in a cluster. More specifically, this command will run a specific list of host inspections specified by the user. If no host inspection list name is provided, the default list of inspections will be ran. &lt;/p&gt;
     * @param clusterName the name of the cluster you want to run the host inspections (required)
     * @param body An object that contains the name of the list of inspections to be run. (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 runSpecificHostInspectionsCommandAsync(String clusterName, ApiRunSpecificHostInspectionsArgs 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 = runSpecificHostInspectionsCommandValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for startCommand
     * @param clusterName The name of the cluster. (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 startCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/start"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 startCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling startCommand(Async)");
        }

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

    }

    /**
     * Start all services in the cluster.
     * Start all services in the cluster. &lt;p&gt; Services are started in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand startCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = startCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Start all services in the cluster.
     * Start all services in the cluster. &lt;p&gt; Services are started in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (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> startCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = startCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Start all services in the cluster. (asynchronously)
     * Start all services in the cluster. &lt;p&gt; Services are started in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (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 startCommandAsync(String clusterName, 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 = startCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for stopCommand
     * @param clusterName The name of the cluster. (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 stopCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/stop"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 stopCommandValidateBeforeCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling stopCommand(Async)");
        }

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

    }

    /**
     * Stop all services in the cluster.
     * Stop all services in the cluster. &lt;p&gt; Services are stopped in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand stopCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = stopCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Stop all services in the cluster.
     * Stop all services in the cluster. &lt;p&gt; Services are stopped in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (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> stopCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = stopCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Stop all services in the cluster. (asynchronously)
     * Stop all services in the cluster. &lt;p&gt; Services are stopped in the appropriate order given their dependencies.
     * @param clusterName The name of the cluster. (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 stopCommandAsync(String clusterName, 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 = stopCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for tearDownWorkloadCluster
     * @param clusterName The name of the cluster. (required)
     * @param workloadClusterName The name of the workload cluster. (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 tearDownWorkloadClusterCall(String clusterName, String workloadClusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/tearDownWorkload/{workloadClusterName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "workloadClusterName" + "\\}", apiClient.escapeString(workloadClusterName.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 tearDownWorkloadClusterValidateBeforeCall(String clusterName, String workloadClusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling tearDownWorkloadCluster(Async)");
        }
        // verify the required parameter 'workloadClusterName' is set
        if (workloadClusterName == null) {
            throw new ApiException("Missing the required parameter 'workloadClusterName' when calling tearDownWorkloadCluster(Async)");
        }

        okhttp3.Call call = tearDownWorkloadClusterCall(clusterName, workloadClusterName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Tear Down Workload cluster.
     * Tear Down Workload cluster. &lt;p&gt; Tear Down Ranger plugin service (repository) associated with the workload cluster.
     * @param clusterName The name of the cluster. (required)
     * @param workloadClusterName The name of the workload cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand tearDownWorkloadCluster(String clusterName, String workloadClusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = tearDownWorkloadClusterWithHttpInfo(clusterName, workloadClusterName);
        return resp.getData();
    }

    /**
     * Tear Down Workload cluster.
     * Tear Down Workload cluster. &lt;p&gt; Tear Down Ranger plugin service (repository) associated with the workload cluster.
     * @param clusterName The name of the cluster. (required)
     * @param workloadClusterName The name of the workload cluster. (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> tearDownWorkloadClusterWithHttpInfo(String clusterName, String workloadClusterName) throws ApiException {
        okhttp3.Call call = tearDownWorkloadClusterValidateBeforeCall(clusterName, workloadClusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Tear Down Workload cluster. (asynchronously)
     * Tear Down Workload cluster. &lt;p&gt; Tear Down Ranger plugin service (repository) associated with the workload cluster.
     * @param clusterName The name of the cluster. (required)
     * @param workloadClusterName The name of the workload cluster. (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 tearDownWorkloadClusterAsync(String clusterName, String workloadClusterName, 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 = tearDownWorkloadClusterValidateBeforeCall(clusterName, workloadClusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateCluster
     * @param clusterName The name of the cluster. (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 updateClusterCall(String clusterName, ApiCluster body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 updateClusterValidateBeforeCall(String clusterName, ApiCluster body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling updateCluster(Async)");
        }

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

    }

    /**
     * Update an existing cluster.
     * Update an existing cluster. &lt;p&gt; To update the CDH version, provide the new value in the \&quot;fullVersion\&quot; property. Setting a correct version that matches the actual installed software will ensure the correct version-specific features, such as services, roles, commands, and configurations. This need not be manually set for clusters using parcels. In general this action is only necessary after the CDH packages have been manually updated. Note that a downgrade may be rejected if it would render existing services or roles unusable. For major upgrade, the \&quot;upgradeService\&quot; cluster command should be used instead.&lt;/p&gt; &lt;p&gt; To rename the cluster, provide the new name in the \&quot;displayName\&quot; property for API &gt;&#x3D; 6, or in the \&quot;name\&quot; property for API &lt;&#x3D;5. &lt;p&gt; Available since API v2.
     * @param clusterName The name of the cluster. (required)
     * @param body  (optional)
     * @return ApiCluster
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCluster updateCluster(String clusterName, ApiCluster body) throws ApiException {
        ApiResponse<ApiCluster> resp = updateClusterWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Update an existing cluster.
     * Update an existing cluster. &lt;p&gt; To update the CDH version, provide the new value in the \&quot;fullVersion\&quot; property. Setting a correct version that matches the actual installed software will ensure the correct version-specific features, such as services, roles, commands, and configurations. This need not be manually set for clusters using parcels. In general this action is only necessary after the CDH packages have been manually updated. Note that a downgrade may be rejected if it would render existing services or roles unusable. For major upgrade, the \&quot;upgradeService\&quot; cluster command should be used instead.&lt;/p&gt; &lt;p&gt; To rename the cluster, provide the new name in the \&quot;displayName\&quot; property for API &gt;&#x3D; 6, or in the \&quot;name\&quot; property for API &lt;&#x3D;5. &lt;p&gt; Available since API v2.
     * @param clusterName The name of the cluster. (required)
     * @param body  (optional)
     * @return ApiResponse&lt;ApiCluster&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiCluster> updateClusterWithHttpInfo(String clusterName, ApiCluster body) throws ApiException {
        okhttp3.Call call = updateClusterValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Update an existing cluster. (asynchronously)
     * Update an existing cluster. &lt;p&gt; To update the CDH version, provide the new value in the \&quot;fullVersion\&quot; property. Setting a correct version that matches the actual installed software will ensure the correct version-specific features, such as services, roles, commands, and configurations. This need not be manually set for clusters using parcels. In general this action is only necessary after the CDH packages have been manually updated. Note that a downgrade may be rejected if it would render existing services or roles unusable. For major upgrade, the \&quot;upgradeService\&quot; cluster command should be used instead.&lt;/p&gt; &lt;p&gt; To rename the cluster, provide the new name in the \&quot;displayName\&quot; property for API &gt;&#x3D; 6, or in the \&quot;name\&quot; property for API &lt;&#x3D;5. &lt;p&gt; Available since API v2.
     * @param clusterName The name of the cluster. (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 updateClusterAsync(String clusterName, ApiCluster body, final ApiCallback<ApiCluster> 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 = updateClusterValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCluster>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for upgradeCdhCommand
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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 upgradeCdhCommandCall(String clusterName, ApiCdhUpgradeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/upgradeCdh"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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 upgradeCdhCommandValidateBeforeCall(String clusterName, ApiCdhUpgradeArgs body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'clusterName' is set
        if (clusterName == null) {
            throw new ApiException("Missing the required parameter 'clusterName' when calling upgradeCdhCommand(Async)");
        }

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

    }

    /**
     * Perform CDH upgrade to the specified version.
     * Perform CDH upgrade to the specified version. &lt;p&gt; Allows the following upgrades: &lt;ul&gt; &lt;li&gt;Major upgrades from any CDH 4 to any CDH 5&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt; &lt;p&gt; If using packages, CDH packages on all hosts of the cluster must be manually upgraded before this command is issued. &lt;p&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution. &lt;p&gt; Unless rolling upgrade options are provided, the entire cluster will experience downtime. If rolling upgrade options are provided, command will do a \&quot;best-effort\&quot; rolling upgrade of the given cluster, i.e. it does plain upgrade of services that cannot be rolling upgraded, followed by first rolling upgrading non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since v9. Rolling upgrade is only available with Cloudera Manager Enterprise Edition. A more limited upgrade variant available since v6.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (optional)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand upgradeCdhCommand(String clusterName, ApiCdhUpgradeArgs body) throws ApiException {
        ApiResponse<ApiCommand> resp = upgradeCdhCommandWithHttpInfo(clusterName, body);
        return resp.getData();
    }

    /**
     * Perform CDH upgrade to the specified version.
     * Perform CDH upgrade to the specified version. &lt;p&gt; Allows the following upgrades: &lt;ul&gt; &lt;li&gt;Major upgrades from any CDH 4 to any CDH 5&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt; &lt;p&gt; If using packages, CDH packages on all hosts of the cluster must be manually upgraded before this command is issued. &lt;p&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution. &lt;p&gt; Unless rolling upgrade options are provided, the entire cluster will experience downtime. If rolling upgrade options are provided, command will do a \&quot;best-effort\&quot; rolling upgrade of the given cluster, i.e. it does plain upgrade of services that cannot be rolling upgraded, followed by first rolling upgrading non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since v9. Rolling upgrade is only available with Cloudera Manager Enterprise Edition. A more limited upgrade variant available since v6.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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> upgradeCdhCommandWithHttpInfo(String clusterName, ApiCdhUpgradeArgs body) throws ApiException {
        okhttp3.Call call = upgradeCdhCommandValidateBeforeCall(clusterName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Perform CDH upgrade to the specified version. (asynchronously)
     * Perform CDH upgrade to the specified version. &lt;p&gt; Allows the following upgrades: &lt;ul&gt; &lt;li&gt;Major upgrades from any CDH 4 to any CDH 5&lt;/li&gt; &lt;li&gt;Minor upgrades from any CDH 5 to any CDH 5&lt;/li&gt; &lt;li&gt;Maintenance upgrades or downgrades (a.b.x to a.b.y)&lt;/li&gt; &lt;/ul&gt; &lt;p&gt; If using packages, CDH packages on all hosts of the cluster must be manually upgraded before this command is issued. &lt;p&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution. &lt;p&gt; Unless rolling upgrade options are provided, the entire cluster will experience downtime. If rolling upgrade options are provided, command will do a \&quot;best-effort\&quot; rolling upgrade of the given cluster, i.e. it does plain upgrade of services that cannot be rolling upgraded, followed by first rolling upgrading non-slaves and then rolling restarting the slave roles of services that can be rolling restarted. The slave restarts are done host-by-host. &lt;p&gt; Available since v9. Rolling upgrade is only available with Cloudera Manager Enterprise Edition. A more limited upgrade variant available since v6.
     * @param clusterName The name of the cluster. (required)
     * @param body Arguments for the command. See ApiCdhUpgradeArgs. (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 upgradeCdhCommandAsync(String clusterName, ApiCdhUpgradeArgs 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 = upgradeCdhCommandValidateBeforeCall(clusterName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for upgradeServicesCommand
     * @param clusterName The name of the cluster. (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 upgradeServicesCommandCall(String clusterName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/commands/upgradeServices"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.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);
    }

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

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

    }

    /**
     * Upgrades the services in the cluster to the CDH5 version.
     * Upgrades the services in the cluster to the CDH5 version. &lt;p&gt; This command requires that the CDH packages in the hosts used by the cluster be upgraded to CDH5 before this command is issued. Once issued, this command will stop all running services before proceeding. &lt;p&gt; If parcels are used instead of CDH system packages then the following steps need to happen in order: &lt;ol&gt; &lt;li&gt;Stop all services manually&lt;/li&gt; &lt;li&gt;Activate parcel&lt;/li&gt; &lt;li&gt;Run this upgrade command&lt;/li&gt; &lt;/ol&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution.
     * @param clusterName The name of the cluster. (required)
     * @return ApiCommand
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiCommand upgradeServicesCommand(String clusterName) throws ApiException {
        ApiResponse<ApiCommand> resp = upgradeServicesCommandWithHttpInfo(clusterName);
        return resp.getData();
    }

    /**
     * Upgrades the services in the cluster to the CDH5 version.
     * Upgrades the services in the cluster to the CDH5 version. &lt;p&gt; This command requires that the CDH packages in the hosts used by the cluster be upgraded to CDH5 before this command is issued. Once issued, this command will stop all running services before proceeding. &lt;p&gt; If parcels are used instead of CDH system packages then the following steps need to happen in order: &lt;ol&gt; &lt;li&gt;Stop all services manually&lt;/li&gt; &lt;li&gt;Activate parcel&lt;/li&gt; &lt;li&gt;Run this upgrade command&lt;/li&gt; &lt;/ol&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution.
     * @param clusterName The name of the cluster. (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> upgradeServicesCommandWithHttpInfo(String clusterName) throws ApiException {
        okhttp3.Call call = upgradeServicesCommandValidateBeforeCall(clusterName, null, null);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Upgrades the services in the cluster to the CDH5 version. (asynchronously)
     * Upgrades the services in the cluster to the CDH5 version. &lt;p&gt; This command requires that the CDH packages in the hosts used by the cluster be upgraded to CDH5 before this command is issued. Once issued, this command will stop all running services before proceeding. &lt;p&gt; If parcels are used instead of CDH system packages then the following steps need to happen in order: &lt;ol&gt; &lt;li&gt;Stop all services manually&lt;/li&gt; &lt;li&gt;Activate parcel&lt;/li&gt; &lt;li&gt;Run this upgrade command&lt;/li&gt; &lt;/ol&gt; The command will upgrade the services and their configuration to the version available in the CDH5 distribution.
     * @param clusterName The name of the cluster. (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 upgradeServicesCommandAsync(String clusterName, 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 = upgradeServicesCommandValidateBeforeCall(clusterName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiCommand>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
