/*
 * 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.ApiConfigList;
import com.cloudera.api.swagger.model.ApiRoleConfigGroup;
import com.cloudera.api.swagger.model.ApiRoleConfigGroupList;
import com.cloudera.api.swagger.model.ApiRoleList;
import com.cloudera.api.swagger.model.ApiRoleNameList;

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

public class RoleConfigGroupsResourceApi {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Build call for createRoleConfigGroups
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The list of groups to be 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 createRoleConfigGroupsCall(String clusterName, String serviceName, ApiRoleConfigGroupList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 createRoleConfigGroupsValidateBeforeCall(String clusterName, String serviceName, ApiRoleConfigGroupList 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 createRoleConfigGroups(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling createRoleConfigGroups(Async)");
        }

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

    }

    /**
     * Creates new role config groups.
     * Creates new role config groups. It is not allowed to create base groups (base must be set to false.) &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The list of groups to be created. (optional)
     * @return ApiRoleConfigGroupList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroupList createRoleConfigGroups(String clusterName, String serviceName, ApiRoleConfigGroupList body) throws ApiException {
        ApiResponse<ApiRoleConfigGroupList> resp = createRoleConfigGroupsWithHttpInfo(clusterName, serviceName, body);
        return resp.getData();
    }

    /**
     * Creates new role config groups.
     * Creates new role config groups. It is not allowed to create base groups (base must be set to false.) &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The list of groups to be created. (optional)
     * @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> createRoleConfigGroupsWithHttpInfo(String clusterName, String serviceName, ApiRoleConfigGroupList body) throws ApiException {
        okhttp3.Call call = createRoleConfigGroupsValidateBeforeCall(clusterName, serviceName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Creates new role config groups. (asynchronously)
     * Creates new role config groups. It is not allowed to create base groups (base must be set to false.) &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The list of groups to be 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 createRoleConfigGroupsAsync(String clusterName, String serviceName, ApiRoleConfigGroupList body, 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);
                }
            };
        }

        okhttp3.Call call = createRoleConfigGroupsValidateBeforeCall(clusterName, serviceName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for deleteRoleConfigGroup
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to delete. (required)
     * @param serviceName  (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 deleteRoleConfigGroupCall(String clusterName, String roleConfigGroupName, String serviceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 deleteRoleConfigGroupValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, 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 deleteRoleConfigGroup(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling deleteRoleConfigGroup(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling deleteRoleConfigGroup(Async)");
        }

        okhttp3.Call call = deleteRoleConfigGroupCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Deletes a role config group.
     * Deletes a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to delete. (required)
     * @param serviceName  (required)
     * @return ApiRoleConfigGroup
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroup deleteRoleConfigGroup(String clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        ApiResponse<ApiRoleConfigGroup> resp = deleteRoleConfigGroupWithHttpInfo(clusterName, roleConfigGroupName, serviceName);
        return resp.getData();
    }

    /**
     * Deletes a role config group.
     * Deletes a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to delete. (required)
     * @param serviceName  (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> deleteRoleConfigGroupWithHttpInfo(String clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        okhttp3.Call call = deleteRoleConfigGroupValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Deletes a role config group. (asynchronously)
     * Deletes a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to delete. (required)
     * @param serviceName  (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 deleteRoleConfigGroupAsync(String clusterName, String roleConfigGroupName, String serviceName, 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);
                }
            };
        }

        okhttp3.Call call = deleteRoleConfigGroupValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for moveRoles
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group the roles will be moved to. (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (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 moveRolesCall(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}/roles"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 moveRolesValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleNameList 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 moveRoles(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling moveRoles(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling moveRoles(Async)");
        }

        okhttp3.Call call = moveRolesCall(clusterName, roleConfigGroupName, serviceName, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Moves roles to the specified role config group.
     * Moves roles to the specified role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group the roles will be moved to. (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (optional)
     * @return ApiRoleList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleList moveRoles(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleNameList body) throws ApiException {
        ApiResponse<ApiRoleList> resp = moveRolesWithHttpInfo(clusterName, roleConfigGroupName, serviceName, body);
        return resp.getData();
    }

    /**
     * Moves roles to the specified role config group.
     * Moves roles to the specified role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group the roles will be moved to. (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (optional)
     * @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> moveRolesWithHttpInfo(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleNameList body) throws ApiException {
        okhttp3.Call call = moveRolesValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Moves roles to the specified role config group. (asynchronously)
     * Moves roles to the specified role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group the roles will be moved to. (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (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 moveRolesAsync(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleNameList body, 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);
                }
            };
        }

        okhttp3.Call call = moveRolesValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for moveRolesToBaseGroup
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (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 moveRolesToBaseGroupCall(String clusterName, String serviceName, ApiRoleNameList body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/roles"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 moveRolesToBaseGroupValidateBeforeCall(String clusterName, String serviceName, ApiRoleNameList 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 moveRolesToBaseGroup(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling moveRolesToBaseGroup(Async)");
        }

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

    }

    /**
     * Moves roles to the base role config group.
     * Moves roles to the base role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the roles may vary. Each role will be moved to its corresponding base group depending on its role type. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (optional)
     * @return ApiRoleList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleList moveRolesToBaseGroup(String clusterName, String serviceName, ApiRoleNameList body) throws ApiException {
        ApiResponse<ApiRoleList> resp = moveRolesToBaseGroupWithHttpInfo(clusterName, serviceName, body);
        return resp.getData();
    }

    /**
     * Moves roles to the base role config group.
     * Moves roles to the base role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the roles may vary. Each role will be moved to its corresponding base group depending on its role type. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (optional)
     * @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> moveRolesToBaseGroupWithHttpInfo(String clusterName, String serviceName, ApiRoleNameList body) throws ApiException {
        okhttp3.Call call = moveRolesToBaseGroupValidateBeforeCall(clusterName, serviceName, body, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Moves roles to the base role config group. (asynchronously)
     * Moves roles to the base role config group.  The roles can be moved from any role config group belonging to the same service. The role type of the roles may vary. Each role will be moved to its corresponding base group depending on its role type. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @param body The names of the roles to move. (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 moveRolesToBaseGroupAsync(String clusterName, String serviceName, ApiRoleNameList body, 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);
                }
            };
        }

        okhttp3.Call call = moveRolesToBaseGroupValidateBeforeCall(clusterName, serviceName, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readConfig
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (required)
     * @param view The view of the data to materialize, either \&quot;summary\&quot; or \&quot;full\&quot;. (optional, default to summary)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call readConfigCall(String clusterName, String roleConfigGroupName, String serviceName, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}/config"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 readConfigValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, 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 readConfig(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readConfig(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling readConfig(Async)");
        }

        okhttp3.Call call = readConfigCall(clusterName, roleConfigGroupName, serviceName, view, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns the current revision of the config for the specified role config group.
     * Returns the current revision of the config for the specified role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (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 clusterName, String roleConfigGroupName, String serviceName, String view) throws ApiException {
        ApiResponse<ApiConfigList> resp = readConfigWithHttpInfo(clusterName, roleConfigGroupName, serviceName, view);
        return resp.getData();
    }

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

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

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

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

        okhttp3.Call call = readConfigValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, view, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoleConfigGroup
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the requested group. (required)
     * @param serviceName  (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 readRoleConfigGroupCall(String clusterName, String roleConfigGroupName, String serviceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 readRoleConfigGroupValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, 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 readRoleConfigGroup(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readRoleConfigGroup(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling readRoleConfigGroup(Async)");
        }

        okhttp3.Call call = readRoleConfigGroupCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns the information for a role config group.
     * Returns the information for a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the requested group. (required)
     * @param serviceName  (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 clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        ApiResponse<ApiRoleConfigGroup> resp = readRoleConfigGroupWithHttpInfo(clusterName, roleConfigGroupName, serviceName);
        return resp.getData();
    }

    /**
     * Returns the information for a role config group.
     * Returns the information for a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the requested group. (required)
     * @param serviceName  (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 clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        okhttp3.Call call = readRoleConfigGroupValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the information for a role config group. (asynchronously)
     * Returns the information for a role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the requested group. (required)
     * @param serviceName  (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 readRoleConfigGroupAsync(String clusterName, String roleConfigGroupName, String serviceName, 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);
                }
            };
        }

        okhttp3.Call call = readRoleConfigGroupValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoleConfigGroups
     * @param clusterName  (required)
     * @param serviceName  (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 readRoleConfigGroupsCall(String clusterName, String serviceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 readRoleConfigGroupsValidateBeforeCall(String clusterName, String serviceName, 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 readRoleConfigGroups(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling readRoleConfigGroups(Async)");
        }

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

    }

    /**
     * Returns the information for all role config groups for a given cluster and service.
     * Returns the information for all role config groups for a given cluster and service. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @return ApiRoleConfigGroupList
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiRoleConfigGroupList readRoleConfigGroups(String clusterName, String serviceName) throws ApiException {
        ApiResponse<ApiRoleConfigGroupList> resp = readRoleConfigGroupsWithHttpInfo(clusterName, serviceName);
        return resp.getData();
    }

    /**
     * Returns the information for all role config groups for a given cluster and service.
     * Returns the information for all role config groups for a given cluster and service. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (required)
     * @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(String clusterName, String serviceName) throws ApiException {
        okhttp3.Call call = readRoleConfigGroupsValidateBeforeCall(clusterName, serviceName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns the information for all role config groups for a given cluster and service. (asynchronously)
     * Returns the information for all role config groups for a given cluster and service. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param serviceName  (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 readRoleConfigGroupsAsync(String clusterName, String serviceName, 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);
                }
            };
        }

        okhttp3.Call call = readRoleConfigGroupsValidateBeforeCall(clusterName, serviceName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroupList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for readRoles
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (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 readRolesCall(String clusterName, String roleConfigGroupName, String serviceName, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/clusters/{clusterName}/services/{serviceName}/roleConfigGroups/{roleConfigGroupName}/roles"
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "roleConfigGroupName" + "\\}", apiClient.escapeString(roleConfigGroupName.toString()))
            .replaceAll("\\{" + "serviceName" + "\\}", apiClient.escapeString(serviceName.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 readRolesValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, 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 readRoles(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling readRoles(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling readRoles(Async)");
        }

        okhttp3.Call call = readRolesCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Returns all roles in the given role config group.
     * Returns all roles in the given role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (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 clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        ApiResponse<ApiRoleList> resp = readRolesWithHttpInfo(clusterName, roleConfigGroupName, serviceName);
        return resp.getData();
    }

    /**
     * Returns all roles in the given role config group.
     * Returns all roles in the given role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (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 clusterName, String roleConfigGroupName, String serviceName) throws ApiException {
        okhttp3.Call call = readRolesValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Returns all roles in the given role config group. (asynchronously)
     * Returns all roles in the given role config group. &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (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 readRolesAsync(String clusterName, String roleConfigGroupName, String serviceName, 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);
                }
            };
        }

        okhttp3.Call call = readRolesValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiRoleList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateConfig
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (required)
     * @param body The new config information for the group. (optional)
     * @param message Optional message describing the changes. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call updateConfigCall(String clusterName, String roleConfigGroupName, String serviceName, ApiConfigList body, String message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

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

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

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

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

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

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

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

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateConfigValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, ApiConfigList body, String message, 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 updateConfig(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling updateConfig(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling updateConfig(Async)");
        }

        okhttp3.Call call = updateConfigCall(clusterName, roleConfigGroupName, serviceName, body, message, progressListener, progressRequestListener);
        return call;

    }

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

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

    /**
     * Updates the config for the given role config group. (asynchronously)
     * Updates the config for the given role config group.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the role config group. (required)
     * @param serviceName  (required)
     * @param body The new config information for the group. (optional)
     * @param message Optional message describing the changes. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call updateConfigAsync(String clusterName, String roleConfigGroupName, String serviceName, ApiConfigList body, String message, final ApiCallback<ApiConfigList> callback) throws ApiException {

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

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

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

        okhttp3.Call call = updateConfigValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, body, message, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<ApiConfigList>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for updateRoleConfigGroup
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param serviceName  (required)
     * @param body The updated role config group. (optional)
     * @param message The optional message describing the changes. (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call updateRoleConfigGroupCall(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleConfigGroup body, String message, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

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

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

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

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

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

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

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

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call updateRoleConfigGroupValidateBeforeCall(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleConfigGroup body, String message, 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 updateRoleConfigGroup(Async)");
        }
        // verify the required parameter 'roleConfigGroupName' is set
        if (roleConfigGroupName == null) {
            throw new ApiException("Missing the required parameter 'roleConfigGroupName' when calling updateRoleConfigGroup(Async)");
        }
        // verify the required parameter 'serviceName' is set
        if (serviceName == null) {
            throw new ApiException("Missing the required parameter 'serviceName' when calling updateRoleConfigGroup(Async)");
        }

        okhttp3.Call call = updateRoleConfigGroupCall(clusterName, roleConfigGroupName, serviceName, body, message, progressListener, progressRequestListener);
        return call;

    }

    /**
     * Updates an existing role config group.
     * Updates an existing role config group &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param serviceName  (required)
     * @param body The updated role config group. (optional)
     * @param message The optional message describing the changes. (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 clusterName, String roleConfigGroupName, String serviceName, ApiRoleConfigGroup body, String message) throws ApiException {
        ApiResponse<ApiRoleConfigGroup> resp = updateRoleConfigGroupWithHttpInfo(clusterName, roleConfigGroupName, serviceName, body, message);
        return resp.getData();
    }

    /**
     * Updates an existing role config group.
     * Updates an existing role config group &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param serviceName  (required)
     * @param body The updated role config group. (optional)
     * @param message The optional message describing the changes. (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 clusterName, String roleConfigGroupName, String serviceName, ApiRoleConfigGroup body, String message) throws ApiException {
        okhttp3.Call call = updateRoleConfigGroupValidateBeforeCall(clusterName, roleConfigGroupName, serviceName, body, message, null, null);
        Type localVarReturnType = new TypeToken<ApiRoleConfigGroup>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Updates an existing role config group. (asynchronously)
     * Updates an existing role config group &lt;p&gt; Available since API v3.
     * @param clusterName  (required)
     * @param roleConfigGroupName The name of the group to update. (required)
     * @param serviceName  (required)
     * @param body The updated role config group. (optional)
     * @param message The optional message describing the changes. (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call updateRoleConfigGroupAsync(String clusterName, String roleConfigGroupName, String serviceName, ApiRoleConfigGroup body, String message, 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);
                }
            };
        }

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