
com.okta.sdk.resource.api.DeviceApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of okta-sdk-api Show documentation
Show all versions of okta-sdk-api Show documentation
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.
/*
* 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.Device;
import com.okta.sdk.resource.model.DeviceList;
import com.okta.sdk.resource.model.DeviceUser;
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 DeviceApi {
private ApiClient apiClient;
public DeviceApi() {
this(Configuration.getDefaultApiClient());
}
public DeviceApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Activate a Device Activates a Device by setting its status to ACTIVE by `deviceId`. Activated devices
* are used to create and delete Device user links.
*
* @param deviceId
* `id` of the device (required)
*
* @throws ApiException
* if fails to make API call
*/
public void activateDevice(String deviceId) throws ApiException {
this.activateDevice(deviceId, Collections.emptyMap());
}
/**
* Activate a Device Activates a Device by setting its status to ACTIVE by `deviceId`. Activated devices
* are used to create and delete Device user links.
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @throws ApiException
* if fails to make API call
*/
public void activateDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling activateDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}/lifecycle/activate".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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);
}
/**
* Deactivate a Device Deactivates a Device by setting its status to DEACTIVATED by `deviceId`.
* Deactivation causes a Device to lose all device user links. Set the Device status to DEACTIVATED before deleting
* it. > **Note:** When deactivating a Device, keep in mind the following: - Device deactivation is a destructive
* operation for device factors and client certificates. Device reenrollment using Okta Verify allows end users to
* set up new factors on the device. - Device deletion removes the device record from Okta. Reenrollment creates a
* new device record.
*
* @param deviceId
* `id` of the device (required)
*
* @throws ApiException
* if fails to make API call
*/
public void deactivateDevice(String deviceId) throws ApiException {
this.deactivateDevice(deviceId, Collections.emptyMap());
}
/**
* Deactivate a Device Deactivates a Device by setting its status to DEACTIVATED by `deviceId`.
* Deactivation causes a Device to lose all device user links. Set the Device status to DEACTIVATED before deleting
* it. > **Note:** When deactivating a Device, keep in mind the following: - Device deactivation is a destructive
* operation for device factors and client certificates. Device reenrollment using Okta Verify allows end users to
* set up new factors on the device. - Device deletion removes the device record from Okta. Reenrollment creates a
* new device record.
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @throws ApiException
* if fails to make API call
*/
public void deactivateDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling deactivateDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}/lifecycle/deactivate".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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 Device Deletes (permanently) a device by `deviceId` if it has a status of
* `DEACTIVATED`. You can transition the device to `DEACTIVATED` status using the [Deactivate a
* Device](/openapi/okta-management/management/tag/Device/#tag/Device/operation/deactivateDevice) endpoint. This
* request is destructive and deletes all of the profile data related to the device. Once deleted, device data
* can't be recovered. However, reenrollment creates a new device record. > **Note:** Attempts to delete a
* device that isn't in a `DEACTIVATED` state raise an error.
*
* @param deviceId
* `id` of the device (required)
*
* @throws ApiException
* if fails to make API call
*/
public void deleteDevice(String deviceId) throws ApiException {
this.deleteDevice(deviceId, Collections.emptyMap());
}
/**
* Delete a Device Deletes (permanently) a device by `deviceId` if it has a status of
* `DEACTIVATED`. You can transition the device to `DEACTIVATED` status using the [Deactivate a
* Device](/openapi/okta-management/management/tag/Device/#tag/Device/operation/deactivateDevice) endpoint. This
* request is destructive and deletes all of the profile data related to the device. Once deleted, device data
* can't be recovered. However, reenrollment creates a new device record. > **Note:** Attempts to delete a
* device that isn't in a `DEACTIVATED` state raise an error.
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @throws ApiException
* if fails to make API call
*/
public void deleteDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling deleteDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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 a Device Retrieves a device by `deviceId`
*
* @param deviceId
* `id` of the device (required)
*
* @return Device
*
* @throws ApiException
* if fails to make API call
*/
public Device getDevice(String deviceId) throws ApiException {
return this.getDevice(deviceId, Collections.emptyMap());
}
/**
* Retrieve a Device Retrieves a device by `deviceId`
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @return Device
*
* @throws ApiException
* if fails to make API call
*/
public Device getDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling getDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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" };
TypeReference localVarReturnType = new TypeReference() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List all Users for a Device Lists all Users for a Device by `deviceId`
*
* @param deviceId
* `id` of the device (required)
*
* @return List<DeviceUser>
*
* @throws ApiException
* if fails to make API call
*/
public List listDeviceUsers(String deviceId) throws ApiException {
return this.listDeviceUsers(deviceId, Collections.emptyMap());
}
/**
* List all Users for a Device Lists all Users for a Device by `deviceId`
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @return List<DeviceUser>
*
* @throws ApiException
* if fails to make API call
*/
public List listDeviceUsers(String deviceId, Map additionalHeaders)
throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling listDeviceUsers");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}/users".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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" };
TypeReference> localVarReturnType = new TypeReference>() {
};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List all Devices Lists all devices with pagination support. You can return a subset of Devices that match a
* supported search criteria using the `search` query parameter. Searches for devices based on the
* properties specified in the `search` parameter conforming SCIM filter specifications
* (case-insensitive). This data is eventually consistent. The API returns different results depending on specified
* queries in the request. Empty list is returned if no objects match `search` request. > **Note:**
* Listing devices with `search` should not be used as a part of any critical flows—such as authentication
* or updates—to prevent potential data loss. `search` results may not reflect the latest information, as
* this endpoint uses a search index which may not be up-to-date with recent updates to the object. <br>
* Don't use search results directly for record updates, as the data might be stale and therefore overwrite
* newer data, resulting in data loss. <br> Use an `id` lookup for records that you update to ensure
* your results contain the latest data. This operation requires [URL
* encoding](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1). For example,
* `search=profile.displayName eq \"Bob\"` is encoded as
* `search=profile.displayName%20eq%20%22Bob%22`.
*
* @param after
* (optional)
* @param limit
* A limit on the number of objects to return (recommend `20`) (optional, default to 200)
* @param search
* A SCIM filter expression that filters the results. Searches include all Device `profile`
* properties and the Device `id`, `status`, and `lastUpdated` properties.
* (optional)
* @param expand
* Includes associated user details and management status for the device in the `_embedded`
* attribute (optional)
*
* @return List<DeviceList>
*
* @throws ApiException
* if fails to make API call
*/
public List listDevices(String after, Integer limit, String search, String expand) throws ApiException {
return this.listDevices(after, limit, search, expand, Collections.emptyMap());
}
/**
* List all Devices Lists all devices with pagination support. You can return a subset of Devices that match a
* supported search criteria using the `search` query parameter. Searches for devices based on the
* properties specified in the `search` parameter conforming SCIM filter specifications
* (case-insensitive). This data is eventually consistent. The API returns different results depending on specified
* queries in the request. Empty list is returned if no objects match `search` request. > **Note:**
* Listing devices with `search` should not be used as a part of any critical flows—such as authentication
* or updates—to prevent potential data loss. `search` results may not reflect the latest information, as
* this endpoint uses a search index which may not be up-to-date with recent updates to the object. <br>
* Don't use search results directly for record updates, as the data might be stale and therefore overwrite
* newer data, resulting in data loss. <br> Use an `id` lookup for records that you update to ensure
* your results contain the latest data. This operation requires [URL
* encoding](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1). For example,
* `search=profile.displayName eq \"Bob\"` is encoded as
* `search=profile.displayName%20eq%20%22Bob%22`.
*
* @param after
* (optional)
* @param limit
* A limit on the number of objects to return (recommend `20`) (optional, default to 200)
* @param search
* A SCIM filter expression that filters the results. Searches include all Device `profile`
* properties and the Device `id`, `status`, and `lastUpdated` properties.
* (optional)
* @param expand
* Includes associated user details and management status for the device in the `_embedded`
* attribute (optional)
* @param additionalHeaders
* additionalHeaders for this call
*
* @return List<DeviceList>
*
* @throws ApiException
* if fails to make API call
*/
public List listDevices(String after, Integer limit, String search, String expand,
Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/api/v1/devices";
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("after", after));
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
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);
}
/**
* Suspend a Device Suspends a Device by setting its status to SUSPENDED. Use suspended devices to create and delete
* device user links. You can only unsuspend or deactivate suspended devices. > **Note:** SUSPENDED status is
* meant to be temporary, so it isn't destructive.
*
* @param deviceId
* `id` of the device (required)
*
* @throws ApiException
* if fails to make API call
*/
public void suspendDevice(String deviceId) throws ApiException {
this.suspendDevice(deviceId, Collections.emptyMap());
}
/**
* Suspend a Device Suspends a Device by setting its status to SUSPENDED. Use suspended devices to create and delete
* device user links. You can only unsuspend or deactivate suspended devices. > **Note:** SUSPENDED status is
* meant to be temporary, so it isn't destructive.
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @throws ApiException
* if fails to make API call
*/
public void suspendDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling suspendDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}/lifecycle/suspend".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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);
}
/**
* Unsuspend a Device Unsuspends a Device by returning its `status` to ACTIVE. >**Note:** Only devices
* with a SUSPENDED status can be unsuspended.
*
* @param deviceId
* `id` of the device (required)
*
* @throws ApiException
* if fails to make API call
*/
public void unsuspendDevice(String deviceId) throws ApiException {
this.unsuspendDevice(deviceId, Collections.emptyMap());
}
/**
* Unsuspend a Device Unsuspends a Device by returning its `status` to ACTIVE. >**Note:** Only devices
* with a SUSPENDED status can be unsuspended.
*
* @param deviceId
* `id` of the device (required)
* @param additionalHeaders
* additionalHeaders for this call
*
* @throws ApiException
* if fails to make API call
*/
public void unsuspendDevice(String deviceId, Map additionalHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'deviceId' is set
if (deviceId == null) {
throw new ApiException(400, "Missing the required parameter 'deviceId' when calling unsuspendDevice");
}
// create path and map variables
String localVarPath = "/api/v1/devices/{deviceId}/lifecycle/unsuspend".replaceAll("\\{" + "deviceId" + "\\}",
apiClient.escapeString(deviceId.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);
}
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