-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from rockcarver/3.0.1
PATCH RELEASE
- Loading branch information
Showing
949 changed files
with
758,175 additions
and
310,138 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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,55 @@ | ||
import { Option } from 'commander'; | ||
|
||
import { getTokens } from '../../ops/AuthenticateOps'; | ||
import { deleteConfigEntityById } from '../../ops/IdmOps'; | ||
import { FrodoCommand } from '../FrodoCommand'; | ||
|
||
export default function setup() { | ||
const program = new FrodoCommand('frodo idm delete'); | ||
|
||
interface ServiceDeleteOptions { | ||
id?: string; | ||
type?: string; | ||
insecure?: boolean; | ||
verbose?: boolean; | ||
debug?: boolean; | ||
curlirize?: boolean; | ||
all?: boolean; | ||
global?: boolean; | ||
} | ||
|
||
program | ||
.description('Delete AM services.') | ||
.addOption(new Option('-i, --id <id>', 'Id of Service to be deleted.')) | ||
.action( | ||
async ( | ||
host: string, | ||
realm: string, | ||
user: string, | ||
password: string, | ||
options: ServiceDeleteOptions, | ||
command | ||
) => { | ||
command.handleDefaultArgsAndOpts( | ||
host, | ||
realm, | ||
user, | ||
password, | ||
options, | ||
command | ||
); | ||
|
||
// const globalConfig = options.global ?? false; | ||
|
||
if (options.id && (await getTokens())) { | ||
const outcome = await deleteConfigEntityById(options.id); | ||
if (!outcome) process.exitCode = 1; | ||
} else { | ||
program.help(); | ||
process.exitCode = 1; | ||
} | ||
} | ||
); | ||
|
||
return program; | ||
} |
This file contains 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 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,131 @@ | ||
import { state } from '@rockcarver/frodo-lib'; | ||
import { Option } from 'commander'; | ||
|
||
import { getTokens } from '../../ops/AuthenticateOps'; | ||
import { | ||
exportConfigEntityToFile, | ||
exportManagedObjectToFile, | ||
warnAboutOfflineConnectorServers, | ||
} from '../../ops/IdmOps'; | ||
import { printMessage, verboseMessage } from '../../utils/Console'; | ||
import { FrodoCommand } from '../FrodoCommand'; | ||
|
||
const deploymentTypes = ['cloud', 'forgeops']; | ||
|
||
export default function setup() { | ||
const program = new FrodoCommand( | ||
'frodo idm schema object export', | ||
[], | ||
deploymentTypes | ||
); | ||
|
||
program | ||
.description('Export IDM configuration managed objects.') | ||
.addOption( | ||
new Option( | ||
'-a, --all', | ||
'Export all IDM configuration managed objects into a single file in directory -D.' | ||
) | ||
) | ||
.addOption( | ||
new Option( | ||
'-A, --all-separate', | ||
'Export all IDM configuration managed objects into separate JSON files in directory -D.' | ||
) | ||
) | ||
.addOption( | ||
new Option( | ||
'-i, --individual-object <name>', | ||
'Export an individual managed object by specifying an objects name. E.g. "alpha_user", "bravo_role", etc. If specified, -a and -A are ignored.' | ||
) | ||
) | ||
.addOption(new Option('-f, --file [file]', 'Export file. Ignored with -A.')) | ||
.addOption(new Option('-e, --env-file [envfile]', 'Name of the env file.')) | ||
.addOption( | ||
new Option( | ||
'-N, --no-metadata', | ||
'Does not include metadata in the export file.' | ||
) | ||
) | ||
.action( | ||
// implement command logic inside action handler | ||
async (host, realm, user, password, options, command) => { | ||
command.handleDefaultArgsAndOpts( | ||
host, | ||
realm, | ||
user, | ||
password, | ||
options, | ||
command | ||
); | ||
const envMessage = options.envFile | ||
? ` using ${options.envFile} for variable replacement` | ||
: ''; | ||
const fileMessage = options.file ? ` into ${options.file}` : ''; | ||
const directoryMessage = state.getDirectory() | ||
? ` into separate files in ${state.getDirectory()}` | ||
: ''; | ||
// -i, --individual-object <name> | ||
if ( | ||
options.individualObject && | ||
(await getTokens(false, true, deploymentTypes)) | ||
) { | ||
verboseMessage( | ||
`Exporting managed object "${options.individualObject}"${envMessage}${fileMessage}...` | ||
); | ||
const outcome = await exportManagedObjectToFile( | ||
options.individualObject, | ||
options.file, | ||
options.envFile | ||
); | ||
if (!outcome) process.exitCode = 1; | ||
} // -a, --all | ||
else if ( | ||
options.all && | ||
(await getTokens(false, true, deploymentTypes)) | ||
) { | ||
verboseMessage( | ||
`Exporting managed objects ${envMessage}${fileMessage}...` | ||
); | ||
const outcome = await exportConfigEntityToFile( | ||
'managed', | ||
options.file, | ||
options.envFile, | ||
false, | ||
false, | ||
options.metadata | ||
); | ||
if (!outcome) process.exitCode = 1; | ||
} // -A, --all-separate | ||
else if ( | ||
options.allSeparate && | ||
(await getTokens(false, true, deploymentTypes)) | ||
) { | ||
verboseMessage( | ||
`Exporting managed objects ${envMessage}${directoryMessage}...` | ||
); | ||
const outcome = await exportConfigEntityToFile( | ||
'managed', | ||
options.file, | ||
options.envFile, | ||
false, | ||
true, | ||
options.metadata | ||
); | ||
if (!outcome) process.exitCode = 1; | ||
await warnAboutOfflineConnectorServers(); | ||
} // unrecognized combination of options or no options | ||
else { | ||
printMessage( | ||
'Unrecognized combination of options or no options...', | ||
'error' | ||
); | ||
program.help(); | ||
process.exitCode = 1; | ||
} | ||
} | ||
// end command logic inside action handler | ||
); | ||
|
||
return program; | ||
} |
Oops, something went wrong.