Skip to content

Commit

Permalink
[Internal] Refactored client.ClientForHost to use Go SDK method (#3735
Browse files Browse the repository at this point in the history
)

## Changes
<!-- Summary of your changes that are easy to understand -->
- Use Go SDK to construct workspace client from account client, instead
of manual replacement
- Closes #3734

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [x] `make test` run locally
- [x] covered with integration tests in `internal/acceptance`
- [x] relevant acceptance tests are passing
- [x] using Go SDK
  • Loading branch information
nkvuong authored Jul 28, 2024
1 parent 5bc75c6 commit 9539a31
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,9 @@ func (c *DatabricksClient) ClientForHost(ctx context.Context, url string) (*Data
if err != nil {
return nil, fmt.Errorf("cannot authenticate parent client: %w", err)
}
cfg := &config.Config{
Host: url,
Username: c.Config.Username,
Password: c.Config.Password,
AuthType: c.Config.AuthType,
Token: c.Config.Token,
ClientID: c.Config.ClientID,
ClientSecret: c.Config.ClientSecret,
GoogleServiceAccount: c.Config.GoogleServiceAccount,
GoogleCredentials: c.Config.GoogleCredentials,
InsecureSkipVerify: c.Config.InsecureSkipVerify,
HTTPTimeoutSeconds: c.Config.HTTPTimeoutSeconds,
DebugTruncateBytes: c.Config.DebugTruncateBytes,
DebugHeaders: c.Config.DebugHeaders,
RateLimitPerSecond: c.Config.RateLimitPerSecond,
cfg, err := c.DatabricksClient.Config.NewWithWorkspaceHost(url)
if err != nil {
return nil, fmt.Errorf("cannot configure new client: %w", err)
}
client, err := client.New(cfg)
if err != nil {
Expand Down

0 comments on commit 9539a31

Please sign in to comment.