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

com.seeq.api.ScimApi 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.ScimTokenOutputV1;


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

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

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

    public ScimApi(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;
    }

    /**
    * Generate a new SCIM authentication token for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @return ScimTokenOutputV1
    * @throws ApiException if fails to make API call
    */
    public ScimTokenOutputV1 generateToken(String datasourceClass, String datasourceId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = generateTokenWithHttpInfo(datasourceClass, datasourceId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Generate a new SCIM authentication token for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse generateTokenWithHttpInfo(String datasourceClass, String datasourceId) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return generateTokenWithHeadersAndHttpInfo(datasourceClass, datasourceId, localVarHeaderParams);
        
    }

    /**
    * Generate a new SCIM authentication token for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse generateTokenWithHeadersAndHttpInfo(String datasourceClass, String datasourceId, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return generateTokenInternal(datasourceClass, datasourceId, localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse generateTokenInternal(String datasourceClass, String datasourceId, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // verify the required path parameter 'datasourceClass' is set
        if (datasourceClass == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceClass' when calling generateToken");
        }
        // verify the required path parameter 'datasourceId' is set
        if (datasourceId == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceId' when calling generateToken");
        }
        // create path and map variables
        String localVarPath = "/scim/{datasourceClass}/{datasourceId}/token"
          .replaceAll("\\{" + "datasourceClass" + "\\}", apiClient.escapeString(datasourceClass.toString()))
          .replaceAll("\\{" + "datasourceId" + "\\}", apiClient.escapeString(datasourceId.toString()));

        // 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
    }
    /**
    * Retrieve the SCIM authentication token expiration information for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @return ScimTokenOutputV1
    * @throws ApiException if fails to make API call
    */
    public ScimTokenOutputV1 getToken(String datasourceClass, String datasourceId) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getTokenWithHttpInfo(datasourceClass, datasourceId);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Retrieve the SCIM authentication token expiration information for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getTokenWithHttpInfo(String datasourceClass, String datasourceId) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        return getTokenWithHeadersAndHttpInfo(datasourceClass, datasourceId, localVarHeaderParams);
        
    }

    /**
    * Retrieve the SCIM authentication token expiration information for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getTokenWithHeadersAndHttpInfo(String datasourceClass, String datasourceId, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        return getTokenInternal(datasourceClass, datasourceId, localVarQueryParams, localVarHeaderParams);
    }
    
    private ApiClient.ApiResponse getTokenInternal(String datasourceClass, String datasourceId, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // verify the required path parameter 'datasourceClass' is set
        if (datasourceClass == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceClass' when calling getToken");
        }
        // verify the required path parameter 'datasourceId' is set
        if (datasourceId == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceId' when calling getToken");
        }
        // create path and map variables
        String localVarPath = "/scim/{datasourceClass}/{datasourceId}/token"
          .replaceAll("\\{" + "datasourceClass" + "\\}", apiClient.escapeString(datasourceClass.toString()))
          .replaceAll("\\{" + "datasourceId" + "\\}", apiClient.escapeString(datasourceId.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, "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
    }
    /**
    * Invalidates all SCIM tokens for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @throws ApiException if fails to make API call
    */
    public void invalidateToken(String datasourceClass, String datasourceId) throws ApiException {
        invalidateTokenWithHttpInfo(datasourceClass, datasourceId);
    }
    
    /**
    * Invalidates all SCIM tokens for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @throws ApiException if fails to make API call
    */
    public void invalidateTokenWithHttpInfo(String datasourceClass, String datasourceId) throws ApiException {
        Map localVarHeaderParams = new HashMap();
        
         invalidateTokenWithHeadersAndHttpInfo(datasourceClass, datasourceId, localVarHeaderParams);
    }

    /**
    * Invalidates all SCIM tokens for the specified datasource
    * 
    * @param datasourceClass The datasource class of the user's directory (required)
    * @param datasourceId The datasource ID of the user's directory (required)
    * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void invalidateTokenWithHeadersAndHttpInfo(String datasourceClass, String datasourceId, Map customHeaders) throws ApiException {
        List localVarQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
                localVarHeaderParams.putAll(customHeaders);
        invalidateTokenInternal(datasourceClass, datasourceId, localVarQueryParams, localVarHeaderParams);
    }
    
    private void invalidateTokenInternal(String datasourceClass, String datasourceId, List queryParams, Map headerParams) throws ApiException {
        Object localVarPostBody = null;
        // verify the required path parameter 'datasourceClass' is set
        if (datasourceClass == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceClass' when calling invalidateToken");
        }
        // verify the required path parameter 'datasourceId' is set
        if (datasourceId == null) {
            throw new ApiException(400, "Missing the required path parameter 'datasourceId' when calling invalidateToken");
        }
        // create path and map variables
        String localVarPath = "/scim/{datasourceClass}/{datasourceId}/token"
          .replaceAll("\\{" + "datasourceClass" + "\\}", apiClient.escapeString(datasourceClass.toString()))
          .replaceAll("\\{" + "datasourceId" + "\\}", apiClient.escapeString(datasourceId.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 {
                apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", queryParams, localVarPostBody, headerParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
                return;
                // 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
    // OVERLOADS END
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy