Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions KeeperSdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,49 @@ export {
resolvePamConfigFolderName,
formatPamConfigFolderDisplay,
placePamConfigurationInFolder,
RotationManager,
listRotationSchedules,
formatRotationSchedulesTable,
renderRotationSchedulesAsciiTable,
formatRotationSchedulesJson,
formatRotationSchedulesOutput,
getRotationInfo,
formatRotationInfoJson,
formatRotationInfoOutput,
editRotation,
validateRotationInput,
RotationListFormat,
PAM_USER_RECORD_TYPE,
RECORD_INACCESSIBLE_LABEL,
RECORD_UNTITLED_LABEL,
RECORD_UNKNOWN_TYPE_LABEL,
NO_CONFIG_FOUND_LABEL,
GATEWAY_DOES_NOT_EXIST_LABEL,
MANUAL_ROTATION_LABEL,
EMPTY_SCHEDULE_LABEL,
EMPTY_ROTATION_SCHEDULES_MESSAGE,
DEFAULT_ROTATION_SCHEDULE_LABEL,
RECORD_ROTATION_KIND,
ROTATION_LIST_DEFAULT_HEADERS,
ROTATION_LIST_VERBOSE_HEADERS,
ROTATION_STATUS_ONLINE,
MISSING_VALUE_LABEL,
getVaultRecord,
recordExistsInVault,
getVaultRecordTitleType,
formatScheduleDataString,
formatRotationSchedule,
rotationStatusName,
isRotationOnline,
decryptPasswordComplexity,
isAdminResourceValid,
usesDefaultRotationSchedule,
resolveScheduleEnrichment,
buildPamConfigurationUidSet,
resolvePamConfigDisplay,
findGatewayByControllerUid,
buildOnlineGatewayUidSet,
resolveGatewayName,
} from './pam'
export type {
ListGatewaysOptions,
Expand Down Expand Up @@ -1014,6 +1057,25 @@ export type {
RemovePamConfigurationResult,
PamConfigFolderKind,
PamConfigFolderTarget,
RotationListFormatInput,
ListRotationSchedulesOptions,
RotationListRow,
ListRotationSchedulesResult,
FormattedRotationSchedulesTable,
FormatRotationSchedulesTableOptions,
RenderRotationSchedulesAsciiTableOptions,
RotationScheduleJsonEntry,
RotationSchedulesJsonPayload,
RotationScheduleType,
PasswordComplexityDetail,
GetRotationInfoInput,
RotationInfoResult,
RotationInfoJsonPayload,
EditRotationInput,
EditRotationResult,
RotationProfile,
PasswordComplexityInput,
ScheduleData,
} from './pam'

export type {
Expand Down
105 changes: 105 additions & 0 deletions KeeperSdk/src/pam/PamManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Auth } from '@keeper-security/keeperapi'
import type { InMemoryStorage } from '../storage/InMemoryStorage'
import { ConfigManager } from './config/ConfigManager'
import { GatewayManager } from './gateway/GatewayManager'
import { RotationManager } from './rotation/RotationManager'
import type {
FormatPamConfigurationsTableOptions,
FormattedPamConfigurationsTable,
Expand Down Expand Up @@ -30,16 +31,39 @@ import type {
SetGatewayMaxInstancesInput,
SetGatewayMaxInstancesResult,
} from './gateway/gatewayTypes'
import type {
FormatRotationSchedulesTableOptions,
FormattedRotationSchedulesTable,
GetRotationInfoInput,
ListRotationSchedulesOptions,
ListRotationSchedulesResult,
RenderRotationSchedulesAsciiTableOptions,
RotationInfoResult,
EditRotationInput,
EditRotationResult,
} from './rotation/rotationTypes'
import type {
ListRotationScriptsOptions,
ListRotationScriptsResult,
AddRotationScriptInput,
AddRotationScriptResult,
EditRotationScriptInput,
EditRotationScriptResult,
DeleteRotationScriptInput,
DeleteRotationScriptResult,
} from './rotation/rotationScriptTypes'

export type AuthProvider = () => Auth

export class PamManager {
private readonly gatewayManager: GatewayManager
private readonly configManager: ConfigManager
private readonly rotationManager: RotationManager

constructor(storage: InMemoryStorage, authProvider: AuthProvider) {
this.gatewayManager = new GatewayManager(storage, authProvider)
this.configManager = new ConfigManager(storage, authProvider)
this.rotationManager = new RotationManager(storage, authProvider)
}

public getGatewayManager(): GatewayManager {
Expand All @@ -50,6 +74,10 @@ export class PamManager {
return this.configManager
}

public getRotationManager(): RotationManager {
return this.rotationManager
}

public async listGateways(options: ListGatewaysOptions = {}): Promise<ListGatewaysResult> {
return this.gatewayManager.listGateways(options)
}
Expand Down Expand Up @@ -135,4 +163,81 @@ export class PamManager {
): string {
return this.configManager.formatPamConfigurationsOutput(result, options)
}

public async listRotationSchedules(
options: ListRotationSchedulesOptions = {}
): Promise<ListRotationSchedulesResult> {
return this.rotationManager.listRotationSchedules(options)
}

public formatRotationSchedulesTable(
result: ListRotationSchedulesResult,
options: FormatRotationSchedulesTableOptions = {}
): FormattedRotationSchedulesTable {
return this.rotationManager.formatRotationSchedulesTable(result, options)
}

public renderRotationSchedulesAsciiTable(
table: FormattedRotationSchedulesTable,
options: RenderRotationSchedulesAsciiTableOptions = {}
): string {
return this.rotationManager.renderRotationSchedulesAsciiTable(table, options)
}

public formatRotationSchedulesJson(
result: ListRotationSchedulesResult,
options: ListRotationSchedulesOptions = {}
): string {
return this.rotationManager.formatRotationSchedulesJson(result, options)
}

public formatRotationSchedulesOutput(
result: ListRotationSchedulesResult,
options: ListRotationSchedulesOptions = {}
): string {
return this.rotationManager.formatRotationSchedulesOutput(result, options)
}

public async getRotationInfo(input: GetRotationInfoInput): Promise<RotationInfoResult> {
return this.rotationManager.getRotationInfo(input)
}

public formatRotationInfoJson(result: RotationInfoResult): string {
return this.rotationManager.formatRotationInfoJson(result)
}

public formatRotationInfoOutput(
result: RotationInfoResult,
options: Pick<GetRotationInfoInput, 'format'> = {}
): string {
return this.rotationManager.formatRotationInfoOutput(result, options)
}

public async editRotation(input: EditRotationInput): Promise<EditRotationResult> {
return this.rotationManager.editRotation(input)
}

public async listRotationScripts(options: ListRotationScriptsOptions = {}): Promise<ListRotationScriptsResult> {
return this.rotationManager.listRotationScripts(options)
}

public formatRotationScriptsTable(result: ListRotationScriptsResult): string[][] {
return this.rotationManager.formatRotationScriptsTable(result)
}

public formatRotationScriptsJson(result: ListRotationScriptsResult): string {
return this.rotationManager.formatRotationScriptsJson(result)
}

public async addRotationScript(input: AddRotationScriptInput): Promise<AddRotationScriptResult> {
return this.rotationManager.addRotationScript(input)
}

public async editRotationScript(input: EditRotationScriptInput): Promise<EditRotationScriptResult> {
return this.rotationManager.editRotationScript(input)
}

public async deleteRotationScript(input: DeleteRotationScriptInput): Promise<DeleteRotationScriptResult> {
return this.rotationManager.deleteRotationScript(input)
}
}
85 changes: 85 additions & 0 deletions KeeperSdk/src/pam/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,88 @@ export type {
RemovedPamConfiguration,
RemovePamConfigurationResult,
} from './config'

export {
RotationManager,
listRotationSchedules,
formatRotationSchedulesTable,
renderRotationSchedulesAsciiTable,
formatRotationSchedulesJson,
formatRotationSchedulesOutput,
getRotationInfo,
formatRotationInfoJson,
formatRotationInfoOutput,
editRotation,
validateRotationInput,
listRotationScripts,
formatRotationScriptsTable,
formatRotationScriptsJson,
addRotationScript,
editRotationScript,
deleteRotationScript,
RotationListFormat,
PAM_USER_RECORD_TYPE,
RECORD_INACCESSIBLE_LABEL,
RECORD_UNTITLED_LABEL,
RECORD_UNKNOWN_TYPE_LABEL,
NO_CONFIG_FOUND_LABEL,
GATEWAY_DOES_NOT_EXIST_LABEL,
MANUAL_ROTATION_LABEL,
EMPTY_SCHEDULE_LABEL,
EMPTY_ROTATION_SCHEDULES_MESSAGE,
DEFAULT_ROTATION_SCHEDULE_LABEL,
RECORD_ROTATION_KIND,
ROTATION_LIST_DEFAULT_HEADERS,
ROTATION_LIST_VERBOSE_HEADERS,
ROTATION_STATUS_ONLINE,
MISSING_VALUE_LABEL,
getVaultRecord,
recordExistsInVault,
getVaultRecordTitleType,
formatScheduleDataString,
formatRotationSchedule,
rotationStatusName,
isRotationOnline,
decryptPasswordComplexity,
isAdminResourceValid,
usesDefaultRotationSchedule,
resolveScheduleEnrichment,
buildPamConfigurationUidSet,
resolvePamConfigDisplay,
findGatewayByControllerUid,
buildOnlineGatewayUidSet,
resolveGatewayName,
} from './rotation'
export type {
AuthProvider as RotationAuthProvider,
RotationListFormatInput,
ListRotationSchedulesOptions,
RotationListRow,
ListRotationSchedulesResult,
FormattedRotationSchedulesTable,
FormatRotationSchedulesTableOptions,
RenderRotationSchedulesAsciiTableOptions,
RotationScheduleJsonEntry,
RotationSchedulesJsonPayload,
RotationScheduleType,
PasswordComplexityDetail,
GetRotationInfoInput,
RotationInfoResult,
RotationInfoJsonPayload,
RotationProfile,
PasswordComplexityInput,
ScheduleData,
EditRotationInput,
EditRotationResult,
RotationScriptValue,
RotationScript,
ListRotationScriptsResult,
AddRotationScriptInput,
AddRotationScriptResult,
EditRotationScriptInput,
EditRotationScriptResult,
DeleteRotationScriptInput,
DeleteRotationScriptResult,
RotationScriptListFormat,
ListRotationScriptsOptions,
} from './rotation'
Loading
Loading