databricks-cli/libs/databrickscfg
Serge Smertin a6c9533c1c
Add profile on `databricks auth login` (#423)
## Changes
- added saving profile to `~/.databrickscfg` whenever we do `databricks
auth login`.
- we either match profile by account id / canonical host or introduce
the new one from deployment name.
- fail on multiple profiles with matching accounts or workspace hosts.
- overriding `~/.databrickscfg` keeps the (valid) comments, but
reformats the file.

## Tests
<!-- How is this tested? -->
- `make test`
- `go run main.go auth login --account-id XXX --host
https://accounts.cloud.databricks.com/`
- `go run main.go auth token --account-id XXX --host
https://accounts.cloud.databricks.com/`
- `go run main.go auth login --host https://XXX.cloud.databricks.com/`
2023-06-02 13:49:39 +02:00
..
testdata Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00
host.go Try to resolve a profile if only the host is specified (#287) 2023-03-29 20:44:19 +02:00
host_test.go Try to resolve a profile if only the host is specified (#287) 2023-03-29 20:44:19 +02:00
loader.go Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00
loader_test.go Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00
ops.go Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00
ops_test.go Add profile on `databricks auth login` (#423) 2023-06-02 13:49:39 +02:00