@rockcarver/frodo-lib
Version:
A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
122 lines • 4.93 kB
TypeScript
import { State } from '../shared/State';
export type FRUtils = {
applyNameCollisionPolicy(name: string): string;
getRealmPath(realm: string): string;
getCurrentRealmPath(): string;
getCurrentRealmName(): string;
getCurrentRealmManagedUser(): string;
getRealmName(realm: string): string;
getRealmUsingExportFormat(realm: string): string;
/**
* Gets the list of realms to be used for exports in special format.
* e.g. if the realm is normally '/first/second', then it will return 'root-first-second'.
*/
getRealmsForExport(): Promise<string[]>;
/**
* Helper that gets the normal realm name from the realm export format.
* It reverses the format generated by getRealmsForExport.
* e.g. if the realm is 'root-first-second', then it will return '/first/second'.
* @param realm realm in export format
*/
getRealmUsingExportFormat(realm: string): string;
/**
* Get host URL without path and query params
* @param {string} url tenant URL with path and query params
* @returns {string} AM host URL without path and query params
*/
getHostUrl(url: string): string;
/**
* Get IDM base URL
* @returns {string} IDM host URL without path and query params
*/
getIdmBaseUrl(): string;
/**
* Get host URL without path and query params
* @param {string} url tenant URL with path and query params
* @returns {string} AM host URL without path and query params
* @deprecated since v2.1.2 use {@link FRUtils.getHostUrl | getHostUrl} instead
* ```javascript
* getHostUrl(url: string): string
* ```
* @group Deprecated
*/
getHostBaseUrl(url: string): string;
};
declare const _default: (state: State) => FRUtils;
export default _default;
/**
* Get new name when names collide
* @param {string} name to apply policy to
* @returns {string} new name according to policy
*/
export declare function applyNameCollisionPolicy(name: string): string;
/**
* Gets the list of realms to be used for exports in special format.
* e.g. if the realm is normally '/first/second', then it will return 'root-first-second'.
*/
export declare function getRealmsForExport({ state, }: {
state: State;
}): Promise<string[]>;
/**
* Helper that gets the normal realm name from the realm export format.
* It reverses the format generated by getRealmsForExport.
* e.g. if the realm is 'root-first-second', then it will return '/first/second'.
* @param realm realm in export format
*/
export declare function getRealmUsingExportFormat(realm: string): string;
/**
* Helper function to get the config path required for the API call considering if the request
* should obtain the realm config or the global config of the service in question
* @param {boolean} globalConfig true if the global service is the target of the operation, false otherwise.
* @returns {string} The config path to be used for the request
*/
export declare function getConfigPath(globalConfig: boolean): string;
/**
* Helper function to get the realm path required for the API call considering if the request
* should obtain the realm config or the global config of the service in question
* @param {boolean} globalConfig true if the global service is the target of the operation, false otherwise.
* @returns {string} The realm path to be used for the request
*/
export declare function getRealmPathGlobal(globalConfig: boolean, state: State): string;
/**
* Get realm path
* @param {string} realm realm
* @returns {string} a CREST-compliant realm path, e.g. /realms/root/realms/alpha
*/
export declare function getRealmPath(realm: string): string;
/**
* Get current realm path
* @returns {string} a CREST-compliant realm path, e.g. /realms/root/realms/alpha
*/
export declare function getCurrentRealmPath(state: State): string;
/**
* Get current realm name
* @returns {string} name of the current realm. /alpha -> alpha
*/
export declare function getCurrentRealmName(state: State): string;
/**
* Get the name of the managed user object for the current realm
* @returns {string} the name of the managed user object for the current realm
*/
export declare function getCurrentRealmManagedUser({ state, }: {
state: State;
}): string;
/**
* Get current realm name
* @param {string} realm realm
* @returns {string} name of the realm. /alpha -> alpha
*/
export declare function getRealmName(realm: string): string;
/**
* Get host-only URL without path and query params
* @param {string} url URL with path and query params
* @returns {string} AM host URL without path and query params
*/
export declare function getHostOnlyUrl(url: string): string;
/**
* Get IDM base URL
* @param {State} state State object
* @returns {string} IDM host URL without path and query params
*/
export declare function getIdmBaseUrl(state: State): string;
//# sourceMappingURL=ForgeRockUtils.d.ts.map