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

com.okta.sdk.resource.api.GroupRuleApi 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.CreateGroupRuleRequest;
import com.okta.sdk.resource.model.Error;
import com.okta.sdk.resource.model.GroupRule;

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 GroupRuleApi {

    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Activate a Group Rule Activates a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void activateGroupRule(String groupRuleId) throws ApiException {
        this.activateGroupRule(groupRuleId, Collections.emptyMap());
    }

    /**
     * Activate a Group Rule Activates a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void activateGroupRule(String groupRuleId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/groups/rules/{groupRuleId}/lifecycle/activate"
                .replaceAll("\\{" + "groupRuleId" + "\\}", apiClient.escapeString(groupRuleId.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 a Group rule Creates a Group rule to dynamically add Users to the specified Group if they match the
     * condition > **Note:** Group rules are created with the status set to `'INACTIVE'`.
     *
     * @param groupRule
     *            (required)
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule createGroupRule(CreateGroupRuleRequest groupRule) throws ApiException {
        return this.createGroupRule(groupRule, Collections.emptyMap());
    }

    /**
     * Create a Group rule Creates a Group rule to dynamically add Users to the specified Group if they match the
     * condition > **Note:** Group rules are created with the status set to `'INACTIVE'`.
     *
     * @param groupRule
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule createGroupRule(CreateGroupRuleRequest groupRule, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = groupRule;

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

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

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

    /**
     * Deactivate a Group Rule Deactivates a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deactivateGroupRule(String groupRuleId) throws ApiException {
        this.deactivateGroupRule(groupRuleId, Collections.emptyMap());
    }

    /**
     * Deactivate a Group Rule Deactivates a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deactivateGroupRule(String groupRuleId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/groups/rules/{groupRuleId}/lifecycle/deactivate"
                .replaceAll("\\{" + "groupRuleId" + "\\}", apiClient.escapeString(groupRuleId.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 a Group Rule Deletes a specific group rule by `groupRuleId`
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param removeUsers
     *            If set to `true`, removes Users from Groups assigned by this rule (optional, default to
     *            false)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteGroupRule(String groupRuleId, Boolean removeUsers) throws ApiException {
        this.deleteGroupRule(groupRuleId, removeUsers, Collections.emptyMap());
    }

    /**
     * Delete a Group Rule Deletes a specific group rule by `groupRuleId`
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param removeUsers
     *            If set to `true`, removes Users from Groups assigned by this rule (optional, default to
     *            false)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteGroupRule(String groupRuleId, Boolean removeUsers, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

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

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

        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 a Group rule Retrieves a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param expand
     *            If specified as `groupIdToGroupNameMap`, then show Group names (optional)
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule getGroupRule(String groupRuleId, String expand) throws ApiException {
        return this.getGroupRule(groupRuleId, expand, Collections.emptyMap());
    }

    /**
     * Retrieve a Group rule Retrieves a specific Group rule by ID from your org
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param expand
     *            If specified as `groupIdToGroupNameMap`, then show Group names (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule getGroupRule(String groupRuleId, String expand, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

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

        // create path and map variables
        String localVarPath = "/api/v1/groups/rules/{groupRuleId}".replaceAll("\\{" + "groupRuleId" + "\\}",
                apiClient.escapeString(groupRuleId.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 Group rules Lists all Group rules for your org
     *
     * @param limit
     *            Specifies the number of rule results in a page (optional, default to 50)
     * @param after
     *            Specifies the pagination cursor for the next page of rules (optional)
     * @param search
     *            Specifies the keyword to search rules for (optional)
     * @param expand
     *            If specified as `groupIdToGroupNameMap`, then displays group names (optional)
     *
     * @return List<GroupRule>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listGroupRules(Integer limit, String after, String search, String expand)
            throws ApiException {
        return this.listGroupRules(limit, after, search, expand, Collections.emptyMap());
    }

    /**
     * List all Group rules Lists all Group rules for your org
     *
     * @param limit
     *            Specifies the number of rule results in a page (optional, default to 50)
     * @param after
     *            Specifies the pagination cursor for the next page of rules (optional)
     * @param search
     *            Specifies the keyword to search rules for (optional)
     * @param expand
     *            If specified as `groupIdToGroupNameMap`, then displays group names (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<GroupRule>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listGroupRules(Integer limit, String after, String search, String expand,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

        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("limit", limit));
        localVarQueryParams.addAll(apiClient.parameterToPair("after", after));
        localVarQueryParams.addAll(apiClient.parameterToPair("search", search));
        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);
    }

    /**
     * Replace a Group rule Replaces a Group rule > **Notes:** You only can update rules with a Group whose status is
     * set to `'INACTIVE'`. > > You currently can't update the `action` section.
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param groupRule
     *            (required)
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule replaceGroupRule(String groupRuleId, GroupRule groupRule) throws ApiException {
        return this.replaceGroupRule(groupRuleId, groupRule, Collections.emptyMap());
    }

    /**
     * Replace a Group rule Replaces a Group rule > **Notes:** You only can update rules with a Group whose status is
     * set to `'INACTIVE'`. > > You currently can't update the `action` section.
     *
     * @param groupRuleId
     *            The `id` of the group rule (required)
     * @param groupRule
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return GroupRule
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public GroupRule replaceGroupRule(String groupRuleId, GroupRule groupRule, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = groupRule;

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

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

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