com.oracle.bdcs.bdm.client.api.Jobs.java Source code

Java tutorial

Introduction

Here is the source code for com.oracle.bdcs.bdm.client.api.Jobs.java

Source

/**
 * SDK for Bigdata Manager
 * Bigdata manager java SDK
 *
 * OpenAPI spec version: 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.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.oracle.bdcs.bdm.client.api;

import com.oracle.bdcs.bdm.client.ApiCallback;
import com.oracle.bdcs.bdm.client.ApiClient;
import com.oracle.bdcs.bdm.client.ApiException;
import com.oracle.bdcs.bdm.client.ApiResponse;
import com.oracle.bdcs.bdm.client.Configuration;
import com.oracle.bdcs.bdm.client.Pair;
import com.oracle.bdcs.bdm.client.ProgressRequestBody;
import com.oracle.bdcs.bdm.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;

import com.oracle.bdcs.bdm.client.model.*;

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

public class Jobs {
    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /* Build call for abortJob */
    private com.squareup.okhttp.Call abortJobCall(String jobUuid, JobOperation body, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // verify the required parameter 'jobUuid' is set
        if (jobUuid == null) {
            throw new ApiException("Missing the required parameter 'jobUuid' when calling abortJob(Async)");
        }

        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling abortJob(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling abortJob(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/{jobUuid}".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobUuid" + "\\}", apiClient.escapeString(jobUuid.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Update a job.
     * 
     * @param jobUuid  (required)
     * @param body {@link JobOperation} (required)
     * @param tenantName  (required)
     * @return RestJobResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public RestJobResponse abortJob(String jobUuid, JobOperation body, String tenantName) throws ApiException {
        ApiResponse<RestJobResponse> resp = abortJobWithHttpInfo(jobUuid, body, tenantName);
        return resp.getData();
    }

    /**
     * Update a job.
     * 
     * @param jobUuid  (required)
     * @param body {@link JobOperation} (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;RestJobResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<RestJobResponse> abortJobWithHttpInfo(String jobUuid, JobOperation body, String tenantName)
            throws ApiException {
        com.squareup.okhttp.Call call = abortJobCall(jobUuid, body, tenantName, null, null);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Update a job. (asynchronously)
     * 
     * @param jobUuid  (required)
     * @param body {@link JobOperation} (required)
     * @param tenantName  (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 abortJobAsync(String jobUuid, JobOperation body, String tenantName,
            final ApiCallback<RestJobResponse> 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 = abortJobCall(jobUuid, body, tenantName, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for createJob */
    private com.squareup.okhttp.Call createJobCall(ExecutionobParameters body, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // verify the required parameter 'body' is set
        if (body == null) {
            throw new ApiException("Missing the required parameter 'body' when calling createJob(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling createJob(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
                localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Create a job.
     * 
     * @param body {@link JobParameters} (required)
     * @param tenantName  (required)
     * @return RestJobResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public RestJobResponse createJob(ExecutionobParameters body, String tenantName) throws ApiException {
        ApiResponse<RestJobResponse> resp = createJobWithHttpInfo(body, tenantName);
        return resp.getData();
    }

    /**
     * Create a job.
     * 
     * @param body {@link JobParameters} (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;RestJobResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<RestJobResponse> createJobWithHttpInfo(ExecutionobParameters body, String tenantName)
            throws ApiException {
        com.squareup.okhttp.Call call = createJobCall(body, tenantName, null, null);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Create a job. (asynchronously)
     * 
     * @param body {@link JobParameters} (required)
     * @param tenantName  (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 createJobAsync(ExecutionobParameters body, String tenantName,
            final ApiCallback<RestJobResponse> 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 = createJobCall(body, tenantName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for deleteJob */
    private com.squareup.okhttp.Call deleteJobCall(String jobUuid, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'jobUuid' is set
        if (jobUuid == null) {
            throw new ApiException("Missing the required parameter 'jobUuid' when calling deleteJob(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling deleteJob(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/{jobUuid}".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobUuid" + "\\}", apiClient.escapeString(jobUuid.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody,
                localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Delete a job.
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return String
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public String deleteJob(String jobUuid, String tenantName) throws ApiException {
        ApiResponse<String> resp = deleteJobWithHttpInfo(jobUuid, tenantName);
        return resp.getData();
    }

    /**
     * Delete a job.
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;String&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<String> deleteJobWithHttpInfo(String jobUuid, String tenantName) throws ApiException {
        com.squareup.okhttp.Call call = deleteJobCall(jobUuid, tenantName, null, null);
        Type localVarReturnType = new TypeToken<String>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Delete a job. (asynchronously)
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (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 deleteJobAsync(String jobUuid, String tenantName,
            final ApiCallback<String> 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 = deleteJobCall(jobUuid, tenantName, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<String>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for getJob */
    private com.squareup.okhttp.Call getJobCall(String jobUuid, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'jobUuid' is set
        if (jobUuid == null) {
            throw new ApiException("Missing the required parameter 'jobUuid' when calling getJob(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling getJob(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/{jobUuid}".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobUuid" + "\\}", apiClient.escapeString(jobUuid.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Get job.
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return RestJobResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public RestJobResponse getJob(String jobUuid, String tenantName) throws ApiException {
        ApiResponse<RestJobResponse> resp = getJobWithHttpInfo(jobUuid, tenantName);
        return resp.getData();
    }

    /**
     * Get job.
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;RestJobResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<RestJobResponse> getJobWithHttpInfo(String jobUuid, String tenantName) throws ApiException {
        com.squareup.okhttp.Call call = getJobCall(jobUuid, tenantName, null, null);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get job. (asynchronously)
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (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 getJobAsync(String jobUuid, String tenantName,
            final ApiCallback<RestJobResponse> 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 = getJobCall(jobUuid, tenantName, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<RestJobResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for getJobFullLog */
    private com.squareup.okhttp.Call getJobFullLogCall(String jobUuid, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'jobUuid' is set
        if (jobUuid == null) {
            throw new ApiException("Missing the required parameter 'jobUuid' when calling getJobFullLog(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling getJobFullLog(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/{jobUuid}/fullLog".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobUuid" + "\\}", apiClient.escapeString(jobUuid.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Get full job logs from yarn logs.
     * This method returns preview logs in case the job is running  and full logs when the job has finished the execution.
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return RestJobLogsResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public RestJobLogsResponse getJobFullLog(String jobUuid, String tenantName) throws ApiException {
        ApiResponse<RestJobLogsResponse> resp = getJobFullLogWithHttpInfo(jobUuid, tenantName);
        return resp.getData();
    }

    /**
     * Get full job logs from yarn logs.
     * This method returns preview logs in case the job is running  and full logs when the job has finished the execution.
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;RestJobLogsResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<RestJobLogsResponse> getJobFullLogWithHttpInfo(String jobUuid, String tenantName)
            throws ApiException {
        com.squareup.okhttp.Call call = getJobFullLogCall(jobUuid, tenantName, null, null);
        Type localVarReturnType = new TypeToken<RestJobLogsResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get full job logs from yarn logs. (asynchronously)
     * This method returns preview logs in case the job is running  and full logs when the job has finished the execution.
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (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 getJobFullLogAsync(String jobUuid, String tenantName,
            final ApiCallback<RestJobLogsResponse> 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 = getJobFullLogCall(jobUuid, tenantName, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<RestJobLogsResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for getJobPreviewLog */
    private com.squareup.okhttp.Call getJobPreviewLogCall(String jobUuid, String tenantName,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'jobUuid' is set
        if (jobUuid == null) {
            throw new ApiException("Missing the required parameter 'jobUuid' when calling getJobPreviewLog(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException(
                    "Missing the required parameter 'tenantName' when calling getJobPreviewLog(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/{jobUuid}/logPreview"
                .replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobUuid" + "\\}", apiClient.escapeString(jobUuid.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.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 = {

        };
        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[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * Get preview of the job&#39;s logs (even while the job&#39;s still running).
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return RestJobLogsPreviewResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public RestJobLogsPreviewResponse getJobPreviewLog(String jobUuid, String tenantName) throws ApiException {
        ApiResponse<RestJobLogsPreviewResponse> resp = getJobPreviewLogWithHttpInfo(jobUuid, tenantName);
        return resp.getData();
    }

    /**
     * Get preview of the job&#39;s logs (even while the job&#39;s still running).
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (required)
     * @return ApiResponse&lt;RestJobLogsPreviewResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<RestJobLogsPreviewResponse> getJobPreviewLogWithHttpInfo(String jobUuid, String tenantName)
            throws ApiException {
        com.squareup.okhttp.Call call = getJobPreviewLogCall(jobUuid, tenantName, null, null);
        Type localVarReturnType = new TypeToken<RestJobLogsPreviewResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * Get preview of the job&#39;s logs (even while the job&#39;s still running). (asynchronously)
     * 
     * @param jobUuid uuid of the job (see {@link oracle.paas.datamovement.core.entities.Uuid}) (required)
     * @param tenantName  (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 getJobPreviewLogAsync(String jobUuid, String tenantName,
            final ApiCallback<RestJobLogsPreviewResponse> 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 = getJobPreviewLogCall(jobUuid, tenantName, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<RestJobLogsPreviewResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for listAllJobs */
    private com.squareup.okhttp.Call listAllJobsCall(String tenantName, String q, Integer offset, Integer limit,
            final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException("Missing the required parameter 'tenantName' when calling listAllJobs(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs".replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

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

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

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

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

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

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new 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[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * List all jobs for the user.
     * 
     * @param tenantName  (required)
     * @param q  (optional)
     * @param offset  (optional)
     * @param limit  (optional)
     * @return CollectionResourceResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public DataSourceCollectionResponse listAllJobs(String tenantName, String q, Integer offset, Integer limit)
            throws ApiException {
        ApiResponse<DataSourceCollectionResponse> resp = listAllJobsWithHttpInfo(tenantName, q, offset, limit);
        return resp.getData();
    }

    /**
     * List all jobs for the user.
     * 
     * @param tenantName  (required)
     * @param q  (optional)
     * @param offset  (optional)
     * @param limit  (optional)
     * @return ApiResponse&lt;CollectionResourceResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<DataSourceCollectionResponse> listAllJobsWithHttpInfo(String tenantName, String q,
            Integer offset, Integer limit) throws ApiException {
        com.squareup.okhttp.Call call = listAllJobsCall(tenantName, q, offset, limit, null, null);
        Type localVarReturnType = new TypeToken<DataSourceCollectionResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List all jobs for the user. (asynchronously)
     * 
     * @param tenantName  (required)
     * @param q  (optional)
     * @param offset  (optional)
     * @param limit  (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 listAllJobsAsync(String tenantName, String q, Integer offset, Integer limit,
            final ApiCallback<DataSourceCollectionResponse> 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 = listAllJobsCall(tenantName, q, offset, limit, progressListener,
                progressRequestListener);
        Type localVarReturnType = new TypeToken<DataSourceCollectionResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }

    /* Build call for listAllJobsForGivenTemplate */
    private com.squareup.okhttp.Call listAllJobsForGivenTemplateCall(String jobTemplateName, String tenantName,
            Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener,
            final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'jobTemplateName' is set
        if (jobTemplateName == null) {
            throw new ApiException(
                    "Missing the required parameter 'jobTemplateName' when calling listAllJobsForGivenTemplate(Async)");
        }

        // verify the required parameter 'tenantName' is set
        if (tenantName == null) {
            throw new ApiException(
                    "Missing the required parameter 'tenantName' when calling listAllJobsForGivenTemplate(Async)");
        }

        // create path and map variables
        String localVarPath = "/v1.0/tenants/{tenantName}/jobs/jobTemplates/{jobTemplateName}"
                .replaceAll("\\{format\\}", "json")
                .replaceAll("\\{" + "jobTemplateName" + "\\}", apiClient.escapeString(jobTemplateName.toString()))
                .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

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

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

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

        final String[] localVarAccepts = {

        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null)
            localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {

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

        if (progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new 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[] {};
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    /**
     * List all jobs for the user and a specific job template.
     * 
     * @param jobTemplateName name or uuid (see {@link oracle.paas.datamovement.core.entities.Uuid} of the job template (required)
     * @param tenantName  (required)
     * @param limit  (optional)
     * @param offset  (optional)
     * @return JobCollectionResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public JobCollectionResponse listAllJobsForGivenTemplate(String jobTemplateName, String tenantName,
            Integer limit, Integer offset) throws ApiException {
        ApiResponse<JobCollectionResponse> resp = listAllJobsForGivenTemplateWithHttpInfo(jobTemplateName,
                tenantName, limit, offset);
        return resp.getData();
    }

    /**
     * List all jobs for the user and a specific job template.
     * 
     * @param jobTemplateName name or uuid (see {@link oracle.paas.datamovement.core.entities.Uuid} of the job template (required)
     * @param tenantName  (required)
     * @param limit  (optional)
     * @param offset  (optional)
     * @return Job&lt;CollectionResourceResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse<JobCollectionResponse> listAllJobsForGivenTemplateWithHttpInfo(String jobTemplateName,
            String tenantName, Integer limit, Integer offset) throws ApiException {
        com.squareup.okhttp.Call call = listAllJobsForGivenTemplateCall(jobTemplateName, tenantName, limit, offset,
                null, null);
        Type localVarReturnType = new TypeToken<JobCollectionResponse>() {
        }.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * List all jobs for the user and a specific job template. (asynchronously)
     * 
     * @param jobTemplateName name or uuid (see {@link oracle.paas.datamovement.core.entities.Uuid} of the job template (required)
     * @param tenantName  (required)
     * @param limit  (optional)
     * @param offset  (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 listAllJobsForGivenTemplateAsync(String jobTemplateName, String tenantName,
            Integer limit, Integer offset, final ApiCallback<JobCollectionResponse> 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 = listAllJobsForGivenTemplateCall(jobTemplateName, tenantName, limit, offset,
                progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken<JobCollectionResponse>() {
        }.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}