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

[CLOUDGA-25136] Support to associate allow list with API keys #288

Merged
merged 3 commits into from
Jan 17, 2025

Conversation

bhupendray-yb
Copy link
Contributor

@bhupendray-yb bhupendray-yb commented Jan 15, 2025

Summary:

  • Added an argument to optionally associate allow lists in CREATE API keys command.
  • Show allow lists in LIST API keys command.
  • In list API keys cmd, only list ACTIVE API keys by default. Currently it shows revoked/expired keys as well.
  • Added tests for API key commands.
  • This whole allow list argument and output column is under feature flag.

feature flag:

export YBM_FF_API_KEY_ALLOW_LIST=true

Create API key with Allow Lists

> mb && ./ybm api-key create --name admin-nal --duration 1 --unit hours --role-name Viewer --network-allow-lists "fsdfs,my-mac"
Name        Role      Status    Created By   Date Created               Last Used      Expiration                    Allow List
admin-nal   Viewer    ACTIVE    working      2025-01-15T07:12:32.768Z   Not yet used   2025-01-15T08:12:32.768131Z   my-mac, fsdfs

API Key: <redacted>

List API keys:

> mb && ./ybm api-key list
Name         Role      Status    Created By                     Date Created               Last Used                     Expiration                    Allow List
admin-nal    Viewer    ACTIVE    working                        2025-01-15T07:12:32.768Z   Not yet used                  2025-01-15T08:12:32.768131Z   my-mac, fsdfs
admin-nal1   Viewer    ACTIVE    working                        2025-01-15T07:26:11.497Z   Not yet used                  2025-01-15T08:26:11.497778Z   my-mac, fsdfs
mapurggbsw   Admin     ACTIVE    hola-amigo                     2024-12-24T10:12:05.480Z   Not yet used                  2025-01-23T10:12:05.479938Z   N/A
okybxuiyag   Admin     ACTIVE    hola-amigo                     2024-12-24T10:15:33.600Z   Not yet used                  2025-01-23T10:15:33.600203Z   now
ogevazvluy   Admin     ACTIVE    hola-amigo                     2024-12-24T13:53:12.047Z   Not yet used                  2025-01-23T13:53:12.047303Z   now
grtxlbzgfe   Admin     ACTIVE    hola-amigo                     2024-12-26T09:35:27.479Z   Not yet used                  2025-01-25T09:35:27.478924Z   now

@bhupendray-yb bhupendray-yb marked this pull request as ready for review January 15, 2025 08:46
@bhupendray-yb bhupendray-yb requested a review from a team as a code owner January 15, 2025 08:46
Copy link
Contributor

@bansal01yash bansal01yash left a comment

Choose a reason for hiding this comment

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

Can you add the snippets of errors and help when FF disabled vs enabled.

cmd/api_key/api_key.go Outdated Show resolved Hide resolved
cmd/api_key/api_key.go Outdated Show resolved Hide resolved
cmd/api_key/api_key.go Outdated Show resolved Hide resolved
@bhupendray-yb
Copy link
Contributor Author

Can you add the snippets of errors and help when FF disabled vs enabled.

https://github.com/yugabyte/ybm-cli/pull/288/files#diff-3628a3f9493ebb92f548c19f6b9f015638aec51eeaa9f7dfd4219b7de8f32e41R107-R119

@bhupendray-yb bhupendray-yb merged commit b37f887 into main Jan 17, 2025
1 check passed
@bhupendray-yb bhupendray-yb deleted the CLOUDGA-25136 branch January 17, 2025 08:04
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.

3 participants