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

com.okta.sdk.resource.api.ApplicationApi 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.Application;
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 ApplicationApi {

    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Activate an Application Activates an inactive application
     *
     * @param appId
     *            Application ID (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void activateApplication(String appId) throws ApiException {
        this.activateApplication(appId, Collections.emptyMap());
    }

    /**
     * Activate an Application Activates an inactive application
     *
     * @param appId
     *            Application ID (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void activateApplication(String appId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/apps/{appId}/lifecycle/activate".replaceAll("\\{" + "appId" + "\\}",
                apiClient.escapeString(appId.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, "POST", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
    }

    /**
     * Create an Application Creates an app instance in your Okta org. You can either create an OIN app instance or a
     * custom app instance: * OIN app instances have prescribed `name` (key app definition) and
     * `signOnMode` options. See the [OIN
     * schemas](/openapi/okta-management/management/tag/Application/#tag/Application/schema/GoogleApplication) for the
     * request body. * For custom app instances, select the
     * [signOnMode](/openapi/okta-management/management/tag/Application/#tag/Application/operation/createApplication!path=0/signOnMode&t=request)
     * that pertains to your app and specify the required parameters in the request body.
     *
     * @param application
     *            (required)
     * @param activate
     *            Executes activation lifecycle operation when creating the app (optional, default to true)
     * @param oktaAccessGatewayAgent
     *            (optional)
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application createApplication(Application application, Boolean activate, String oktaAccessGatewayAgent)
            throws ApiException {
        return this.createApplication(application, activate, oktaAccessGatewayAgent, Collections.emptyMap());
    }

    /**
     * Create an Application Creates an app instance in your Okta org. You can either create an OIN app instance or a
     * custom app instance: * OIN app instances have prescribed `name` (key app definition) and
     * `signOnMode` options. See the [OIN
     * schemas](/openapi/okta-management/management/tag/Application/#tag/Application/schema/GoogleApplication) for the
     * request body. * For custom app instances, select the
     * [signOnMode](/openapi/okta-management/management/tag/Application/#tag/Application/operation/createApplication!path=0/signOnMode&t=request)
     * that pertains to your app and specify the required parameters in the request body.
     *
     * @param application
     *            (required)
     * @param activate
     *            Executes activation lifecycle operation when creating the app (optional, default to true)
     * @param oktaAccessGatewayAgent
     *            (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application createApplication(Application application, Boolean activate, String oktaAccessGatewayAgent,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = application;

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

        // create path and map variables
        String localVarPath = "/api/v1/apps";

        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("activate", activate));
        if (oktaAccessGatewayAgent != null)
            localVarHeaderParams.put("OktaAccessGateway-Agent", apiClient.parameterToString(oktaAccessGatewayAgent));

        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);
    }

    /**
     * Deactivate an Application Deactivates an active application
     *
     * @param appId
     *            Application ID (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deactivateApplication(String appId) throws ApiException {
        this.deactivateApplication(appId, Collections.emptyMap());
    }

    /**
     * Deactivate an Application Deactivates an active application
     *
     * @param appId
     *            Application ID (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deactivateApplication(String appId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/apps/{appId}/lifecycle/deactivate".replaceAll("\\{" + "appId" + "\\}",
                apiClient.escapeString(appId.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, "POST", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
    }

    /**
     * Delete an Application Deletes an inactive application
     *
     * @param appId
     *            Application ID (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteApplication(String appId) throws ApiException {
        this.deleteApplication(appId, Collections.emptyMap());
    }

    /**
     * Delete an Application Deletes an inactive application
     *
     * @param appId
     *            Application ID (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteApplication(String appId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/apps/{appId}".replaceAll("\\{" + "appId" + "\\}",
                apiClient.escapeString(appId.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);
    }

    /**
     * Retrieve an Application Retrieves an application from your Okta organization by `id`
     *
     * @param appId
     *            Application ID (required)
     * @param expand
     *            An optional query parameter to return the specified [Application
     *            User](/openapi/okta-management/management/tag/ApplicationUsers/) in the `_embedded`
     *            property. Valid value: `expand=user/{userId}` (optional)
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application getApplication(String appId, String expand) throws ApiException {
        return this.getApplication(appId, expand, Collections.emptyMap());
    }

    /**
     * Retrieve an Application Retrieves an application from your Okta organization by `id`
     *
     * @param appId
     *            Application ID (required)
     * @param expand
     *            An optional query parameter to return the specified [Application
     *            User](/openapi/okta-management/management/tag/ApplicationUsers/) in the `_embedded`
     *            property. Valid value: `expand=user/{userId}` (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application getApplication(String appId, String expand, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/apps/{appId}".replaceAll("\\{" + "appId" + "\\}",
                apiClient.escapeString(appId.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("expand", expand));

        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);
    }

    /**
     * List all Applications Lists all apps in the org with pagination. A subset of apps can be returned that match a
     * supported filter expression or query. The results are [paginated](/#pagination) according to the
     * `limit` parameter. If there are multiple pages of results, the header contains a `next` link.
     * Treat the link as an opaque value (follow it, don't parse it).
     *
     * @param q
     *            Searches for apps with `name` or `label` properties that starts with the
     *            `q` value using the `startsWith` operation (optional)
     * @param after
     *            Specifies the [pagination](/#pagination) cursor for the next page of results. Treat this as an opaque
     *            value obtained through the `next` link relationship. (optional)
     * @param useOptimization
     *            Specifies whether to use query optimization. If you specify `useOptimization=true` in
     *            the request query, the response contains a subset of app instance properties. (optional, default to
     *            false)
     * @param limit
     *            Specifies the number of results per page (optional, default to -1)
     * @param filter
     *            Filters apps by `status`, `user.id`, `group.id`,
     *            `credentials.signing.kid` or `name` expression that supports the `eq`
     *            operator (optional)
     * @param expand
     *            An optional parameter used for link expansion to embed more resources in the response. Only supports
     *            `expand=user/{userId}` and must be used with the `user.id eq
     *            \"{userId}\"` filter query for the same user. Returns the assigned [Application
     *            User](/openapi/okta-management/management/tag/ApplicationUsers/) in the `_embedded`
     *            property. (optional)
     * @param includeNonDeleted
     *            Specifies whether to include non-active, but not deleted apps in the results (optional, default to
     *            false)
     *
     * @return List<Application>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listApplications(String q, String after, Boolean useOptimization, Integer limit,
            String filter, String expand, Boolean includeNonDeleted) throws ApiException {
        return this.listApplications(q, after, useOptimization, limit, filter, expand, includeNonDeleted,
                Collections.emptyMap());
    }

    /**
     * List all Applications Lists all apps in the org with pagination. A subset of apps can be returned that match a
     * supported filter expression or query. The results are [paginated](/#pagination) according to the
     * `limit` parameter. If there are multiple pages of results, the header contains a `next` link.
     * Treat the link as an opaque value (follow it, don't parse it).
     *
     * @param q
     *            Searches for apps with `name` or `label` properties that starts with the
     *            `q` value using the `startsWith` operation (optional)
     * @param after
     *            Specifies the [pagination](/#pagination) cursor for the next page of results. Treat this as an opaque
     *            value obtained through the `next` link relationship. (optional)
     * @param useOptimization
     *            Specifies whether to use query optimization. If you specify `useOptimization=true` in
     *            the request query, the response contains a subset of app instance properties. (optional, default to
     *            false)
     * @param limit
     *            Specifies the number of results per page (optional, default to -1)
     * @param filter
     *            Filters apps by `status`, `user.id`, `group.id`,
     *            `credentials.signing.kid` or `name` expression that supports the `eq`
     *            operator (optional)
     * @param expand
     *            An optional parameter used for link expansion to embed more resources in the response. Only supports
     *            `expand=user/{userId}` and must be used with the `user.id eq
     *            \"{userId}\"` filter query for the same user. Returns the assigned [Application
     *            User](/openapi/okta-management/management/tag/ApplicationUsers/) in the `_embedded`
     *            property. (optional)
     * @param includeNonDeleted
     *            Specifies whether to include non-active, but not deleted apps in the results (optional, default to
     *            false)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<Application>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listApplications(String q, String after, Boolean useOptimization, Integer limit,
            String filter, String expand, Boolean includeNonDeleted, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/api/v1/apps";

        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("q", q));
        localVarQueryParams.addAll(apiClient.parameterToPair("after", after));
        localVarQueryParams.addAll(apiClient.parameterToPair("useOptimization", useOptimization));
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
        localVarQueryParams.addAll(apiClient.parameterToPair("filter", filter));
        localVarQueryParams.addAll(apiClient.parameterToPair("expand", expand));
        localVarQueryParams.addAll(apiClient.parameterToPair("includeNonDeleted", includeNonDeleted));

        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);
    }

    /**
     * Replace an Application Replaces properties for an application > **Notes:** > * All required properties must
     * be specified in the request body > * You can't modify system-assigned properties, such as `id`,
     * `name`, `status`, `created`, and `lastUpdated`. The values for these
     * properties in the PUT request body are ignored.
     *
     * @param appId
     *            Application ID (required)
     * @param application
     *            (required)
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application replaceApplication(String appId, Application application) throws ApiException {
        return this.replaceApplication(appId, application, Collections.emptyMap());
    }

    /**
     * Replace an Application Replaces properties for an application > **Notes:** > * All required properties must
     * be specified in the request body > * You can't modify system-assigned properties, such as `id`,
     * `name`, `status`, `created`, and `lastUpdated`. The values for these
     * properties in the PUT request body are ignored.
     *
     * @param appId
     *            Application ID (required)
     * @param application
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return Application
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public Application replaceApplication(String appId, Application application, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = application;

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

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

        // create path and map variables
        String localVarPath = "/api/v1/apps/{appId}".replaceAll("\\{" + "appId" + "\\}",
                apiClient.escapeString(appId.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, "PUT", 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