diff --git a/common/client.go b/common/client.go index 43a4b0631f..5dcf8e4f6d 100644 --- a/common/client.go +++ b/common/client.go @@ -53,12 +53,12 @@ func (c *DatabricksClient) Put(ctx context.Context, path string, request any) er return c.Do(ctx, http.MethodPut, path, request, nil, c.addApiPrefix) } -type apiVersion string +type ApiVersion string const ( - API_1_2 apiVersion = "1.2" - API_2_0 apiVersion = "2.0" - API_2_1 apiVersion = "2.1" + API_1_2 ApiVersion = "1.2" + API_2_0 ApiVersion = "2.0" + API_2_1 ApiVersion = "2.1" ) func (c *DatabricksClient) addApiPrefix(r *http.Request) error { @@ -66,7 +66,7 @@ func (c *DatabricksClient) addApiPrefix(r *http.Request) error { return fmt.Errorf("no URL found in request") } ctx := r.Context() - av, ok := ctx.Value(Api).(apiVersion) + av, ok := ctx.Value(Api).(ApiVersion) if !ok { av = API_2_0 } @@ -192,3 +192,13 @@ func (aa *DatabricksClient) GetAzureJwtProperty(key string) (any, error) { } return v, nil } + +func CommonEnvironmentClient() *DatabricksClient { + c, err := client.New(&config.Config{}) + if err != nil { + panic(err) + } + return &DatabricksClient{ + DatabricksClient: c, + } +} diff --git a/exporter/context.go b/exporter/context.go index 68d621b4c4..b52c73a465 100644 --- a/exporter/context.go +++ b/exporter/context.go @@ -113,7 +113,6 @@ func newImportContext(c *common.DatabricksClient) *importContext { p := provider.DatabricksProvider() p.TerraformVersion = "exporter" p.SetMeta(c) - c.Provider = p ctx := context.WithValue(context.Background(), common.Provider, p) ctx = context.WithValue(ctx, common.ResourceName, "exporter") c.WithCommandExecutor(func(