Skip to content

Commit

Permalink
Added --token-file-path for connection add command (#1395)
Browse files Browse the repository at this point in the history
(cherry picked from commit edd5594)
  • Loading branch information
sfc-gh-astus committed Jul 31, 2024
1 parent 3ec42f8 commit d06a853
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/snowflake/cli/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class ConnectionConfig:
role: Optional[str] = None
authenticator: Optional[str] = None
private_key_path: Optional[str] = None
token_file_path: Optional[str] = None

_other_settings: dict = field(default_factory=lambda: {})

Expand Down
9 changes: 9 additions & 0 deletions src/snowflake/cli/plugins/connection/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ def add(
prompt="Path to private key file",
help="Path to file containing private key",
),
token_file_path: str = typer.Option(
EmptyInput(),
"--token-file-path",
"-t",
click_type=OptionalPrompt(),
prompt="Path to token file",
help="Path to file with an OAuth token that should be used when connecting to Snowflake",
),
set_as_default: bool = typer.Option(
False,
"--default",
Expand Down Expand Up @@ -246,6 +254,7 @@ def add(
role=role,
authenticator=authenticator,
private_key_path=private_key_path,
token_file_path=token_file_path,
),
)
if set_as_default:
Expand Down
4 changes: 4 additions & 0 deletions tests/__snapshots__/test_help_messages.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,10 @@
| [default: optional] |
| --private-key -k TEXT Path to file containing private key |
| [default: optional] |
| --token-file-path -t TEXT Path to file with an OAuth token that |
| should be used when connecting to |
| Snowflake |
| [default: optional] |
| --default If provided the connection will be |
| configured as default connection. |
| --help Show this message and exit. |
Expand Down

0 comments on commit d06a853

Please sign in to comment.