/*
 * Cloudera Manager API
 * <h1>Cloudera Manager API v50</h1>       <p>Introduced in Cloudera Manager 7.8.1</p>       <p><a href=\"http://www.cloudera.com/documentation.html\">Cloudera Product Documentation</a></p>
 *
 * OpenAPI spec version: 7.8.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.ApiConfigList;
import com.cloudera.api.swagger.model.ApiRoleConfigGroup;
import com.cloudera.api.swagger.model.ApiRoleConfigGroupList;
import com.cloudera.api.swagger.model.ApiRoleList;

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

public class MgmtRoleConfigGroupsResourceApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for readConfig
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readConfigCall(String roleConfigGroupName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups/{roleConfigGroupName}/config"
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()));

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        if (view != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "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 com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readConfigValidateBeforeCall(String roleConfigGroupName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readConfig(Async)");
        }
        
        
        com.squareup.okhttp.Call call = readConfigCall(roleConfigGroupName, view, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services.
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiConfigList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiConfigList readConfig(String roleConfigGroupName, String view) throws ApiException {
        ApiResponse<ApiConfigList> resp = readConfigWithHttpInfo(roleConfigGroupName, view);
        return resp.getData();
    }

    /**
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services.
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @return ApiResponse&lt;ApiConfigList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiConfigList> readConfigWithHttpInfo(String roleConfigGroupName, String view) throws ApiException {
        com.squareup.okhttp.Call call = readConfigValidateBeforeCall(roleConfigGroupName, view, null, null);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services. (asynchronously)
     * Returns the current revision of the config for the specified role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public com.squareup.okhttp.Call readConfigAsync(String roleConfigGroupName, String view, final ApiCallback<ApiConfigList> callback) throws ApiException {

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

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

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

        com.squareup.okhttp.Call call = readConfigValidateBeforeCall(roleConfigGroupName, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoleConfigGroup
     * @param roleConfigGroupName The name of the requested group. (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 com.squareup.okhttp.Call readRoleConfigGroupCall(String roleConfigGroupName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups/{roleConfigGroupName}"
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()));

        List<Pair> localVarQueryParams = 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 com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readRoleConfigGroupValidateBeforeCall(String roleConfigGroupName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readRoleConfigGroup(Async)");
        }
        
        
        com.squareup.okhttp.Call call = readRoleConfigGroupCall(roleConfigGroupName, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Returns the information for a given role config group in the Cloudera Management Services.
     * Returns the information for a given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the requested group. (required)
     * @return ApiRoleConfigGroup
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroup readRoleConfigGroup(String roleConfigGroupName) throws ApiException {
        ApiResponse<ApiRoleConfigGroup> resp = readRoleConfigGroupWithHttpInfo(roleConfigGroupName);
        return resp.getData();
    }

    /**
     * Returns the information for a given role config group in the Cloudera Management Services.
     * Returns the information for a given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the requested group. (required)
     * @return ApiResponse&lt;ApiRoleConfigGroup&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiRoleConfigGroup> readRoleConfigGroupWithHttpInfo(String roleConfigGroupName) throws ApiException {
        com.squareup.okhttp.Call call = readRoleConfigGroupValidateBeforeCall(roleConfigGroupName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the information for a given role config group in the Cloudera Management Services. (asynchronously)
     * Returns the information for a given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the requested group. (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 com.squareup.okhttp.Call readRoleConfigGroupAsync(String roleConfigGroupName, final ApiCallback<ApiRoleConfigGroup> 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);
                }
            };
        }

        com.squareup.okhttp.Call call = readRoleConfigGroupValidateBeforeCall(roleConfigGroupName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoleConfigGroups
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public com.squareup.okhttp.Call readRoleConfigGroupsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups";

        List<Pair> localVarQueryParams = 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 com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readRoleConfigGroupsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        
        com.squareup.okhttp.Call call = readRoleConfigGroupsCall(progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Returns the information for all role config groups in the Cloudera Management Services.
     * Returns the information for all role config groups in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @return ApiRoleConfigGroupList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroupList readRoleConfigGroups() throws ApiException {
        ApiResponse<ApiRoleConfigGroupList> resp = readRoleConfigGroupsWithHttpInfo();
        return resp.getData();
    }

    /**
     * Returns the information for all role config groups in the Cloudera Management Services.
     * Returns the information for all role config groups in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @return ApiResponse&lt;ApiRoleConfigGroupList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiRoleConfigGroupList> readRoleConfigGroupsWithHttpInfo() throws ApiException {
        com.squareup.okhttp.Call call = readRoleConfigGroupsValidateBeforeCall(null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the information for all role config groups in the Cloudera Management Services. (asynchronously)
     * Returns the information for all role config groups in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @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 com.squareup.okhttp.Call readRoleConfigGroupsAsync(final ApiCallback<ApiRoleConfigGroupList> 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);
                }
            };
        }

        com.squareup.okhttp.Call call = readRoleConfigGroupsValidateBeforeCall(progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoles
     * @param roleConfigGroupName The name of the role config group. (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 com.squareup.okhttp.Call readRolesCall(String roleConfigGroupName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups/{roleConfigGroupName}/roles"
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()));

        List<Pair> localVarQueryParams = 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 com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call readRolesValidateBeforeCall(String roleConfigGroupName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readRoles(Async)");
        }
        
        
        com.squareup.okhttp.Call call = readRolesCall(roleConfigGroupName, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Returns all roles in the given role config group in the Cloudera Management Services.
     * Returns all roles in the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @return ApiRoleList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleList readRoles(String roleConfigGroupName) throws ApiException {
        ApiResponse<ApiRoleList> resp = readRolesWithHttpInfo(roleConfigGroupName);
        return resp.getData();
    }

    /**
     * Returns all roles in the given role config group in the Cloudera Management Services.
     * Returns all roles in the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @return ApiResponse&lt;ApiRoleList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiRoleList> readRolesWithHttpInfo(String roleConfigGroupName) throws ApiException {
        com.squareup.okhttp.Call call = readRolesValidateBeforeCall(roleConfigGroupName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns all roles in the given role config group in the Cloudera Management Services. (asynchronously)
     * Returns all roles in the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (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 com.squareup.okhttp.Call readRolesAsync(String roleConfigGroupName, final ApiCallback<ApiRoleList> 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);
                }
            };
        }

        com.squareup.okhttp.Call call = readRolesValidateBeforeCall(roleConfigGroupName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateConfig
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param message Optional message describing the changes. (optional)
     * @param body The new config information for the group. (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 com.squareup.okhttp.Call updateConfigCall(String roleConfigGroupName, String message, ApiConfigList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups/{roleConfigGroupName}/config"
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()));

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

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

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

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

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

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updateConfigValidateBeforeCall(String roleConfigGroupName, String message, ApiConfigList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling updateConfig(Async)");
        }
        
        
        com.squareup.okhttp.Call call = updateConfigCall(roleConfigGroupName, message, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Updates the config for the given role config group in the Cloudera Management Services.
     * Updates the config for the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param message Optional message describing the changes. (optional)
     * @param body The new config information for the group. (optional)
     * @return ApiConfigList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiConfigList updateConfig(String roleConfigGroupName, String message, ApiConfigList body) throws ApiException {
        ApiResponse<ApiConfigList> resp = updateConfigWithHttpInfo(roleConfigGroupName, message, body);
        return resp.getData();
    }

    /**
     * Updates the config for the given role config group in the Cloudera Management Services.
     * Updates the config for the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param message Optional message describing the changes. (optional)
     * @param body The new config information for the group. (optional)
     * @return ApiResponse&lt;ApiConfigList&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiConfigList> updateConfigWithHttpInfo(String roleConfigGroupName, String message, ApiConfigList body) throws ApiException {
        com.squareup.okhttp.Call call = updateConfigValidateBeforeCall(roleConfigGroupName, message, body, null, null);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates the config for the given role config group in the Cloudera Management Services. (asynchronously)
     * Updates the config for the given role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param message Optional message describing the changes. (optional)
     * @param body The new config information for the group. (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 com.squareup.okhttp.Call updateConfigAsync(String roleConfigGroupName, String message, ApiConfigList body, final ApiCallback<ApiConfigList> callback) throws ApiException {

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

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

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

        com.squareup.okhttp.Call call = updateConfigValidateBeforeCall(roleConfigGroupName, message, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateRoleConfigGroup
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param message The optional message describing the changes. (optional)
     * @param body The updated role config group. (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 com.squareup.okhttp.Call updateRoleConfigGroupCall(String roleConfigGroupName, String message, ApiRoleConfigGroup body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;
        
        // create path and map variables
        String localVarPath = "/cm/service/roleConfigGroups/{roleConfigGroupName}"
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()));

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

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

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

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

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

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
                @Override
                public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
                    com.squareup.okhttp.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, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }
    
    @SuppressWarnings("rawtypes")
    private com.squareup.okhttp.Call updateRoleConfigGroupValidateBeforeCall(String roleConfigGroupName, String message, ApiRoleConfigGroup body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling updateRoleConfigGroup(Async)");
        }
        
        
        com.squareup.okhttp.Call call = updateRoleConfigGroupCall(roleConfigGroupName, message, body, progressListener, progressRequestListener);
        return call;

        
        
        
        
    }

    /**
     * Updates an existing role config group in the Cloudera Management Services.
     * Updates an existing role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param message The optional message describing the changes. (optional)
     * @param body The updated role config group. (optional)
     * @return ApiRoleConfigGroup
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroup updateRoleConfigGroup(String roleConfigGroupName, String message, ApiRoleConfigGroup body) throws ApiException {
        ApiResponse<ApiRoleConfigGroup> resp = updateRoleConfigGroupWithHttpInfo(roleConfigGroupName, message, body);
        return resp.getData();
    }

    /**
     * Updates an existing role config group in the Cloudera Management Services.
     * Updates an existing role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param message The optional message describing the changes. (optional)
     * @param body The updated role config group. (optional)
     * @return ApiResponse&lt;ApiRoleConfigGroup&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<ApiRoleConfigGroup> updateRoleConfigGroupWithHttpInfo(String roleConfigGroupName, String message, ApiRoleConfigGroup body) throws ApiException {
        com.squareup.okhttp.Call call = updateRoleConfigGroupValidateBeforeCall(roleConfigGroupName, message, body, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates an existing role config group in the Cloudera Management Services. (asynchronously)
     * Updates an existing role config group in the Cloudera Management Services. &lt;p&gt; Available since API v3.
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param message The optional message describing the changes. (optional)
     * @param body The updated role config group. (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 com.squareup.okhttp.Call updateRoleConfigGroupAsync(String roleConfigGroupName, String message, ApiRoleConfigGroup body, final ApiCallback<ApiRoleConfigGroup> 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);
                }
            };
        }

        com.squareup.okhttp.Call call = updateRoleConfigGroupValidateBeforeCall(roleConfigGroupName, message, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}
