@coveo/platform-client
Version:
The main goal of this package is to provide an easy to configure and straightforward way of querying Coveo Cloud APIs using JavaScript.
94 lines • 4.25 kB
JavaScript
import API from '../../APICore.js';
import Ressource from '../Resource.js';
export default class SecurityCache extends Ressource {
static baseUrl = `rest/organizations/${API.orgPlaceholder}`;
static cacheUrl = `/${SecurityCache.baseUrl}/securitycache`;
static providersUrl = `/${SecurityCache.baseUrl}/securityproviders`;
listMembers(providerId, options = {}) {
// TODO: SECCACHE-710 remove `usePageModel` once API has removed this parameter
return this.api.get(this.buildPath(`${SecurityCache.cacheUrl}/entities/${providerId}/members`, {
...options,
usePageModel: true,
}));
}
listEntities(providerId, options) {
return this.api.get(this.buildPath(`${SecurityCache.cacheUrl}/entities/${providerId}`, options));
}
/** Checks if the organization supports filtering security identities by name and/or type. */
isListingSecurityIdentitiesSupported() {
return this.api.get(`${SecurityCache.cacheUrl}/entities/list/is_supported`);
}
listSecurityProviderIdentities(providerId, { page, perPage, ...rest } = {}) {
const filterModel = {
filteringMode: rest.filteringMode,
filterTerm: rest.filterTerm,
identityTypes: rest.identityTypes,
providerIds: [providerId],
};
return this.api.post(this.buildPath(`${SecurityCache.cacheUrl}/entities/list`, { page, perPage }), filterModel);
}
listChildren(providerId, member, options) {
return this.api.post(this.buildPath(`${SecurityCache.cacheUrl}/entities/${providerId}/members/children`, options), member);
}
listParents(providerId, member, options) {
return this.api.post(this.buildPath(`${SecurityCache.cacheUrl}/entities/${providerId}/members/parents`, options), member);
}
listSchedules() {
return this.api.get(`${SecurityCache.cacheUrl}/schedules`);
}
getStatus() {
return this.api.get(`${SecurityCache.cacheUrl}/status`);
}
refreshCache() {
return this.api.post(`${SecurityCache.cacheUrl}/refresh`);
}
refreshProvider(providerId) {
return this.api.post(`${SecurityCache.cacheUrl}/${providerId}/refresh`);
}
refreshIdentity(identityModel) {
return this.api.post(`${SecurityCache.cacheUrl}/refresh/entity`, identityModel);
}
listProviders() {
return this.api.get(SecurityCache.providersUrl);
}
getProvider(securityProviderId) {
return this.api.get(`${SecurityCache.providersUrl}/${securityProviderId}`);
}
/**
* Get the raw configuration of a security provider for an organization.
* @param securityProviderId
* @returns Promise<RawSecurityProviderConfig>
*/
getProviderRaw(securityProviderId) {
return this.api.get(`${SecurityCache.providersUrl}/${securityProviderId}/raw`);
}
/**
* Update the raw configuration of a security provider for an organization.
* @param securityProviderId
* @param rawProviderConfig
* @param options
* @returns Promise<RawSecurityProviderConfig>
*/
updateProviderRaw(securityProviderId, rawProviderConfig, options) {
return this.api.put(this.buildPath(`${SecurityCache.providersUrl}/${securityProviderId}/raw`, options), rawProviderConfig);
}
createOrUpdateProvider(securityProvider) {
return this.api.put(`${SecurityCache.providersUrl}/${securityProvider.id}`, securityProvider);
}
deleteProvider(securityProviderId) {
return this.api.delete(`${SecurityCache.providersUrl}/${securityProviderId}`);
}
getSchedules(securityProviderId) {
return this.api.get(`${SecurityCache.providersUrl}/${securityProviderId}/schedules`);
}
updateSchedule(securityProviderId, schedule) {
return this.api.put(`${SecurityCache.providersUrl}/${securityProviderId}/schedules/${schedule.id}`, schedule);
}
getProviderEntity(providerId, member) {
return this.api.post(`${SecurityCache.cacheUrl}/entities/${providerId}/entity`, member);
}
cancelRefresh(providerId) {
return this.api.post(`${SecurityCache.providersUrl}/${providerId}/refresh/cancel`);
}
}
//# sourceMappingURL=SecurityCache.js.map