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

com.okta.sdk.resource.api.AuthorizationServerAssocApi Maven / Gradle / Ivy

Go to download

The Okta Java SDK API .jar provides a Java API that your code can use to make calls to the Okta API. This .jar is the only compile-time dependency within the Okta SDK project that your code should depend on. Implementations of this API (implementation .jars) should be runtime dependencies only.

There is a newer version: 21.0.0
Show newest version
/*
 * Okta Admin Management
 * Allows customers to easily access the Okta Management APIs
 *
 * The version of the OpenAPI document: 2024.08.3
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package com.okta.sdk.resource.api;

import com.fasterxml.jackson.core.type.TypeReference;

import com.okta.sdk.resource.client.ApiException;
import com.okta.sdk.resource.client.ApiClient;
import com.okta.sdk.resource.client.Configuration;
import com.okta.sdk.resource.model.*;
import com.okta.sdk.resource.client.Pair;

import com.okta.sdk.resource.model.AssociatedServerMediated;
import com.okta.sdk.resource.model.AuthorizationServer;
import com.okta.sdk.resource.model.Error;

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

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;

import org.openapitools.jackson.nullable.JsonNullableModule;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-11-15T08:48:47.130589-06:00[America/Chicago]", comments = "Generator version: 7.8.0")
public class AuthorizationServerAssocApi {

    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Create an associated Authorization Server Creates trusted relationships between the given authorization server
     * and other authorization servers
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param associatedServerMediated
     *            (required)
     *
     * @return List<AuthorizationServer>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List createAssociatedServers(String authServerId,
            AssociatedServerMediated associatedServerMediated) throws ApiException {
        return this.createAssociatedServers(authServerId, associatedServerMediated, Collections.emptyMap());
    }

    /**
     * Create an associated Authorization Server Creates trusted relationships between the given authorization server
     * and other authorization servers
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param associatedServerMediated
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<AuthorizationServer>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List createAssociatedServers(String authServerId,
            AssociatedServerMediated associatedServerMediated, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = associatedServerMediated;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'authServerId' when calling createAssociatedServers");
        }

        // verify the required parameter 'associatedServerMediated' is set
        if (associatedServerMediated == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'associatedServerMediated' when calling createAssociatedServers");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/associatedServers"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

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

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

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        TypeReference> localVarReturnType = new TypeReference>() {
        };
        return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * Delete an associated Authorization Server Deletes an associated Authorization Server
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param associatedServerId
     *            `id` of the associated Authorization Server (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteAssociatedServer(String authServerId, String associatedServerId) throws ApiException {
        this.deleteAssociatedServer(authServerId, associatedServerId, Collections.emptyMap());
    }

    /**
     * Delete an associated Authorization Server Deletes an associated Authorization Server
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param associatedServerId
     *            `id` of the associated Authorization Server (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteAssociatedServer(String authServerId, String associatedServerId,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'authServerId' when calling deleteAssociatedServer");
        }

        // verify the required parameter 'associatedServerId' is set
        if (associatedServerId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'associatedServerId' when calling deleteAssociatedServer");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/associatedServers/{associatedServerId}"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString())).replaceAll(
                        "\\{" + "associatedServerId" + "\\}", apiClient.escapeString(associatedServerId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

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

        final String[] localVarContentTypes = {

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

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
    }

    /**
     * List all associated Authorization Servers Lists all associated Authorization Servers by trusted type for the
     * given `authServerId`
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param trusted
     *            Searches trusted authorization servers when `true` or searches untrusted authorization
     *            servers when `false` (optional)
     * @param q
     *            Searches for the name or audience of the associated authorization servers (optional)
     * @param limit
     *            Specifies the number of results for a page (optional, default to 200)
     * @param after
     *            Specifies the pagination cursor for the next page of the associated authorization servers (optional)
     *
     * @return List<AuthorizationServer>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listAssociatedServersByTrustedType(String authServerId, Boolean trusted, String q,
            Integer limit, String after) throws ApiException {
        return this.listAssociatedServersByTrustedType(authServerId, trusted, q, limit, after, Collections.emptyMap());
    }

    /**
     * List all associated Authorization Servers Lists all associated Authorization Servers by trusted type for the
     * given `authServerId`
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param trusted
     *            Searches trusted authorization servers when `true` or searches untrusted authorization
     *            servers when `false` (optional)
     * @param q
     *            Searches for the name or audience of the associated authorization servers (optional)
     * @param limit
     *            Specifies the number of results for a page (optional, default to 200)
     * @param after
     *            Specifies the pagination cursor for the next page of the associated authorization servers (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<AuthorizationServer>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listAssociatedServersByTrustedType(String authServerId, Boolean trusted, String q,
            Integer limit, String after, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'authServerId' when calling listAssociatedServersByTrustedType");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/associatedServers"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPair("trusted", trusted));
        localVarQueryParams.addAll(apiClient.parameterToPair("q", q));
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
        localVarQueryParams.addAll(apiClient.parameterToPair("after", after));

        localVarHeaderParams.putAll(additionalHeaders);

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

        final String[] localVarContentTypes = {

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

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        TypeReference> localVarReturnType = new TypeReference>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    protected static ObjectMapper getObjectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new JavaTimeModule());
        objectMapper.registerModule(new JsonNullableModule());
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
        return objectMapper;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy