Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-hedaoo-sp committed Oct 3, 2024
1 parent 437aef2 commit 00871a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/partition.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* Copyright (c) 2024. SailPoint Technologies, Inc. All rights reserved. */

export class Partition {
public name: string
public size: number
Expand Down
17 changes: 13 additions & 4 deletions lib/partitionAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
/* Copyright (c) 2024. SailPoint Technologies, Inc. All rights reserved. */

import { Context, readConfig, Response, StdAccountListInput, StdAccountListOutput } from ".";
import { Partition } from "./partition";

export interface PartitionedAdapter {
export interface PartitionAdapter {
getPartitions(context: Context, input: StdAccountListInput): Promise<Array<Partition>>
list(context: Context, input: StdAccountListInput, res: Response<StdAccountListOutput>, partition?: Partition): Promise<void>
}

export class Partitioned {
export class PartitionHandler {
public partitionAdapter;

constructor(partitionAdapter: PartitionedAdapter) {
constructor(partitionAdapter: PartitionAdapter) {
this.partitionAdapter = partitionAdapter;
}

/**
* Handles partitioning operation for the connector which supports the partitioning.
*
* @param context Context
* @param input StdAccountListInput
* @param res Response<StdAccountListOutput>
*/
async handler(context: Context, input: StdAccountListInput, res: Response<StdAccountListOutput>): Promise<void> {
const config = await readConfig();
const isPatitionEnabled = config.partitionAggregationEnabled;
var partitionList: Array<Partition> | undefined;

// Get the partitions from the connector
// Get the partitions from the connector if partitining is enabled
if (isPatitionEnabled) {
partitionList = await this.partitionAdapter.getPartitions(context, input);
}
Expand Down

0 comments on commit 00871a1

Please sign in to comment.