-
Notifications
You must be signed in to change notification settings - Fork 2
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
add support for syncing Assessments from OneTrust to Transcend #376
base: main
Are you sure you want to change the base?
Changes from 77 commits
1dfa3c3
de282db
10c1998
f68e17c
9333325
559ab87
35bab06
5d9def9
4822fba
5636c78
2ca1f64
531a240
ab072df
edd5c70
22ae8b1
460f25c
ccd64ae
f90fcd5
3b08994
e80c95e
ec8e77c
35d5fd7
c0e9d26
930a1ba
6538e41
bb8dd28
e104337
ee8b072
d6052b1
b1c5f6b
ae91ee2
80c3f72
2c12a0e
24841f1
8480eaf
bd5842c
b26cb56
3ac69be
f9be7b6
ad32c0a
2b05b5d
74666c2
da299c3
799e41c
30f3a4c
239a72d
ae5522f
4b428dc
13e80e9
d11609e
7647c02
5dae37d
4256788
6ec35ba
5f94a17
df76064
b424c03
414e84e
70956b6
a8500c6
ae821ae
ca7f66b
7692cd4
eda427b
f8ef92e
e4176be
4409674
66bfc71
b34e3f9
b65036b
bd5e882
7b4ee5b
dedf1b8
7a83891
148b0e4
de53f5e
34de61b
4deaa2d
cf23df8
fa17027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env node | ||
import { logger } from './logger'; | ||
|
||
import colors from 'colors'; | ||
import { parseCliSyncOtArguments, createOneTrustGotInstance } from './oneTrust'; | ||
import { OneTrustPullResource } from './enums'; | ||
import { syncOneTrustAssessments } from './oneTrust/helpers/syncOneTrustAssessments'; | ||
import { buildTranscendGraphQLClient } from './graphql'; | ||
|
||
/** | ||
* Pull configuration from OneTrust down locally to disk | ||
* | ||
* Dev Usage: | ||
* yarn ts-node ./src/cli-sync-ot.ts --hostname=customer.my.onetrust.com --oneTrustAuth=$ONE_TRUST_OAUTH_TOKEN --transcendAuth=$TRANSCEND_API_KEY | ||
* | ||
* Standard usage | ||
* yarn cli-sync-ot --hostname=customer.my.onetrust.com --oneTrustAuth=$ONE_TRUST_OAUTH_TOKEN --transcendAuth=$TRANSCEND_API_KEY | ||
*/ | ||
async function main(): Promise<void> { | ||
const { | ||
file, | ||
fileFormat, | ||
hostname, | ||
oneTrustAuth, | ||
transcendAuth, | ||
transcendUrl, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so transcendAuth + transcendUrl are optional? If they don't pass it in we'll just save to disk? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, with a caveat: the criteria for saving to disk is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait i thought dryrun=true would mean don't upload to Transcend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, you're right! I meant |
||
resource, | ||
debug, | ||
dryRun, | ||
} = parseCliSyncOtArguments(); | ||
|
||
// use the hostname and auth token to instantiate a client to talk to OneTrust | ||
const oneTrust = createOneTrustGotInstance({ hostname, auth: oneTrustAuth }); | ||
|
||
try { | ||
if (resource === OneTrustPullResource.Assessments) { | ||
await syncOneTrustAssessments({ | ||
oneTrust, | ||
file, | ||
fileFormat, | ||
dryRun, | ||
...(transcendAuth && transcendUrl | ||
? { | ||
transcend: buildTranscendGraphQLClient( | ||
transcendUrl, | ||
transcendAuth, | ||
), | ||
} | ||
: {}), | ||
}); | ||
} | ||
} catch (err) { | ||
logger.error( | ||
colors.red( | ||
`An error occurred syncing the resource ${resource} from OneTrust: ${ | ||
debug ? err.stack : err.message | ||
}`, | ||
), | ||
); | ||
process.exit(1); | ||
} | ||
|
||
// Indicate success | ||
logger.info( | ||
colors.green( | ||
`Successfully synced OneTrust ${resource} to ${ | ||
dryRun ? `disk at "${file}"` : 'Transcend' | ||
}!`, | ||
), | ||
); | ||
} | ||
|
||
main(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth trying to convey that some arguments are conditionally required? E.g. I assume if you have
--dryRun
thenfile
is required, and if you don't thentranscendAuth
/transcendUrl
are required