forked from rockcarver/frodo-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add config-manager push iga-workflows command #103
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
dallinjsevy
wants to merge
8
commits into
main
Choose a base branch
from
feature/config-manager-push-iga-workflows
base: main
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b6ea289
feat: Add config-manager pull iga-workflows command
dallinjsevy 4bf5c34
fix wording in cli file. update and add tests. add comment to ops fil…
dallinjsevy 6f2fdbe
feat: add config-manager pull iga workflows
dallinjsevy b6efabe
fix export directory to match fr config manager
dallinjsevy 3c2aa08
feat: add config-manager push iga-workflows command
dallinjsevy ec02b61
wip
dallinjsevy 19f77f3
feat: add config-manager push iga-workflows command
dallinjsevy dd16f0a
wip
dallinjsevy 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 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,3 @@ | ||
| import chalk from 'chalk'; | ||
| chalk.level = 0; | ||
| delete process.env.FORCE_COLOR; |
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
62 changes: 62 additions & 0 deletions
62
src/cli/config-manager/config-manager-push/config-manager-push-iga-workflows.ts
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,62 @@ | ||
| import { frodo, state } from '@rockcarver/frodo-lib'; | ||
| import { Option } from 'commander'; | ||
|
|
||
| import { configManagerImportIgaWorkflows } from '../../../configManagerOps/FrConfigIgaWorkflowsOps'; | ||
| import { getTokens } from '../../../ops/AuthenticateOps'; | ||
| import { printMessage, verboseMessage } from '../../../utils/Console'; | ||
| import { FrodoCommand } from '../../FrodoCommand'; | ||
|
|
||
| const { CLOUD_DEPLOYMENT_TYPE_KEY } = frodo.utils.constants; | ||
|
|
||
| const deploymentTypes = [CLOUD_DEPLOYMENT_TYPE_KEY]; | ||
|
|
||
| export default function setup() { | ||
| const program = new FrodoCommand( | ||
| 'frodo config-manager push iga-workflows', | ||
| [], | ||
| deploymentTypes | ||
| ); | ||
| program | ||
| .description('Import iga-workflows.') | ||
| .addOption( | ||
| new Option( | ||
| '-n, --name <name>', | ||
| 'Workflow name. Only import the workflow with this name.' | ||
| ) | ||
| ) | ||
| .addOption( | ||
| new Option('-d, --draft', 'Push as draft version instead of publishing.') | ||
| ) | ||
| .action(async (host, realm, user, password, options, command) => { | ||
| command.handleDefaultArgsAndOpts( | ||
| host, | ||
| realm, | ||
| user, | ||
| password, | ||
| options, | ||
| command | ||
| ); | ||
|
|
||
| const getTokensIsSuccessful = await getTokens( | ||
| false, | ||
| true, | ||
| deploymentTypes | ||
| ); | ||
| if (!getTokensIsSuccessful) process.exit(1); | ||
| if (!state.getIsIGA()) { | ||
| printMessage( | ||
| 'Command not supported for non-IGA cloud tenants', | ||
| 'error' | ||
| ); | ||
| process.exitCode = 1; | ||
| return; | ||
| } | ||
| verboseMessage('Importing IGA workflows.'); | ||
| const outcome = await configManagerImportIgaWorkflows( | ||
| options.name, | ||
| options.draft | ||
| ); | ||
| if (!outcome) process.exitCode = 1; | ||
| }); | ||
| return program; | ||
| } |
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
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
29 changes: 29 additions & 0 deletions
29
test/client_cli/en/__snapshots__/config-manager-push-iga-workflows.test.js.snap
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,29 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`CLI help interface for 'config-manager push iga-workflows' should be expected english 1`] = ` | ||
| "Usage: frodo config-manager push iga-workflows [options] [host] [realm] [username] [password] | ||
|
|
||
| [Experimental] Import iga-workflows. | ||
|
|
||
| Arguments: | ||
| host AM base URL, e.g.: https://cdk.iam.example.com/am. To use a | ||
| connection profile, just specify a unique substring or | ||
| alias. | ||
| realm Realm. Specify realm as '/' for the root realm or 'realm' | ||
| or '/parent/child' otherwise. (default: "alpha" for | ||
| Identity Cloud tenants, "/" otherwise.) | ||
| username Username to login with. Must be an admin user with | ||
| appropriate rights to manage authentication journeys/trees. | ||
| password Password. | ||
|
|
||
| Deployment: Cloud-only | ||
|
|
||
| Options: | ||
| -d, --draft Push as draft version instead of publishing. | ||
| -n, --name <name> Workflow name. Only import the workflow with this name. | ||
| -h, --help Help | ||
| -hh, --help-more Help with all options. | ||
| -hhh, --help-all Help with all options, environment variables, and usage | ||
| examples. | ||
| " | ||
| `; |
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
10 changes: 10 additions & 0 deletions
10
test/client_cli/en/config-manager-push-iga-workflows.test.js
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,10 @@ | ||
| import cp from 'child_process'; | ||
| import { promisify } from 'util'; | ||
|
|
||
| const exec = promisify(cp.exec); | ||
| const CMD = 'frodo config-manager push iga-workflows --help'; | ||
| const { stdout } = await exec(CMD); | ||
|
|
||
| test("CLI help interface for 'config-manager push iga-workflows' should be expected english", async () => { | ||
| expect(stdout).toMatchSnapshot(); | ||
| }); |
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.