MonkeyCanCode opened a new pull request, #4465:
URL: https://github.com/apache/polaris/pull/4465

   <!--
   ๐Ÿ“ Describe what changes you're proposing, especially breaking or user-facing 
changes. 
   ๐Ÿ“– See https://github.com/apache/polaris/blob/main/CONTRIBUTING.md for more.
   -->
   
   This is second time where we got asked to support REPL 
(https://lists.apache.org/thread/mgfo0vyxjqb47bkp09d2gw8162f3n2kw). This PR 
adds the REPL support for Polaris CLI.
   
   *Sample outputs:*
   
   Start REPL session via host/port/client-id/client-secret:
   ```
   โžœ  polaris git:(cli_repl) ./polaris --host localhost --port 8181 --client-id 
root --client-secret s3cr3t repl
   Welcome to the Apache Polaris CLI REPL. Type 'help' for commands, 'exit' or 
Ctrl-D to quit.
   Note: global auth flags (--host, --port, --profile, --client-id, 
--client-secret, ...) are bound at session start and ignored when re-specified 
inside the REPL.
   polaris@localhost:8181>
   ```
   
   Start REPL session via profile:
   ```
   โžœ  polaris git:(cli_repl) ./polaris --profile dev repl
   Welcome to the Apache Polaris CLI REPL. Type 'help' for commands, 'exit' or 
Ctrl-D to quit.
   Note: global auth flags (--host, --port, --profile, --client-id, 
--client-secret, ...) are bound at session start and ignored when re-specified 
inside the REPL.
   polaris@dev>
   ```
   
   Top level help:
   ```
   polaris@dev> help
   Polaris commands:
    catalogs        manage catalogs
    principals      manage principals
    principal-roles manage principal roles
    catalog-roles   manage catalog roles
    privileges      manage privileges for a catalog role
    namespaces      manage namespaces
    profiles        manage profiles
    policies        manage policies
    setup           perform setup
    tables          manage tables
    find            find an identifier
    repl            start an interactive REPL session
   REPL built-ins: exit, help, Ctrl-D
   
   Use 'help <command>' or '<command --help>' for command details.
   ```
   
   Help command on another command:
   ```
   polaris@dev> help principals
   usage: polaris principals [-h] [options] SUBCOMMAND ...
   
   options:
     -h, --help            show this help message and exit
   
   Subcommands:
     SUBCOMMAND
       create              Create a new principal
       delete              Delete a principal
       get                 Retrieve metadata for a principal
       list                List principals
       rotate-credentials  Rotate credentials for a principal
       update              Update properties of a principal
       access              Retrieve access details for a principal
       reset               Reset credentials for a principal
       summarize           Display a summary for a principal
   ```
   
   Help option from command
   ```
   polaris@dev> principals --help
   usage: polaris principals [-h] [options] SUBCOMMAND ...
   
   options:
     -h, --help            show this help message and exit
   
   Subcommands:
     SUBCOMMAND
       create              Create a new principal
       delete              Delete a principal
       get                 Retrieve metadata for a principal
       list                List principals
       rotate-credentials  Rotate credentials for a principal
       update              Update properties of a principal
       access              Retrieve access details for a principal
       reset               Reset credentials for a principal
       summarize           Display a summary for a principal
   ```
   
   Create a new principal:
   ```
   polaris@dev> principals create test_principal
   {"clientId": "3e6665fe17715085", "clientSecret": 
"57ad1ec91382cab04b73f23cd466b00a"}
   ```
   
   List all principals:
   ```
   polaris@dev> principals list
   {"name": "root", "clientId": "root", "properties": {}, "createTimestamp": 
1778964018874, "lastUpdateTimestamp": 1778964018874, "entityVersion": 1}
   {"name": "test_principal", "clientId": "3e6665fe17715085", "properties": {}, 
"createTimestamp": 1778967344920, "lastUpdateTimestamp": 1778967344920, 
"entityVersion": 1}
   ```
   
   ## Checklist
   - [x] ๐Ÿ›ก๏ธ Don't disclose security issues! (contact [email protected])
   - [x] ๐Ÿ”— Clearly explained why the changes are needed, or linked related 
issues: Fixes #
   - [x] ๐Ÿงช Added/updated tests with good coverage, or manually tested (and 
explained how)
   - [x] ๐Ÿ’ก Added comments for complex logic
   - [x] ๐Ÿงพ Updated `CHANGELOG.md` (if needed)
   - [x] ๐Ÿ“š Updated documentation in `site/content/in-dev/unreleased` (if needed)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to