Skip to content

Commit ca35a0a

Browse files
committed
pam rotation command implementation.
1 parent fc1cc8a commit ca35a0a

20 files changed

Lines changed: 2516 additions & 0 deletions

KeeperSdk/src/index.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,49 @@ export {
955955
resolvePamConfigFolderName,
956956
formatPamConfigFolderDisplay,
957957
placePamConfigurationInFolder,
958+
RotationManager,
959+
listRotationSchedules,
960+
formatRotationSchedulesTable,
961+
renderRotationSchedulesAsciiTable,
962+
formatRotationSchedulesJson,
963+
formatRotationSchedulesOutput,
964+
getRotationInfo,
965+
formatRotationInfoJson,
966+
formatRotationInfoOutput,
967+
editRotation,
968+
validateRotationInput,
969+
RotationListFormat,
970+
PAM_USER_RECORD_TYPE,
971+
RECORD_INACCESSIBLE_LABEL,
972+
RECORD_UNTITLED_LABEL,
973+
RECORD_UNKNOWN_TYPE_LABEL,
974+
NO_CONFIG_FOUND_LABEL,
975+
GATEWAY_DOES_NOT_EXIST_LABEL,
976+
MANUAL_ROTATION_LABEL,
977+
EMPTY_SCHEDULE_LABEL,
978+
EMPTY_ROTATION_SCHEDULES_MESSAGE,
979+
DEFAULT_ROTATION_SCHEDULE_LABEL,
980+
RECORD_ROTATION_KIND,
981+
ROTATION_LIST_DEFAULT_HEADERS,
982+
ROTATION_LIST_VERBOSE_HEADERS,
983+
ROTATION_STATUS_ONLINE,
984+
MISSING_VALUE_LABEL,
985+
getVaultRecord,
986+
recordExistsInVault,
987+
getVaultRecordTitleType,
988+
formatScheduleDataString,
989+
formatRotationSchedule,
990+
rotationStatusName,
991+
isRotationOnline,
992+
decryptPasswordComplexity,
993+
isAdminResourceValid,
994+
usesDefaultRotationSchedule,
995+
resolveScheduleEnrichment,
996+
buildPamConfigurationUidSet,
997+
resolvePamConfigDisplay,
998+
findGatewayByControllerUid,
999+
buildOnlineGatewayUidSet,
1000+
resolveGatewayName,
9581001
} from './pam'
9591002
export type {
9601003
ListGatewaysOptions,
@@ -1014,6 +1057,25 @@ export type {
10141057
RemovePamConfigurationResult,
10151058
PamConfigFolderKind,
10161059
PamConfigFolderTarget,
1060+
RotationListFormatInput,
1061+
ListRotationSchedulesOptions,
1062+
RotationListRow,
1063+
ListRotationSchedulesResult,
1064+
FormattedRotationSchedulesTable,
1065+
FormatRotationSchedulesTableOptions,
1066+
RenderRotationSchedulesAsciiTableOptions,
1067+
RotationScheduleJsonEntry,
1068+
RotationSchedulesJsonPayload,
1069+
RotationScheduleType,
1070+
PasswordComplexityDetail,
1071+
GetRotationInfoInput,
1072+
RotationInfoResult,
1073+
RotationInfoJsonPayload,
1074+
EditRotationInput,
1075+
EditRotationResult,
1076+
RotationProfile,
1077+
PasswordComplexityInput,
1078+
ScheduleData,
10171079
} from './pam'
10181080

10191081
export type {

KeeperSdk/src/pam/PamManager.ts

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Auth } from '@keeper-security/keeperapi'
22
import type { InMemoryStorage } from '../storage/InMemoryStorage'
33
import { ConfigManager } from './config/ConfigManager'
44
import { GatewayManager } from './gateway/GatewayManager'
5+
import { RotationManager } from './rotation/RotationManager'
56
import type {
67
FormatPamConfigurationsTableOptions,
78
FormattedPamConfigurationsTable,
@@ -30,16 +31,39 @@ import type {
3031
SetGatewayMaxInstancesInput,
3132
SetGatewayMaxInstancesResult,
3233
} from './gateway/gatewayTypes'
34+
import type {
35+
FormatRotationSchedulesTableOptions,
36+
FormattedRotationSchedulesTable,
37+
GetRotationInfoInput,
38+
ListRotationSchedulesOptions,
39+
ListRotationSchedulesResult,
40+
RenderRotationSchedulesAsciiTableOptions,
41+
RotationInfoResult,
42+
EditRotationInput,
43+
EditRotationResult,
44+
} from './rotation/rotationTypes'
45+
import type {
46+
ListRotationScriptsOptions,
47+
ListRotationScriptsResult,
48+
AddRotationScriptInput,
49+
AddRotationScriptResult,
50+
EditRotationScriptInput,
51+
EditRotationScriptResult,
52+
DeleteRotationScriptInput,
53+
DeleteRotationScriptResult,
54+
} from './rotation/rotationScriptTypes'
3355

3456
export type AuthProvider = () => Auth
3557

3658
export class PamManager {
3759
private readonly gatewayManager: GatewayManager
3860
private readonly configManager: ConfigManager
61+
private readonly rotationManager: RotationManager
3962

4063
constructor(storage: InMemoryStorage, authProvider: AuthProvider) {
4164
this.gatewayManager = new GatewayManager(storage, authProvider)
4265
this.configManager = new ConfigManager(storage, authProvider)
66+
this.rotationManager = new RotationManager(storage, authProvider)
4367
}
4468

4569
public getGatewayManager(): GatewayManager {
@@ -50,6 +74,10 @@ export class PamManager {
5074
return this.configManager
5175
}
5276

77+
public getRotationManager(): RotationManager {
78+
return this.rotationManager
79+
}
80+
5381
public async listGateways(options: ListGatewaysOptions = {}): Promise<ListGatewaysResult> {
5482
return this.gatewayManager.listGateways(options)
5583
}
@@ -135,4 +163,87 @@ export class PamManager {
135163
): string {
136164
return this.configManager.formatPamConfigurationsOutput(result, options)
137165
}
166+
167+
public async listRotationSchedules(options: ListRotationSchedulesOptions = {}): Promise<ListRotationSchedulesResult> {
168+
return this.rotationManager.listRotationSchedules(options)
169+
}
170+
171+
public formatRotationSchedulesTable(
172+
result: ListRotationSchedulesResult,
173+
options: FormatRotationSchedulesTableOptions = {}
174+
): FormattedRotationSchedulesTable {
175+
return this.rotationManager.formatRotationSchedulesTable(result, options)
176+
}
177+
178+
public renderRotationSchedulesAsciiTable(
179+
table: FormattedRotationSchedulesTable,
180+
options: RenderRotationSchedulesAsciiTableOptions = {}
181+
): string {
182+
return this.rotationManager.renderRotationSchedulesAsciiTable(table, options)
183+
}
184+
185+
public formatRotationSchedulesJson(
186+
result: ListRotationSchedulesResult,
187+
options: ListRotationSchedulesOptions = {}
188+
): string {
189+
return this.rotationManager.formatRotationSchedulesJson(result, options)
190+
}
191+
192+
public formatRotationSchedulesOutput(
193+
result: ListRotationSchedulesResult,
194+
options: ListRotationSchedulesOptions = {}
195+
): string {
196+
return this.rotationManager.formatRotationSchedulesOutput(result, options)
197+
}
198+
199+
public async getRotationInfo(input: GetRotationInfoInput): Promise<RotationInfoResult> {
200+
return this.rotationManager.getRotationInfo(input)
201+
}
202+
203+
public formatRotationInfoJson(result: RotationInfoResult): string {
204+
return this.rotationManager.formatRotationInfoJson(result)
205+
}
206+
207+
public formatRotationInfoOutput(
208+
result: RotationInfoResult,
209+
options: Pick<GetRotationInfoInput, 'format'> = {}
210+
): string {
211+
return this.rotationManager.formatRotationInfoOutput(result, options)
212+
}
213+
214+
public async editRotation(input: EditRotationInput): Promise<EditRotationResult> {
215+
return this.rotationManager.editRotation(input)
216+
}
217+
218+
public async listRotationScripts(
219+
options: ListRotationScriptsOptions = {}
220+
): Promise<ListRotationScriptsResult> {
221+
return this.rotationManager.listRotationScripts(options)
222+
}
223+
224+
public formatRotationScriptsTable(result: ListRotationScriptsResult): string[][] {
225+
return this.rotationManager.formatRotationScriptsTable(result)
226+
}
227+
228+
public formatRotationScriptsJson(result: ListRotationScriptsResult): string {
229+
return this.rotationManager.formatRotationScriptsJson(result)
230+
}
231+
232+
public async addRotationScript(
233+
input: AddRotationScriptInput
234+
): Promise<AddRotationScriptResult> {
235+
return this.rotationManager.addRotationScript(input)
236+
}
237+
238+
public async editRotationScript(
239+
input: EditRotationScriptInput
240+
): Promise<EditRotationScriptResult> {
241+
return this.rotationManager.editRotationScript(input)
242+
}
243+
244+
public async deleteRotationScript(
245+
input: DeleteRotationScriptInput
246+
): Promise<DeleteRotationScriptResult> {
247+
return this.rotationManager.deleteRotationScript(input)
248+
}
138249
}

KeeperSdk/src/pam/index.ts

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,88 @@ export type {
168168
RemovedPamConfiguration,
169169
RemovePamConfigurationResult,
170170
} from './config'
171+
172+
export {
173+
RotationManager,
174+
listRotationSchedules,
175+
formatRotationSchedulesTable,
176+
renderRotationSchedulesAsciiTable,
177+
formatRotationSchedulesJson,
178+
formatRotationSchedulesOutput,
179+
getRotationInfo,
180+
formatRotationInfoJson,
181+
formatRotationInfoOutput,
182+
editRotation,
183+
validateRotationInput,
184+
listRotationScripts,
185+
formatRotationScriptsTable,
186+
formatRotationScriptsJson,
187+
addRotationScript,
188+
editRotationScript,
189+
deleteRotationScript,
190+
RotationListFormat,
191+
PAM_USER_RECORD_TYPE,
192+
RECORD_INACCESSIBLE_LABEL,
193+
RECORD_UNTITLED_LABEL,
194+
RECORD_UNKNOWN_TYPE_LABEL,
195+
NO_CONFIG_FOUND_LABEL,
196+
GATEWAY_DOES_NOT_EXIST_LABEL,
197+
MANUAL_ROTATION_LABEL,
198+
EMPTY_SCHEDULE_LABEL,
199+
EMPTY_ROTATION_SCHEDULES_MESSAGE,
200+
DEFAULT_ROTATION_SCHEDULE_LABEL,
201+
RECORD_ROTATION_KIND,
202+
ROTATION_LIST_DEFAULT_HEADERS,
203+
ROTATION_LIST_VERBOSE_HEADERS,
204+
ROTATION_STATUS_ONLINE,
205+
MISSING_VALUE_LABEL,
206+
getVaultRecord,
207+
recordExistsInVault,
208+
getVaultRecordTitleType,
209+
formatScheduleDataString,
210+
formatRotationSchedule,
211+
rotationStatusName,
212+
isRotationOnline,
213+
decryptPasswordComplexity,
214+
isAdminResourceValid,
215+
usesDefaultRotationSchedule,
216+
resolveScheduleEnrichment,
217+
buildPamConfigurationUidSet,
218+
resolvePamConfigDisplay,
219+
findGatewayByControllerUid,
220+
buildOnlineGatewayUidSet,
221+
resolveGatewayName,
222+
} from './rotation'
223+
export type {
224+
AuthProvider as RotationAuthProvider,
225+
RotationListFormatInput,
226+
ListRotationSchedulesOptions,
227+
RotationListRow,
228+
ListRotationSchedulesResult,
229+
FormattedRotationSchedulesTable,
230+
FormatRotationSchedulesTableOptions,
231+
RenderRotationSchedulesAsciiTableOptions,
232+
RotationScheduleJsonEntry,
233+
RotationSchedulesJsonPayload,
234+
RotationScheduleType,
235+
PasswordComplexityDetail,
236+
GetRotationInfoInput,
237+
RotationInfoResult,
238+
RotationInfoJsonPayload,
239+
RotationProfile,
240+
PasswordComplexityInput,
241+
ScheduleData,
242+
EditRotationInput,
243+
EditRotationResult,
244+
RotationScriptValue,
245+
RotationScript,
246+
ListRotationScriptsResult,
247+
AddRotationScriptInput,
248+
AddRotationScriptResult,
249+
EditRotationScriptInput,
250+
EditRotationScriptResult,
251+
DeleteRotationScriptInput,
252+
DeleteRotationScriptResult,
253+
RotationScriptListFormat,
254+
ListRotationScriptsOptions,
255+
} from './rotation'

0 commit comments

Comments
 (0)