Skip to content

Commit

Permalink
[Components] sailpoint #13241
Browse files Browse the repository at this point in the history
Sources
- New Identity (Instant)
- New Identity Attribute Change (Instant)

Actions
 - Upload Account Source File
 - List Certification Campaigns
 - Submit Access Request
  • Loading branch information
luancazarine committed Dec 12, 2024
1 parent 1969631 commit e9e3d23
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 301 deletions.
3 changes: 0 additions & 3 deletions components/sailpoint/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import sailpoint from "../../sailpoint.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "sailpoint-list-certification-campaigns",
name: "List Certification Campaigns",
description: "Retrieves multiple certification campaigns in IdentityNow. [See the documentation]()",
version: "0.0.{{ts}}",
description: "Retrieves multiple certification campaigns in IdentityNow. [See the documentation](https://developer.sailpoint.com/docs/api/v2024/get-active-campaigns)",
version: "0.0.1",
type: "action",
props: {
sailpoint: {
type: "app",
app: "identitynow",
},
sailpoint,
filter: {
propDefinition: [
"sailpoint",
Expand All @@ -21,8 +17,20 @@ export default {
},
},
async run({ $ }) {
const campaigns = await this.sailpoint.retrieveCertificationCampaigns();
$.export("$summary", `Successfully retrieved ${campaigns.length} certification campaigns`);
return campaigns;
const response = this.sailpoint.paginate({
fn: this.sailpoint.listCertificationCampaigns,
params: {
detail: "full",
},
});

const responseArray = [];

for await (const item of response) {
responseArray.push(item);
}

$.export("$summary", `Successfully retrieved ${responseArray.length} certification campaigns`);
return responseArray;
},
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import identitynow from "../../identitynow.app.mjs";
import { axios } from "@pipedream/platform";
import { REQUEST_TYPE_OPTIONS } from "./common/constants.mjs";

export default {
key: "identitynow-submit-access-request",
name: "Submit Access Request",
description: "Sends an access request to IdentityNow. [See the documentation](https://developer.sailpoint.com/docs/api/v2024/create-access-request)",
version: "0.0.{{ts}}",
version: "0.0.1",
type: "action",
props: {
identitynow,
Expand All @@ -16,21 +16,34 @@ export default {
],
},
requestType: {
propDefinition: [
identitynow,
"requestType",
],
optional: true,
type: "string",
label: "Request Type",
description: "Type of access request.",
options: REQUEST_TYPE_OPTIONS,
default: REQUEST_TYPE_OPTIONS[0].value,
},
requestedItems: {
propDefinition: [
identitynow,
"requestedItems",
],
type: "string[]",
label: "Requested Items",
description: "List of requested items as JSON strings. **Example: [{\"type\": \"ROLE\",\"id\": \"2c9180835d2e5168015d32f890ca1581\",\"comment\": \"Requesting access profile for John Doe\",\"clientMetadata\": {\"requestedAppId\":\"2c91808f7892918f0178b78da4a305a1\",\"requestedAppName\":\"test-app\"},\"removeDate\": \"2020-07-11T21:23:15.000Z\"}]**. [See the documentation](https://developer.sailpoint.com/docs/api/v2024/create-access-request) for forther information.",
},
clientMetadata: {
type: "object",
label: "Client Metadata",
description: "Arbitrary key-value pairs. They will never be processed by the IdentityNow system but will be returned on associated APIs such as /account-activities. **Example: {\"requestedAppId\":\"2c91808f7892918f0178b78da4a305a1\",\"requestedAppName\":\"test-app\"}**.",
optional: true,
},
},
async run({ $ }) {
const response = await this.identitynow.submitAccessRequest();
const response = await this.identitynow.submitAccessRequest({
$,
data: {
requestedFor: this.requestedFor,
requestType: this.requestType,
resquestItems: this.resquestItems,
clientMetadata: this.clientMetadata,
},
});
$.export("$summary", "Access request submitted successfully.");
return response;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import FormData from "form-data";
import fs from "fs";
import { checkTmp } from "../../common/utils.mjs";
import sailpoint from "../../sailpoint.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "sailpoint-upload-account-source-file",
name: "Upload Account Source File",
description: "Uploads a CSV-formatted account source file to IdentityNow. [See the documentation]()",
version: "0.0.{{ts}}",
version: "0.0.1",
type: "action",
props: {
sailpoint,
Expand All @@ -15,16 +17,25 @@ export default {
"sourceId",
],
},
csvAccountFile: {
propDefinition: [
sailpoint,
"csvAccountFile",
],
filePath: {
type: "string",
label: "File Path",
description: "The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).",
},
},
async run({ $ }) {
const response = await this.sailpoint.uploadCsvAccountFile();
$.export("$summary", `Successfully uploaded CSV account file for source ${response.id} (${response.name})`);
const data = new FormData();

data.append("file", fs.createReadStream(checkTmp(this.filePath)));

const response = await this.sailpoint.uploadSourceAccountFile({
$,
sourceId: this.sourceId,
data,
headers: data.getHeaders(),
});

$.export("$summary", `Successfully uploaded file for source account: ${response.id} (${response.name})`);
return response;
},
};
13 changes: 0 additions & 13 deletions components/sailpoint/app/sailpoint.app.ts

This file was deleted.

20 changes: 20 additions & 0 deletions components/sailpoint/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export const LIMIT = 100;

export const REQUEST_TYPE_OPTIONS = [
{
label: "Grant Access",
value: "GRANT_ACCESS",
},
{
label: "Revoke Access",
value: "REVOKE_ACCESS",
},
];

export const WEBHOOK_TYPE_OPTIONS = [
"HTTP",
"EVENTBRIDGE",
"INLINE",
"SCRIPT",
"WORKFLOW",
];
8 changes: 8 additions & 0 deletions components/sailpoint/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
checkTmp(filename) {
if (!filename.startsWith("/tmp")) {
return `/tmp/${filename}`;
}
return filename;
},
};
10 changes: 7 additions & 3 deletions components/sailpoint/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"name": "@pipedream/sailpoint",
"version": "0.0.3",
"version": "0.1.0",
"description": "Pipedream SailPoint Components",
"main": "dist/app/sailpoint.app.mjs",
"main": "sailpoint.app.mjs",
"keywords": [
"pipedream",
"sailpoint"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/sailpoint",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3",
"fs": "^0.0.1-security"
}
}

Loading

0 comments on commit e9e3d23

Please sign in to comment.