All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.seeq.api.AccessKeysApi Maven / Gradle / Ivy

There is a newer version: 66.0.0-v202410141803
Show newest version
package com.seeq.api;

import com.seeq.ApiException;
import com.seeq.ApiClient;
import com.seeq.Configuration;
import com.seeq.model.*;
import com.seeq.Pair;

import javax.ws.rs.core.GenericType;
import javax.ws.rs.ProcessingException;

import com.seeq.model.AccessKeyInputV1;
import com.seeq.model.AccessKeyOutputListV1;
import com.seeq.model.AccessKeyOutputV1;
import com.seeq.model.StatusMessageBase;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AccessKeysApi {
    private ApiClient apiClient;
    private long retryTimeout = 5_000; // Default of 5 seconds

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

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

    public void setRetryTimeout(long retryTimeout) {
        this.retryTimeout = retryTimeout;
    }

    public long getRetryTimeout() {
        return this.retryTimeout;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
    * Creates a new Access Key associated with the current session.
    * 
    * @param body Key information (required)
    * @return AccessKeyOutputV1
    * @throws ApiException if fails to make API call
    */
    public AccessKeyOutputV1 createKey(AccessKeyInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = createKeyWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Creates a new Access Key associated with the current session.
    * 
    * @param body Key information (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse createKeyWithHttpInfo(AccessKeyInputV1 body) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return createKeyWithHeadersAndHttpInfo(body, localVarHeaderParams);
        
    }

    /**
    * Creates a new Access Key associated with the current session.
    * 
    * @param body Key information (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse createKeyWithHeadersAndHttpInfo(AccessKeyInputV1 body, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return createKeyInternal(body, localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse createKeyInternal(AccessKeyInputV1 body, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = body;
        // verify the required body parameter 'body' is set
        if (body == null) {
            throw new ApiException(400, "Missing the required body parameter 'body' when calling createKey");
        }
        // create path and map variables
        String localVarPath = "/accesskeys";

        // query params
        Map localVarFormParams = new HashMap();

        
        final String[] localVarAccepts = {
        "application/vnd.seeq.v1+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {
        "application/vnd.seeq.v1+json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "api_key" };

        long apiClientInvocationTime = System.currentTimeMillis();
        while(true) {
            try {
                GenericType localVarReturnType = new GenericType() {};
                return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", queryParams, localVarPostBody, headerParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
                // Possible exceptions:
                // ===================
                // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
                //    during conversion of the response entity data to an instance of a particular Java type).
                // * ProcessingException - in case the request processing or subsequent I/O operation fails.
                // * WebApplicationException - in case the response status code of the response returned by the server is not
                //    successful and the specified response type is not Response.
                // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
                //    in ApiException(s)
            } catch (ApiException | ProcessingException e) {
                if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
                    long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
                    if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
                        continue;
                    }
                }
                throw e;
            }
        } // while
    }
    /**
    * Delete an Access Key
    * 
    * @param keyName Key Information (required)
    * @return StatusMessageBase
    * @throws ApiException if fails to make API call
    */
    public StatusMessageBase deleteKey(String keyName) throws ApiException {
        ApiClient.ApiResponse localVarResponse = deleteKeyWithHttpInfo(keyName);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Delete an Access Key
    * 
    * @param keyName Key Information (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse deleteKeyWithHttpInfo(String keyName) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return deleteKeyWithHeadersAndHttpInfo(keyName, localVarHeaderParams);
        
    }

    /**
    * Delete an Access Key
    * 
    * @param keyName Key Information (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse deleteKeyWithHeadersAndHttpInfo(String keyName, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return deleteKeyInternal(keyName, localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse deleteKeyInternal(String keyName, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // verify the required path parameter 'keyName' is set
        if (keyName == null) {
            throw new ApiException(400, "Missing the required path parameter 'keyName' when calling deleteKey");
        }
        // create path and map variables
        String localVarPath = "/accesskeys/{keyName}"
          .replaceAll("\\{" + "keyName" + "\\}", apiClient.escapeString(keyName.toString()));

        // query params
        Map localVarFormParams = new HashMap();

        
        final String[] localVarAccepts = {
        "application/vnd.seeq.v1+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {
        
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "api_key" };

        long apiClientInvocationTime = System.currentTimeMillis();
        while(true) {
            try {
                GenericType localVarReturnType = new GenericType() {};
                return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", queryParams, localVarPostBody, headerParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
                // Possible exceptions:
                // ===================
                // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
                //    during conversion of the response entity data to an instance of a particular Java type).
                // * ProcessingException - in case the request processing or subsequent I/O operation fails.
                // * WebApplicationException - in case the response status code of the response returned by the server is not
                //    successful and the specified response type is not Response.
                // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
                //    in ApiException(s)
            } catch (ApiException | ProcessingException e) {
                if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
                    long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
                    if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
                        continue;
                    }
                }
                throw e;
            }
        } // while
    }
    /**
    * Gets the Access Keys associated with the current session's user.
    * 
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional, default to 0)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional, default to 40)
    * @param getAll Get all user keys if true, only the current user's keys if false. (optional, default to false)
    * @return AccessKeyOutputListV1
    * @throws ApiException if fails to make API call
    */
    public AccessKeyOutputListV1 getKeys(Integer offset, Integer limit, Boolean getAll) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getKeysWithHttpInfo(offset, limit, getAll);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Gets the Access Keys associated with the current session's user.
    * 
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional, default to 0)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional, default to 40)
    * @param getAll Get all user keys if true, only the current user's keys if false. (optional, default to false)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHttpInfo(Integer offset, Integer limit, Boolean getAll) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return getKeysWithHeadersAndHttpInfo(offset, limit, getAll, localVarHeaderParams);
        
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    * 
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional, default to 0)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional, default to 40)
    * @param getAll Get all user keys if true, only the current user's keys if false. (optional, default to false)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHeadersAndHttpInfo(Integer offset, Integer limit, Boolean getAll, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "getAll", getAll));
                localVarHeaderParams.putAll(customHeaders);
        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse getKeysInternal(List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // create path and map variables
        String localVarPath = "/accesskeys";

        // query params
        Map localVarFormParams = new HashMap();

        
        final String[] localVarAccepts = {
        "application/vnd.seeq.v1+json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {
        
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "api_key" };

        long apiClientInvocationTime = System.currentTimeMillis();
        while(true) {
            try {
                GenericType localVarReturnType = new GenericType() {};
                return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", queryParams, localVarPostBody, headerParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
                // Possible exceptions:
                // ===================
                // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
                //    during conversion of the response entity data to an instance of a particular Java type).
                // * ProcessingException - in case the request processing or subsequent I/O operation fails.
                // * WebApplicationException - in case the response status code of the response returned by the server is not
                //    successful and the specified response type is not Response.
                // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
                //    in ApiException(s)
            } catch (ApiException | ProcessingException e) {
                if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
                    long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
                    if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
                        continue;
                    }
                }
                throw e;
            }
        } // while
    }
    // OVERLOADS START

    /**
    * Gets the Access Keys associated with the current session's user.
    *
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional)
    * @return AccessKeyOutputListV1
    * @throws ApiException if fails to make API call
    */
    public AccessKeyOutputListV1 getKeys(Integer offset, Integer limit) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));

        ApiClient.ApiResponse localVarResponse = getKeysInternal(localVarQueryParams, localVarHeaderParams);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHttpInfo(Integer offset, Integer limit) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));

        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    *
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @param limit The pagination limit, the total number of collection keys that will be returned in this page of results (optional)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHeadersAndHttpInfo(Integer offset, Integer limit, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));

        localVarHeaderParams.putAll(customHeaders);
        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }


    /**
    * Gets the Access Keys associated with the current session's user.
    *
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @return AccessKeyOutputListV1
    * @throws ApiException if fails to make API call
    */
    public AccessKeyOutputListV1 getKeys(Integer offset) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        ApiClient.ApiResponse localVarResponse = getKeysInternal(localVarQueryParams, localVarHeaderParams);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHttpInfo(Integer offset) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    *
    * @param offset The pagination offset, the index of the first collection key that will be returned in this page of results (optional)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHeadersAndHttpInfo(Integer offset, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));

        localVarHeaderParams.putAll(customHeaders);
        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }


    /**
    * Gets the Access Keys associated with the current session's user.
    *
    *
    * @return AccessKeyOutputListV1
    * @throws ApiException if fails to make API call
    */
    public AccessKeyOutputListV1 getKeys() throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();


        ApiClient.ApiResponse localVarResponse = getKeysInternal(localVarQueryParams, localVarHeaderParams);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    *
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHttpInfo() throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();


        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }

    /**
    * Gets the Access Keys associated with the current session's user.
    *
    *
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getKeysWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();


        localVarHeaderParams.putAll(customHeaders);
        return getKeysInternal(localVarQueryParams, localVarHeaderParams);
    }

// OVERLOADS END
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy