Skip to content
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

(#1268) Add mappings action to auth command #1285

Merged
merged 2 commits into from
Mar 14, 2025

Conversation

ploubser
Copy link
Collaborator

mappings has add, rm, list and info commands.

Add can take a --config flag pointing at a valid jwt, which it will then parse and extract the mappings from it.

@ploubser ploubser marked this pull request as draft February 26, 2025 13:58
@ploubser ploubser force-pushed the issue_1268 branch 4 times, most recently from 5a4d885 to cd6abfe Compare March 12, 2025 13:56
@ploubser ploubser marked this pull request as ready for review March 12, 2025 13:57
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great other than that thing about the file, probably I wasn't clear about what I wanted :)

mappingsaAdd.Arg("target", "The target subject of the mapping").StringVar(&c.mapTarget)
mappingsaAdd.Arg("weight", "The weight (%) of the mappingmapping").Default("100").UintVar(&c.mapWeight)
mappingsaAdd.Flag("operator", "Operator to act on").StringVar(&c.operatorName)
mappingsaAdd.Flag("config", "JWT file to read configuration from").ExistingFileVar(&c.inputFile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, not sure we can really say read from a JWT, the idea with loading is that users can easily write a mapping in a file and load just that mapping, so we can kind of need to just load the jwt.Mapping from a file in json/yaml format

So I dont think for that use case users really would have JWTs around, its a convenient way to avoid all the flags and stuff

mappingsls.Flag("operator", "Operator to act on").StringVar(&c.operatorName)

mappingsrm := mappings.Command("rm", "Remove a mapping").Action(c.mappingRmAction)
mappingsrm.Arg("account", "Account to create the mappings on").StringVar(&c.accountName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...remove the mappings from

@ploubser ploubser force-pushed the issue_1268 branch 2 times, most recently from 74a01e0 to 9faa8af Compare March 14, 2025 11:37
@ploubser
Copy link
Collaborator Author

Yeah woops, completely spoke past each other there. Updated to read the config from json/yaml

@ploubser ploubser requested a review from ripienaar March 14, 2025 11:40
mappings has `add`, `rm`, `list` and `info` commands.

Add can take a --config flag pointing at a valid jwt, which it will then
parse and extract the mappings from it.
Copy link
Collaborator

@ripienaar ripienaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ripienaar ripienaar merged commit 43bca2b into nats-io:main Mar 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants