-
Notifications
You must be signed in to change notification settings - Fork 5
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
Update variable get to retrieve multiple variables #114
Conversation
169fe19
to
3b03216
Compare
pkg/cmd/variable.go
Outdated
if len(data) > 1 { | ||
cmd.Println("{") | ||
for k, v := range data { | ||
cmd.Printf(" %s: %s\n", k, string(v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generates json output like this:
{
dev:variable:secret: testing
dev:variable:top-secret: testing
}
Is that the same as the Python CLI used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The python CLI quotes the variables and only displays the partial id
{
"secret": "123",
"top-secret": "456"
}
Updated to match the Python CLI
606988a
to
b0a6ed1
Compare
if versionStr == "" { | ||
data, err = client.RetrieveSecret(id) | ||
data, err = client.RetrieveBatchSecretsSafe(id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if there's any detriment to using RetrieveBatchSecretsSafe
for a single variable instead of using RetrieveSecret
- did some experimenting with dev environment, and they seem to be equally performant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are similar APIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the REST API for the two versions, there doesn't seem to be much overhead using the batch version.
curl -H "$(conjur authenticate -H)" http://conjur/secrets/dev/variable/secret
George
curl -H "$(conjur authenticate -H)" http://conjur/secrets?variable_ids=dev:variable:secret
{"dev:variable:secret":"George"}
pkg/cmd/variable.go
Outdated
Long: `Use the get subcommand to get the value of one or more Conjur variables | ||
|
||
Examples: | ||
- conjur variable set -i secret -v my_secret_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: set
example in get
help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, removed that one.
b0a6ed1
to
ab79170
Compare
Code Climate has analyzed commit ab79170 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 81.1% (0.2% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Desired Outcome
The
variable get
command should support getting multiple variables.Implemented Changes
Updated the variable command to support multiple variables.
Updated go.mod to pull in the latest api that includes the latest hostfactory ID parser.
Getting a single variable will print out the variable as before
Getting multiple secrets will print out the secret and the full variable name
Note: The Python CLI requires the two variables to be separated by a space, and the conjur CLI
requires a comma
Connected Issue/Story
CyberArk internal issue ID: ONYX-33517
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
README
s) were updated in this PRBehavior
Security