forked from rockcarver/frodo-lib
-
Notifications
You must be signed in to change notification settings - Fork 3
Changes for fr-config-manager commands #30
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
skootrivir
wants to merge
6
commits into
main
Choose a base branch
from
config-manager
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 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
639b62d
Squashed temp commit
skootrivir e1582cf
Deleted TermsAndConditionsApi.ts and Ops.ts files.
skootrivir 3f30623
Changed things according to the PR review.
skootrivir 7d1a008
Run lint, remove sanitize function, rename excludeDefault to includeD…
phalestrivir aa6c6a0
Renamed rawApi. Moved cli functionality to rawConfigOps
mricketttrivir 2db9540
Fix a bug, and add comments
phalestrivir 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
phalestrivir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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 util from 'util'; | ||
|
|
||
| import { State } from '../shared/State'; | ||
| import { getIdmBaseUrl } from '../utils/ForgeRockUtils'; | ||
| import { generateAmApi, generateEnvApi, generateIdmApi } from './BaseApi'; | ||
|
|
||
| const idmTemplate: string = '%s/%s'; | ||
| const amTemplate: string = '%s/%s'; | ||
| const envTemplate: string = '%s/environment/%s'; | ||
|
|
||
| export async function restGetRawIdm({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }) { | ||
| const urlString = util.format(idmTemplate, getIdmBaseUrl(state), url); | ||
| const { data } = await generateIdmApi({ state }).get(urlString); | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
| export async function restGetRawAm({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }) { | ||
| const urlString = util.format(amTemplate, state.getHost(), url); | ||
| const { data } = await generateAmApi({ | ||
| resource: { apiVersion: 'protocol=2.1,resource=1.0' }, | ||
| state, | ||
| }).get(urlString, { withCredentials: true }); | ||
|
|
||
| return data; | ||
| } | ||
|
|
||
| export async function restGetRawEnv({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }) { | ||
| const urlString = util.format( | ||
| envTemplate, | ||
| state | ||
| .getHost() | ||
| .split('/') | ||
| .filter((_, i, a) => i !== a.length - 1) | ||
| .join('/'), | ||
| url | ||
| ); | ||
| const { data } = await generateEnvApi({ | ||
| resource: { apiVersion: 'protocol=2.1,resource=1.0' }, | ||
| state, | ||
| }).get(urlString, { withCredentials: true }); | ||
|
|
||
| return data; | ||
| } |
phalestrivir marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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
phalestrivir marked this conversation as resolved.
Show resolved
Hide resolved
|
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
phalestrivir marked this conversation as resolved.
Show resolved
Hide resolved
|
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
phalestrivir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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,85 @@ | ||
| import { IdObjectSkeletonInterface } from '../api/ApiTypes'; | ||
| import { restGetRawAm, restGetRawEnv, restGetRawIdm } from '../api/RawApi'; | ||
| import { State } from '../shared/State'; | ||
| import { debugMessage } from '../utils/Console'; | ||
| import { FrodoError } from './FrodoError'; | ||
|
|
||
| export type Raw = { | ||
| exportRawIdm(url: string): Promise<IdObjectSkeletonInterface>; | ||
| exportRawAm(url: string): Promise<IdObjectSkeletonInterface>; | ||
| exportRawEnv(url: string): Promise<IdObjectSkeletonInterface>; | ||
| }; | ||
|
|
||
| export default (state: State) => { | ||
| return { | ||
| async exportRawIdm(url: string) { | ||
| return exportRawIdm({ state, url }); | ||
| }, | ||
| async exportRawAm(url: string) { | ||
| return exportRawAm({ state, url }); | ||
| }, | ||
| async exportRawEnv(url: string) { | ||
| return exportRawEnv({ state, url }); | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export async function exportRawIdm({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }): Promise<IdObjectSkeletonInterface> { | ||
| try { | ||
| debugMessage({ message: `Raw.exportRawIdm: start`, state }); | ||
| const raw = await restGetRawIdm({ state, url }); | ||
| debugMessage({ message: `Raw.exportRawIdm: end`, state }); | ||
| return raw; | ||
| } catch (error) { | ||
| throw new FrodoError( | ||
| `Error in exportRawIdm with relative url: ${url}`, | ||
| error | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export async function exportRawAm({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }): Promise<IdObjectSkeletonInterface> { | ||
| try { | ||
| debugMessage({ message: `Raw.exportRawAm: start`, state }); | ||
| const raw = await restGetRawAm({ state, url }); | ||
| debugMessage({ message: `Raw.exportRawAm: end`, state }); | ||
| return raw; | ||
| } catch (error) { | ||
| throw new FrodoError( | ||
| `Error in exportRawAm with relative url: ${url}`, | ||
| error | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export async function exportRawEnv({ | ||
| state, | ||
| url, | ||
| }: { | ||
| state: State; | ||
| url: string; | ||
| }): Promise<IdObjectSkeletonInterface> { | ||
| try { | ||
| debugMessage({ message: `Raw.exportRawEnv: start`, state }); | ||
| const raw = await restGetRawEnv({ state, url }); | ||
| debugMessage({ message: `Raw.exportRawEnv: end`, state }); | ||
| return raw; | ||
| } catch (error) { | ||
| throw new FrodoError( | ||
| `Error in exportRawEnv with relative url: ${url}`, | ||
| error | ||
| ); | ||
| } | ||
| } |
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.