-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New Components - sailpoint #14935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luancazarine
wants to merge
8
commits into
master
Choose a base branch
from
issue-13241
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New Components - sailpoint #14935
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1969631
sailpoint init
luancazarine e9e3d23
[Components] sailpoint #13241
luancazarine 5f51c13
pnpm update
luancazarine 13ef83b
fix action key
luancazarine bb6ee2e
fix app field on app file
luancazarine fe3efcf
some adjusts
luancazarine eb7f1c6
pnpm update
luancazarine a208f80
fix app reference
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
components/sailpoint/actions/list-certification-campaigns/list-certification-campaigns.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import sailpoint from "../../sailpoint.app.mjs"; | ||
|
||
export default { | ||
key: "sailpoint-list-certification-campaigns", | ||
name: "List Certification Campaigns", | ||
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, | ||
filter: { | ||
propDefinition: [ | ||
"sailpoint", | ||
"filter", | ||
], | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
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; | ||
}, | ||
}; |
50 changes: 50 additions & 0 deletions
50
components/sailpoint/actions/submit-access-request/submit-access-request.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { REQUEST_TYPE_OPTIONS } from "../../common/constants.mjs"; | ||
import identitynow from "../../identitynow.app.mjs"; | ||
|
||
export default { | ||
key: "sailpoint-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.1", | ||
type: "action", | ||
props: { | ||
identitynow, | ||
requestedFor: { | ||
propDefinition: [ | ||
identitynow, | ||
"requestedFor", | ||
], | ||
}, | ||
requestType: { | ||
type: "string", | ||
label: "Request Type", | ||
description: "Type of access request.", | ||
options: REQUEST_TYPE_OPTIONS, | ||
default: REQUEST_TYPE_OPTIONS[0].value, | ||
}, | ||
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.", | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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({ | ||
$, | ||
data: { | ||
requestedFor: this.requestedFor, | ||
requestType: this.requestType, | ||
resquestItems: this.resquestItems, | ||
clientMetadata: this.clientMetadata, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
}); | ||
$.export("$summary", "Access request submitted successfully."); | ||
return response; | ||
}, | ||
}; |
41 changes: 41 additions & 0 deletions
41
components/sailpoint/actions/upload-account-source-file/upload-account-source-file.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import FormData from "form-data"; | ||
import fs from "fs"; | ||
import { checkTmp } from "../../common/utils.mjs"; | ||
import sailpoint from "../../sailpoint.app.mjs"; | ||
|
||
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.1", | ||
type: "action", | ||
props: { | ||
sailpoint, | ||
sourceId: { | ||
propDefinition: [ | ||
sailpoint, | ||
"sourceId", | ||
], | ||
}, | ||
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).", | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
async run({ $ }) { | ||
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(), | ||
}); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$.export("$summary", `Successfully uploaded file for source account: ${response.id} (${response.name})`); | ||
return response; | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
{ | ||
"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 <support@pipedream.com> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.3" | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import { axios } from "@pipedream/platform"; | ||
import { LIMIT } from "./common/constants.mjs"; | ||
|
||
export default { | ||
type: "app", | ||
app: "sailpoint", | ||
propDefinitions: { | ||
requestedFor: { | ||
type: "string[]", | ||
label: "Requested For", | ||
description: "List of Identity IDs for whom the Access is requested.", | ||
async options({ page }) { | ||
const data = await this.listIdentityIds({ | ||
params: { | ||
limit: LIMIT, | ||
offset: LIMIT * page, | ||
}, | ||
}); | ||
|
||
return data.map(({ | ||
id: value, name: label, | ||
}) => ({ | ||
label, | ||
value, | ||
})); | ||
}, | ||
}, | ||
sourceId: { | ||
type: "string", | ||
label: "Source ID", | ||
description: "ID of the source to upload the account file.", | ||
async options({ page }) { | ||
const data = await this.listSoruceIds({ | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
params: { | ||
limit: LIMIT, | ||
offset: LIMIT * page, | ||
}, | ||
}); | ||
|
||
return data.map(({ | ||
id: value, name: label, | ||
}) => ({ | ||
label, | ||
value, | ||
})); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
_baseUrl() { | ||
return "https://sailpoint.api.identitynow.com/v2024"; | ||
}, | ||
_headers(headers = {}) { | ||
return { | ||
...headers, | ||
Accept: "application/json", | ||
Authorization: `Bearer ${this.$auth.oauth_access_token}`, | ||
}; | ||
}, | ||
_makeRequest({ | ||
$ = this, path, headers, ...opts | ||
}) { | ||
return axios($, { | ||
url: this._baseUrl() + path, | ||
headers: this._headers(headers), | ||
...opts, | ||
}); | ||
}, | ||
listIdentityIds(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/identities", | ||
headers: { | ||
"X-SailPoint-Experimental": true, | ||
}, | ||
...opts, | ||
}); | ||
}, | ||
listSoruceIds(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/sources", | ||
...opts, | ||
}); | ||
}, | ||
submitAccessRequest(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/access-requests", | ||
...opts, | ||
}); | ||
}, | ||
uploadSourceAccountFile({ | ||
sourceId, ...opts | ||
}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: `/sources/${sourceId}/schemas/accounts`, | ||
...opts, | ||
}); | ||
}, | ||
createWebhook(opts = {}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: "/trigger-subscriptions", | ||
headers: { | ||
"X-SailPoint-Experimental": true, | ||
}, | ||
...opts, | ||
}); | ||
}, | ||
deleteWebhook(webhookId) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: `/trigger-subscriptions/${webhookId}`, | ||
headers: { | ||
"X-SailPoint-Experimental": true, | ||
}, | ||
}); | ||
}, | ||
}, | ||
async *paginate({ | ||
fn, params = {}, maxResults = null, ...opts | ||
}) { | ||
let hasMore = false; | ||
let count = 0; | ||
let page = 0; | ||
|
||
do { | ||
params.page = ++page; | ||
const data = await fn({ | ||
params, | ||
...opts, | ||
}); | ||
for (const d of data) { | ||
yield d; | ||
|
||
if (maxResults && ++count === maxResults) { | ||
return count; | ||
} | ||
} | ||
|
||
hasMore = data.length; | ||
|
||
} while (hasMore); | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.