Skip to content

Commit

Permalink
add transcendUrl to the list of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
abrantesarthur committed Jan 14, 2025
1 parent 5f94a17 commit df76064
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,16 +598,17 @@ To learn how to generate the token, see the [OAuth 2.0 Scopes](https://developer

#### Arguments

| Argument | Description | Type | Default | Required |
| ------------- | ------------------------------------------------------------------------------------------------- | ------- | ----------- | -------- |
| hostname | The domain of the OneTrust environment from which to pull the resource (e.g. trial.onetrust.com). | string | N/A | true |
| oneTrustAuth | The OAuth access token with the scopes necessary to access the OneTrust Public APIs. | string | N/A | true |
| transcendAuth | The Transcend API Key to with the scopes necessary to access Transcend's Public APIs. | string | N/A | false |
| file | Path to the file to pull the resource into. Its format must match the fileFormat argument. | string | N/A | false |
| fileFormat | The format of the output file. | string | csv | false |
| resource | The resource to pull from OneTrust. For now, only assessments is supported. | string | assessments | false |
| dryRun | Whether to export the resource to a file rather than sync to Transcend. | boolean | false | false |
| debug | Whether to print detailed logs in case of error. | boolean | false | false |
| Argument | Description | Type | Default | Required |
| ------------- | ------------------------------------------------------------------------------------------------- | ------------ | ------------------------ | -------- |
| hostname | The domain of the OneTrust environment from which to pull the resource (e.g. trial.onetrust.com). | string | N/A | true |
| oneTrustAuth | The OAuth access token with the scopes necessary to access the OneTrust Public APIs. | string | N/A | true |
| transcendAuth | The Transcend API Key to with the scopes necessary to access Transcend's Public APIs. | string | N/A | false |
| transcendUrl | URL of the Transcend backend. Use https://api.us.transcend.io for US hosting. | string - URL | https://api.transcend.io | false |
| file | Path to the file to pull the resource into. Its format must match the fileFormat argument. | string | N/A | false |
| fileFormat | The format of the output file. | string | csv | false |
| resource | The resource to pull from OneTrust. For now, only assessments is supported. | string | assessments | false |
| dryRun | Whether to export the resource to a file rather than sync to Transcend. | boolean | false | false |
| debug | Whether to print detailed logs in case of error. | boolean | false | false |

#### Usage

Expand Down
14 changes: 13 additions & 1 deletion src/oneTrust/helpers/parseCliSyncOtArguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const parseCliSyncOtArguments = (): OneTrustCliArguments => {
fileFormat,
dryRun,
transcendAuth,
transcendUrl,
} = yargs(process.argv.slice(2), {
string: [
'file',
Expand All @@ -49,17 +50,19 @@ export const parseCliSyncOtArguments = (): OneTrustCliArguments => {
'fileFormat',
'dryRun',
'transcendAuth',
'transcendUrl',
],
boolean: ['debug', 'dryRun'],
default: {
resource: OneTrustPullResource.Assessments,
fileFormat: OneTrustFileFormat.Csv,
debug: false,
dryRun: false,
transcendUrl: 'https://api.transcend.io',
},
});

// Can only sync to Transcend via a CSV file format!
// Must be able to authenticate to transcend to sync resources to it
if (!dryRun && !transcendAuth) {
logger.error(
colors.red(
Expand All @@ -69,6 +72,15 @@ export const parseCliSyncOtArguments = (): OneTrustCliArguments => {
);
return process.exit(1);
}
if (!dryRun && !transcendUrl) {
logger.error(
colors.red(
// eslint-disable-next-line max-len
'Must specify a "transcendUrl" parameter to sync resources to Transcend. e.g. --transcendUrl=https://api.transcend.io',
),
);
return process.exit(1);
}

// Can only sync to Transcend via a CSV file format!
if (!dryRun && fileFormat !== OneTrustFileFormat.Csv) {
Expand Down

0 comments on commit df76064

Please sign in to comment.