diff --git a/.github/workflows/next-changelog.yml b/.github/workflows/next-changelog.yml old mode 100644 new mode 100755 diff --git a/account_client.go b/account_client.go index f5bfb4045..9e21ae3e1 100755 --- a/account_client.go +++ b/account_client.go @@ -488,9 +488,6 @@ func NewAccountClient(c ...*Config) (*AccountClient, error) { if err != nil { return nil, err } - if cfg.AccountID == "" || cfg.HostType() == config.WorkspaceHost { - return nil, ErrNotAccountClient - } apiClient, err := client.New(cfg) if err != nil { return nil, err diff --git a/account_functions.go b/account_functions.go index 4f4a33613..eef64a194 100644 --- a/account_functions.go +++ b/account_functions.go @@ -63,10 +63,6 @@ func (c *AccountClient) GetWorkspaceClient(ws provisioning.Workspace) (*Workspac } cfg.AzureResourceID = ws.AzureResourceId() cfg.WorkspaceID = fmt.Sprintf("%d", ws.WorkspaceId) - if c.Config.Experimental_IsUnifiedHost { - cfg.AccountID = c.Config.AccountID - cfg.Experimental_IsUnifiedHost = true - } w, err := NewWorkspaceClient((*Config)(cfg)) if err != nil { return nil, err diff --git a/client/client_test.go b/client/client_test.go index 78133b8b0..4a19871c7 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -22,6 +22,15 @@ import ( type hc func(r *http.Request) (*http.Response, error) func (cb hc) RoundTrip(r *http.Request) (*http.Response, error) { + // Return 404 for host metadata endpoint to prevent config resolution + // from interfering with test assertions. + if r.Method == "GET" && r.URL.Path == "/.well-known/databricks-config" { + return &http.Response{ + StatusCode: 404, + Body: io.NopCloser(strings.NewReader(`{"error_code":"NOT_FOUND","message":"host metadata endpoint auto-stubbed by test framework"}`)), + Request: r, + }, nil + } return cb(r) } diff --git a/config/auth_azure_msi.go b/config/auth_azure_msi.go index 62f16e249..c1af908a0 100644 --- a/config/auth_azure_msi.go +++ b/config/auth_azure_msi.go @@ -14,8 +14,10 @@ import ( "golang.org/x/oauth2" ) -var errInvalidToken = errors.New("invalid token") -var errInvalidTokenExpiry = errors.New("invalid token expiry") +var ( + errInvalidToken = errors.New("invalid token") + errInvalidTokenExpiry = errors.New("invalid token expiry") +) // well-known URL for Azure Instance Metadata Service (IMDS) // https://learn.microsoft.com/en-us/azure-stack/user/instance-metadata-service @@ -24,19 +26,20 @@ var instanceMetadataPrefix = "http://169.254.169.254/metadata" // timeout to wait for IMDS response const azureMsiTimeout = 10 * time.Second -type AzureMsiCredentials struct { -} +type AzureMsiCredentials struct{} func (c AzureMsiCredentials) Name() string { return "azure-msi" } func (c AzureMsiCredentials) Configure(ctx context.Context, cfg *Config) (credentials.CredentialsProvider, error) { - if !cfg.IsAzure() || !cfg.AzureUseMSI || (cfg.AzureResourceID == "" && cfg.ConfigType() == WorkspaceConfig) { + if !cfg.IsAzure() || !cfg.AzureUseMSI || (cfg.AzureResourceID == "" && cfg.Host == "") { return nil, nil } env := cfg.Environment() - if !cfg.IsAccountClient() { + // If the host is not set, we need to resolve it from the Azure Resource ID. + // This is only needed for Workspaces, because Accounts always have a host. + if cfg.Host == "" { err := cfg.azureEnsureWorkspaceUrl(ctx, c) if err != nil { return nil, fmt.Errorf("resolve host: %w", err) diff --git a/config/auth_azure_msi_test.go b/config/auth_azure_msi_test.go index f86a48266..d3aeb60e1 100644 --- a/config/auth_azure_msi_test.go +++ b/config/auth_azure_msi_test.go @@ -121,6 +121,33 @@ func TestMsiTokenNotFound(t *testing.T) { require.ErrorIs(t, err, apierr.ErrNotFound) } +func TestMsiHappyFlowWithHostAndNoResourceID(t *testing.T) { + assertHeaders(t, &Config{ + Host: "https://adb-123.4.azuredatabricks.net", + AzureUseMSI: true, + AuthType: "azure-msi", + HTTPTransport: fixtures.MappingTransport{ + "GET /metadata/identity/oauth2/token?api-version=2018-02-01&resource=2ff814a6-3304-4ab8-85cb-cd0e6f879c1d": { + ExpectedHeaders: map[string]string{ + "Accept": "application/json", + "Metadata": "true", + }, + Response: someValidToken("cde"), + }, + "GET /metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.core.windows.net%2F": { + ExpectedHeaders: map[string]string{ + "Accept": "application/json", + "Metadata": "true", + }, + Response: someValidToken("def"), + }, + }, + }, map[string]string{ + "Authorization": "Bearer cde", + "X-Databricks-Azure-Sp-Management-Token": "def", + }) +} + func TestMsiInvalidTokenExpiry(t *testing.T) { _, err := authenticateRequest(&Config{ AzureUseMSI: true, diff --git a/config/auth_oidc_test.go b/config/auth_oidc_test.go index 7bdc8b7f2..caf8cf6fd 100644 --- a/config/auth_oidc_test.go +++ b/config/auth_oidc_test.go @@ -74,6 +74,9 @@ func TestGithubOIDC_Scopes(t *testing.T) { "expires_in": 3600, }) + case "/.well-known/databricks-config": + http.Error(w, "Not found", http.StatusNotFound) + default: t.Errorf("Unexpected request: %s %s", r.Method, r.URL.Path) http.Error(w, "Not found", http.StatusNotFound) diff --git a/config/cli_token_source.go b/config/cli_token_source.go index 5d0a1a680..cb502130b 100644 --- a/config/cli_token_source.go +++ b/config/cli_token_source.go @@ -70,14 +70,6 @@ func buildCliCommands(cliPath string, cfg *Config) (primaryCmd []string, hostCmd func buildHostCommand(cliPath string, cfg *Config) []string { cmd := []string{cliPath, "auth", "token", "--host", cfg.Host} switch cfg.HostType() { - case UnifiedHost: - cmd = append(cmd, "--experimental-is-unified-host") - if cfg.AccountID != "" { - cmd = append(cmd, "--account-id", cfg.AccountID) - } - if cfg.WorkspaceID != "" { - cmd = append(cmd, "--workspace-id", cfg.WorkspaceID) - } case AccountHost: cmd = append(cmd, "--account-id", cfg.AccountID) } diff --git a/config/cli_token_source_test.go b/config/cli_token_source_test.go index 74fda54ed..153a3dffb 100644 --- a/config/cli_token_source_test.go +++ b/config/cli_token_source_test.go @@ -152,50 +152,13 @@ func TestBuildCliCommands(t *testing.T) { wantCmd: []string{cliPath, "auth", "token", "--host", accountHost, "--account-id", accountID}, }, { - name: "unified host with account ID and workspace ID", + name: "former unified host treated as workspace", cfg: &Config{ - Host: unifiedHost, - Experimental_IsUnifiedHost: true, - AccountID: accountID, - WorkspaceID: workspaceID, + Host: unifiedHost, + AccountID: accountID, + WorkspaceID: workspaceID, }, - wantCmd: []string{cliPath, "auth", "token", "--host", unifiedHost, "--experimental-is-unified-host", "--account-id", accountID, "--workspace-id", workspaceID}, - }, - { - name: "unified host with account ID only", - cfg: &Config{ - Host: unifiedHost, - Experimental_IsUnifiedHost: true, - AccountID: accountID, - }, - wantCmd: []string{cliPath, "auth", "token", "--host", unifiedHost, "--experimental-is-unified-host", "--account-id", accountID}, - }, - { - name: "unified host with workspace ID only", - cfg: &Config{ - Host: unifiedHost, - Experimental_IsUnifiedHost: true, - WorkspaceID: workspaceID, - }, - wantCmd: []string{cliPath, "auth", "token", "--host", unifiedHost, "--experimental-is-unified-host", "--workspace-id", workspaceID}, - }, - { - name: "unified host with no account ID or workspace ID", - cfg: &Config{ - Host: unifiedHost, - Experimental_IsUnifiedHost: true, - }, - wantCmd: []string{cliPath, "auth", "token", "--host", unifiedHost, "--experimental-is-unified-host"}, - }, - { - // Explicit false should fall back to the standard host type detection - name: "unified host false with account host", - cfg: &Config{ - Host: accountHost, - Experimental_IsUnifiedHost: false, - AccountID: accountID, - }, - wantCmd: []string{cliPath, "auth", "token", "--host", accountHost, "--account-id", accountID}, + wantCmd: []string{cliPath, "auth", "token", "--host", unifiedHost}, }, { name: "profile uses --profile with --host fallback", diff --git a/config/config.go b/config/config.go index 8f94b387b..374e9d4fd 100644 --- a/config/config.go +++ b/config/config.go @@ -379,14 +379,9 @@ func (c *Config) IsAws() bool { } // IsAccountClient returns true if client is configured for Accounts API. -// Panics if the config has the unified host flag set. // // Deprecated: Use HostType() if possible, or ConfigType() if necessary. func (c *Config) IsAccountClient() bool { - if c.Experimental_IsUnifiedHost { - panic("IsAccountClient cannot be used with unified hosts; use HostType() instead") - } - if c.AccountID != "" && c.isTesting { return true } @@ -413,11 +408,13 @@ func normalizedHost(host string) string { } // HostType returns the type of host that the client is configured for. +// HostType now only returns WorkspaceHost or AccountHost. UnifiedHost is +// deprecated; host metadata resolution handles unified host behavior. func (c *Config) HostType() HostType { + // TODO: Remove this after TF updates its code. if c.Experimental_IsUnifiedHost { return UnifiedHost } - // TODO: Refactor tests so that this is not needed. if c.AccountID != "" && c.isTesting { return AccountHost @@ -452,15 +449,6 @@ func (c *Config) ConfigType() ConfigType { return AccountConfig case WorkspaceHost: return WorkspaceConfig - case UnifiedHost: - if c.AccountID == "" { - // All unified host configs must have an account ID - return InvalidConfig - } - if c.WorkspaceID != "" { - return WorkspaceConfig - } - return AccountConfig default: return InvalidConfig } @@ -520,9 +508,7 @@ func (c *Config) EnsureResolved() error { } slices.Sort(c.Scopes) c.Scopes = slices.Compact(c.Scopes) - if c.Experimental_IsUnifiedHost { - c.resolveHostMetadata(ctx) - } + c.resolveHostMetadata(ctx) c.resolved = true return nil } @@ -653,8 +639,6 @@ func (c *Config) getOidcEndpoints(ctx context.Context) (*u2m.OAuthAuthorizationS switch c.HostType() { case AccountHost: return oauthClient.GetAccountOAuthEndpoints(ctx, host, c.AccountID) - case UnifiedHost: - return oauthClient.GetUnifiedOAuthEndpoints(ctx, host, c.AccountID) case WorkspaceHost: return oauthClient.GetWorkspaceOAuthEndpoints(ctx, host) default: @@ -733,8 +717,6 @@ func (c *Config) getOAuthArgument() (u2m.OAuthArgument, error) { switch c.HostType() { case AccountHost: return u2m.NewProfileAccountOAuthArgument(host, c.AccountID, profile) - case UnifiedHost: - return u2m.NewProfileUnifiedOAuthArgument(host, c.AccountID, profile) case WorkspaceHost: return u2m.NewProfileWorkspaceOAuthArgument(host, profile) default: diff --git a/config/config_test.go b/config/config_test.go index c55443616..541ad4fe3 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -24,6 +24,17 @@ func (m mockLoader) Configure(cfg *Config) error { return m(cfg) } +// metadataNotFoundTransport returns an HTTPTransport that returns 404 for +// the host metadata endpoint, ensuring tests don't make real HTTP calls. +var metadataNotFoundTransport = fixtures.SliceTransport{ + { + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 404, + }, +} + func TestHostType_AwsAccount(t *testing.T) { c := &Config{ Host: "https://accounts.cloud.databricks.com", @@ -64,22 +75,21 @@ func TestHostType_AwsWorkspace(t *testing.T) { assert.Equal(t, WorkspaceHost, c.HostType()) } -func TestHostType_Unified(t *testing.T) { +func TestHostType_UnifiedFlagNoLongerReturnsUnified(t *testing.T) { c := &Config{ - Host: "https://unified.cloud.databricks.com", - AccountID: "123e4567-e89b-12d3-a456-426614174000", - Experimental_IsUnifiedHost: true, + Host: "https://unified.cloud.databricks.com", + AccountID: "123e4567-e89b-12d3-a456-426614174000", } - assert.Equal(t, UnifiedHost, c.HostType()) + // Unified flag is no longer checked; host type is determined by URL pattern only + assert.Equal(t, WorkspaceHost, c.HostType()) } -func TestIsAccountClient_PanicsOnUnifiedHost(t *testing.T) { +func TestIsAccountClient_NoLongerPanicsOnUnifiedHost(t *testing.T) { c := &Config{ - Host: "https://unified.cloud.databricks.com", - AccountID: "test-account", - Experimental_IsUnifiedHost: true, + Host: "https://unified.cloud.databricks.com", + AccountID: "test-account", } - assert.Panics(t, func() { c.IsAccountClient() }) + assert.NotPanics(t, func() { c.IsAccountClient() }) } func TestNewWithWorkspaceHost(t *testing.T) { @@ -117,6 +127,7 @@ func TestAuthenticate_InvalidHostSet(t *testing.T) { } func TestConfig_getOidcEndpoints_account(t *testing.T) { + noopLoader := mockLoader(func(cfg *Config) error { return nil }) tests := []struct { name string host string @@ -137,8 +148,10 @@ func TestConfig_getOidcEndpoints_account(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &Config{ - Host: tt.host, - AccountID: tt.accountID, + Host: tt.host, + AccountID: tt.accountID, + Loaders: []Loader{noopLoader}, + HTTPTransport: metadataNotFoundTransport, } got, err := c.getOidcEndpoints(context.Background()) assert.NoError(t, err) @@ -188,47 +201,30 @@ func TestConfig_getOidcEndpoints_workspace(t *testing.T) { } } -func TestConfig_getOidcEndpoints_unified(t *testing.T) { - tests := []struct { - name string - host string - accountID string - }{ - { - name: "without trailing slash", - host: "https://unified.cloud.databricks.com", - accountID: "abc", - }, - { - name: "with trailing slash", - host: "https://unified.cloud.databricks.com/", - accountID: "abc", +func TestConfig_getOidcEndpoints_usesDiscoveryURLFromMetadata(t *testing.T) { + // Unified hosts resolve DiscoveryURL from metadata during EnsureResolved. + // The getOidcEndpoints method then uses the DiscoveryURL. + discoveryURL := "https://unified.cloud.databricks.com/oidc/accounts/abc/.well-known/oauth-authorization-server" + c := &Config{ + Host: "https://unified.cloud.databricks.com", + AccountID: "abc", + Token: "t", + DiscoveryURL: discoveryURL, + HTTPTransport: fixtures.SliceTransport{ + { + Method: "GET", + Resource: "/oidc/accounts/abc/.well-known/oauth-authorization-server", + Status: 200, + Response: `{"authorization_endpoint": "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/authorize", "token_endpoint": "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/token"}`, + }, }, } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Config{ - Host: tt.host, - AccountID: tt.accountID, - Experimental_IsUnifiedHost: true, - HTTPTransport: fixtures.SliceTransport{ - { - Method: "GET", - Resource: "/oidc/accounts/abc/.well-known/oauth-authorization-server", - Status: 200, - Response: `{"authorization_endpoint": "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/authorize", "token_endpoint": "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/token"}`, - }, - }, - } - got, err := c.getOidcEndpoints(context.Background()) - assert.NoError(t, err) - assert.Equal(t, &u2m.OAuthAuthorizationServer{ - AuthorizationEndpoint: "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/authorize", - TokenEndpoint: "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/token", - }, got) - }) - } + got, err := c.getOidcEndpoints(context.Background()) + assert.NoError(t, err) + assert.Equal(t, &u2m.OAuthAuthorizationServer{ + AuthorizationEndpoint: "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/authorize", + TokenEndpoint: "https://unified.cloud.databricks.com/oidc/accounts/abc/v1/token", + }, got) } func TestConfig_getOAuthArgument_account(t *testing.T) { @@ -294,39 +290,18 @@ func TestConfig_getOAuthArgument_workspace(t *testing.T) { } } -func TestConfig_getOAuthArgument_Unified(t *testing.T) { - tests := []struct { - name string - host string - accountID string - }{ - { - name: "without trailing slash", - host: "https://unified.cloud.databricks.com", - accountID: "account-123", - }, - { - name: "with trailing slash", - host: "https://unified.cloud.databricks.com/", - accountID: "account-123", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := &Config{ - Host: tt.host, - AccountID: tt.accountID, - Experimental_IsUnifiedHost: true, - } - rawGot, err := c.getOAuthArgument() - assert.NoError(t, err) - got, ok := rawGot.(u2m.UnifiedOAuthArgument) - assert.True(t, ok, "Expected UnifiedOAuthArgument") - assert.Equal(t, "https://unified.cloud.databricks.com", got.GetHost()) - assert.Equal(t, "account-123", got.GetAccountId()) - }) +func TestConfig_getOAuthArgument_FormerUnifiedHostTreatedAsWorkspace(t *testing.T) { + // With the unified flag no longer checked, a non-accounts host + // is treated as a workspace host for OAuth argument purposes. + c := &Config{ + Host: "https://unified.cloud.databricks.com", + AccountID: "account-123", } + rawGot, err := c.getOAuthArgument() + assert.NoError(t, err) + got, ok := rawGot.(u2m.BasicWorkspaceOAuthArgument) + assert.True(t, ok, "Expected BasicWorkspaceOAuthArgument") + assert.Equal(t, "https://unified.cloud.databricks.com", got.GetWorkspaceHost()) } func TestConfig_getOAuthArgument_profileCacheKeys(t *testing.T) { @@ -378,27 +353,25 @@ func TestConfig_getOAuthArgument_profileCacheKeys(t *testing.T) { wantHostKey: "https://accounts.cloud.databricks.com/oidc/accounts/abc", }, { - name: "unified without profile", + name: "former unified without profile (now workspace)", config: &Config{ - Host: "https://unified.cloud.databricks.com", - AccountID: "account-123", - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: "https://unified.cloud.databricks.com", + AccountID: "account-123", + Loaders: []Loader{noopLoader}, }, - wantKey: "https://unified.cloud.databricks.com/oidc/accounts/account-123", - wantHostKey: "https://unified.cloud.databricks.com/oidc/accounts/account-123", + wantKey: "https://unified.cloud.databricks.com", + wantHostKey: "https://unified.cloud.databricks.com", }, { - name: "unified with profile", + name: "former unified with profile (now workspace)", config: &Config{ - Host: "https://unified.cloud.databricks.com", - AccountID: "account-123", - Profile: "unified-profile", - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: "https://unified.cloud.databricks.com", + AccountID: "account-123", + Profile: "unified-profile", + Loaders: []Loader{noopLoader}, }, wantKey: "unified-profile", - wantHostKey: "https://unified.cloud.databricks.com/oidc/accounts/account-123", + wantHostKey: "https://unified.cloud.databricks.com", }, } @@ -521,16 +494,16 @@ func TestConfig_getOidcEndpoints_UsesDiscoveryURL(t *testing.T) { func TestConfig_ResolveHostMetadata_AccountSubstitutesAccountID(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMAccHost, - AccountID: testHMAccountID, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMAccHost, + AccountID: testHMAccountID, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMAccHost + `/oidc/accounts/{account_id}"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMAccHost + `/oidc/accounts/{account_id}"}`, }, }, } @@ -543,17 +516,17 @@ func TestConfig_ResolveHostMetadata_AccountSubstitutesAccountID(t *testing.T) { func TestConfig_ResolveHostMetadata_DoesNotOverwriteExistingFields(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - AccountID: testHMAccountID, - WorkspaceID: testHMWorkspaceID, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + AccountID: testHMAccountID, + WorkspaceID: testHMWorkspaceID, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "other-account", "workspace_id": "other-ws"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "other-account", "workspace_id": "other-ws"}`, }, }, } @@ -566,15 +539,15 @@ func TestConfig_ResolveHostMetadata_DoesNotOverwriteExistingFields(t *testing.T) func TestConfig_ResolveHostMetadata_PopulatesCloudFromAPI(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "Azure"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "Azure"}`, }, }, } @@ -586,15 +559,15 @@ func TestConfig_ResolveHostMetadata_PopulatesCloudFromAPI(t *testing.T) { func TestConfig_ResolveHostMetadata_CloudFallbackToDNS(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: "https://my-workspace.azuredatabricks.net", - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: "https://my-workspace.azuredatabricks.net", + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "https://my-workspace.azuredatabricks.net/oidc", "account_id": "` + testHMAccountID + `"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "https://my-workspace.azuredatabricks.net/oidc", "account_id": "` + testHMAccountID + `"}`, }, }, } @@ -606,16 +579,16 @@ func TestConfig_ResolveHostMetadata_CloudFallbackToDNS(t *testing.T) { func TestConfig_ResolveHostMetadata_DoesNotOverwriteExistingCloud(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Cloud: "GCP", - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Cloud: "GCP", + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, }, }, } @@ -624,56 +597,40 @@ func TestConfig_ResolveHostMetadata_DoesNotOverwriteExistingCloud(t *testing.T) assert.Equal(t, environment.Cloud("GCP"), cfg.Cloud) } -func TestEnsureResolved_ResolvesHostMetadata_WhenUnifiedHost(t *testing.T) { +func TestEnsureResolved_ResolvesHostMetadata_WhenHostSet(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "workspace_id": "` + testHMWorkspaceID + `", "cloud": "AWS"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "workspace_id": "` + testHMWorkspaceID + `", "cloud": "AWS"}`, }, }, } err := cfg.EnsureResolved() require.NoError(t, err) + // Metadata is now always resolved when host is set assert.Equal(t, testHMAccountID, cfg.AccountID) assert.Equal(t, testHMWorkspaceID, cfg.WorkspaceID) - assert.Equal(t, testHMHost+"/oidc/.well-known/oauth-authorization-server", cfg.DiscoveryURL) - assert.Equal(t, "AWS", string(cfg.Cloud)) -} - -func TestEnsureResolved_SkipsHostMetadata_WhenNotUnified(t *testing.T) { - noopLoader := mockLoader(func(cfg *Config) error { return nil }) - cfg := &Config{ - Host: testHMHost, - Loaders: []Loader{noopLoader}, - HTTPTransport: fixtures.SliceTransport{ - // No metadata endpoint — if it were called, the slice would fail - }, - } - err := cfg.EnsureResolved() - require.NoError(t, err) - assert.Empty(t, cfg.AccountID) - assert.Empty(t, cfg.WorkspaceID) } func TestEnsureResolved_HostMetadataFailure_NonFatal(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 500, - Response: `{"error": "internal error"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 500, + Response: `{"error": "internal error"}`, }, }, } @@ -685,15 +642,15 @@ func TestEnsureResolved_HostMetadataFailure_NonFatal(t *testing.T) { func TestEnsureResolved_HostMetadata_NoOidcEndpoint_NonFatal(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"account_id": "` + testHMAccountID + `"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"account_id": "` + testHMAccountID + `"}`, }, }, } @@ -706,15 +663,15 @@ func TestEnsureResolved_HostMetadata_NoOidcEndpoint_NonFatal(t *testing.T) { func TestEnsureResolved_HostMetadata_MissingAccountIdWithPlaceholder_Warns(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc/accounts/{account_id}"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc/accounts/{account_id}"}`, }, }, } @@ -727,15 +684,15 @@ func TestEnsureResolved_HostMetadata_MissingAccountIdWithPlaceholder_Warns(t *te func TestApplyHostMetadata_SetsTokenAudienceForAccountHost(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, }, }, } @@ -748,15 +705,15 @@ func TestApplyHostMetadata_SetsTokenAudienceForAccountHost(t *testing.T) { func TestApplyHostMetadata_NoTokenAudienceForWorkspaceHost(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "workspace_id": "` + testHMWorkspaceID + `", "cloud": "AWS"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "workspace_id": "` + testHMWorkspaceID + `", "cloud": "AWS"}`, }, }, } @@ -769,16 +726,16 @@ func TestApplyHostMetadata_NoTokenAudienceForWorkspaceHost(t *testing.T) { func TestApplyHostMetadata_DoesNotOverrideExistingTokenAudience(t *testing.T) { noopLoader := mockLoader(func(cfg *Config) error { return nil }) cfg := &Config{ - Host: testHMHost, - TokenAudience: "custom-audience", - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + TokenAudience: "custom-audience", + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "AWS"}`, }, }, } @@ -858,15 +815,15 @@ func TestConfig_ResolveHostMetadata_Clouds(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { cfg := &Config{ - Host: testHMHost, - Experimental_IsUnifiedHost: true, - Loaders: []Loader{noopLoader}, + Host: testHMHost, + Loaders: []Loader{noopLoader}, HTTPTransport: fixtures.SliceTransport{ { - Method: "GET", - Resource: "/.well-known/databricks-config", - Status: 200, - Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "` + tc.cloudJSON + `"}`, + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 200, + Response: `{"oidc_endpoint": "` + testHMHost + `/oidc", "account_id": "` + testHMAccountID + `", "cloud": "` + tc.cloudJSON + `"}`, }, }, } diff --git a/internal/acceptance_test.go b/internal/acceptance_test.go index 064c7f8ff..ea1f6efb2 100644 --- a/internal/acceptance_test.go +++ b/internal/acceptance_test.go @@ -131,24 +131,6 @@ func TestAccExplicitAzureSpnAuth(t *testing.T) { assert.NotEmpty(t, v) } -func TestAccErrNotAccountClient(t *testing.T) { - workspaceTest(t) - - // Confirm that we get an error when trying to create an account client - // if the configuration indicates a workspace. - _, err := databricks.NewAccountClient() - assert.ErrorIs(t, err, databricks.ErrNotAccountClient) -} - -func TestAccErrNotWorkspaceClient(t *testing.T) { - accountTest(t) - - // Confirm that we get an error when trying to create a workspace client - // if the configuration indicates an account. - _, err := databricks.NewWorkspaceClient() - assert.ErrorIs(t, err, databricks.ErrNotWorkspaceClient) -} - // Confirm that we can access the account IP access lists using MSI credentials. func TestAccAccountsMsiCredentials(t *testing.T) { t.Log(GetEnvOrSkipTest(t, "ARM_USE_MSI")) diff --git a/internal/generatedtests/idempotency_call_test.go b/internal/generatedtests/idempotency_call_test.go index 1fcfa4bef..ecf83b14c 100755 --- a/internal/generatedtests/idempotency_call_test.go +++ b/internal/generatedtests/idempotency_call_test.go @@ -118,6 +118,11 @@ func TestIdempotency_CreateTestResource_AutoGeneratedRequestID(t *testing.T) { callCount := 0 server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { + // Return 404 for host metadata endpoint and prevent config resolution from interfering with test call counting. + if request.Method == "GET" && request.URL.Path == "/.well-known/databricks-config" { + writer.WriteHeader(404) + return + } callCount++ // Extract request_id from query parameters diff --git a/internal/host_metadata_test.go b/internal/host_metadata_test.go index b6977bfbc..d51376235 100644 --- a/internal/host_metadata_test.go +++ b/internal/host_metadata_test.go @@ -19,9 +19,7 @@ func TestHostMetadataResolution(t *testing.T) { } t.Parallel() - cfg := &config.Config{ - Experimental_IsUnifiedHost: true, - } + cfg := &config.Config{} err := cfg.EnsureResolved() require.NoError(t, err) diff --git a/internal/init_test.go b/internal/init_test.go index 118aa9ba1..0e6509a4e 100644 --- a/internal/init_test.go +++ b/internal/init_test.go @@ -61,17 +61,14 @@ func ucwsTest(t *testing.T) (context.Context, *databricks.WorkspaceClient) { return ctx, databricks.Must(databricks.NewWorkspaceClient()) } -// Once the experimental flag is removed for unified hosts, we can move the test support -// for unified host to DATABRICKS_HOST as default. func unifiedHostAccountTest(t *testing.T) (context.Context, *databricks.AccountClient, *databricks.WorkspaceClient) { loadDebugEnvIfRunsFromIDE(t, "account") cfg := &config.Config{ - Host: GetEnvOrSkipTest(t, "UNIFIED_HOST"), - AccountID: GetEnvOrSkipTest(t, "DATABRICKS_ACCOUNT_ID"), - ClientID: GetEnvOrSkipTest(t, "DATABRICKS_CLIENT_ID"), - WorkspaceID: GetEnvOrSkipTest(t, "TEST_WORKSPACE_ID"), - ClientSecret: GetEnvOrSkipTest(t, "DATABRICKS_CLIENT_SECRET"), - Experimental_IsUnifiedHost: true, + Host: GetEnvOrSkipTest(t, "UNIFIED_HOST"), + AccountID: GetEnvOrSkipTest(t, "DATABRICKS_ACCOUNT_ID"), + ClientID: GetEnvOrSkipTest(t, "DATABRICKS_CLIENT_ID"), + WorkspaceID: GetEnvOrSkipTest(t, "TEST_WORKSPACE_ID"), + ClientSecret: GetEnvOrSkipTest(t, "DATABRICKS_CLIENT_SECRET"), // Large timeout to support API calls that take long. // For example, the /usage/download API can take more than // 60 seconds to return a response. @@ -81,9 +78,6 @@ func unifiedHostAccountTest(t *testing.T) (context.Context, *databricks.AccountC if err != nil { skipf(t)("error: %s", err) } - if cfg.HostType() != config.UnifiedHost { - skipf(t)("Not in unified host env: %s/%s", cfg.AccountID, cfg.Host) - } t.Log(GetEnvOrSkipTest(t, "CLOUD_ENV")) t.Parallel() ctx := context.Background() diff --git a/internal/testspecs/service/httpcallv2/impl.go b/internal/testspecs/service/httpcallv2/impl.go index f916e8c6a..6f6f3c3a9 100755 --- a/internal/testspecs/service/httpcallv2/impl.go +++ b/internal/testspecs/service/httpcallv2/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "golang.org/x/exp/slices" ) @@ -27,7 +26,7 @@ func (a *httpCallV2Impl) CreateResource(ctx context.Context, request CreateResou headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resource) @@ -41,7 +40,7 @@ func (a *httpCallV2Impl) GetResource(ctx context.Context, request GetResourceReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &resource) @@ -89,7 +88,7 @@ func (a *httpCallV2Impl) UpdateResource(ctx context.Context, request UpdateResou headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Resource, &resource) diff --git a/internal/testspecs/service/idempotencytesting/impl.go b/internal/testspecs/service/idempotencytesting/impl.go index 26674b5e1..fe14d6e53 100755 --- a/internal/testspecs/service/idempotencytesting/impl.go +++ b/internal/testspecs/service/idempotencytesting/impl.go @@ -7,7 +7,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/google/uuid" "golang.org/x/exp/slices" ) @@ -32,7 +31,7 @@ func (a *idempotencyTestingImpl) CreateTestResource(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TestResource, &testResource) diff --git a/internal/testspecs/service/jsonmarshallv2/impl.go b/internal/testspecs/service/jsonmarshallv2/impl.go index bace73cc4..d5097eb0f 100755 --- a/internal/testspecs/service/jsonmarshallv2/impl.go +++ b/internal/testspecs/service/jsonmarshallv2/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" ) // unexported type that holds implementations of just JsonMarshallV2 API methods @@ -23,7 +22,7 @@ func (a *jsonMarshallV2Impl) GetResource(ctx context.Context, request GetResourc headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &resource) diff --git a/internal/testspecs/service/lrotesting/impl.go b/internal/testspecs/service/lrotesting/impl.go index 90969c567..92c657f35 100755 --- a/internal/testspecs/service/lrotesting/impl.go +++ b/internal/testspecs/service/lrotesting/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" ) // unexported type that holds implementations of just LroTesting API methods @@ -22,7 +21,7 @@ func (a *lroTestingImpl) CancelOperation(ctx context.Context, request CancelOper headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -37,7 +36,7 @@ func (a *lroTestingImpl) CreateTestResource(ctx context.Context, request CreateT headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Resource, &operation) @@ -51,7 +50,7 @@ func (a *lroTestingImpl) DeleteTestResource(ctx context.Context, request DeleteT headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -65,7 +64,7 @@ func (a *lroTestingImpl) GetOperation(ctx context.Context, request GetOperationR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) @@ -79,7 +78,7 @@ func (a *lroTestingImpl) GetTestResource(ctx context.Context, request GetTestRes headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &testResource) diff --git a/qa/http_fixture.go b/qa/http_fixture.go index 4ecfa92eb..d267271ef 100644 --- a/qa/http_fixture.go +++ b/qa/http_fixture.go @@ -42,8 +42,34 @@ var HTTPFailures = []HTTPFixture{ type HTTPFixtures []HTTPFixture +// hostMetadataFixture is auto-injected by the qa framework to prevent tests +// from making real HTTP calls to the /.well-known/databricks-config endpoint +// during config resolution. Tests that need to mock host metadata should +// provide their own fixture for this endpoint. +var hostMetadataFixture = HTTPFixture{ + Method: "GET", + Resource: "/.well-known/databricks-config", + ReuseRequest: true, + Status: 404, + Response: apierr.APIError{ + ErrorCode: "NOT_FOUND", + StatusCode: 404, + Message: "host metadata endpoint auto-stubbed by qa framework", + }, +} + +func (fixtures HTTPFixtures) withHostMetadata() HTTPFixtures { + for _, f := range fixtures { + if f.Method == "GET" && f.Resource == "/.well-known/databricks-config" { + return fixtures + } + } + return append(HTTPFixtures{hostMetadataFixture}, fixtures...) +} + // Client creates DatabricksClient for emulated HTTP server func (fixtures HTTPFixtures) Config(t *testing.T) (*config.Config, *httptest.Server) { + fixtures = fixtures.withHostMetadata() server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { found := false for i, fixture := range fixtures { diff --git a/service/agentbricks/impl.go b/service/agentbricks/impl.go index 60bef68cd..15b58cb2f 100755 --- a/service/agentbricks/impl.go +++ b/service/agentbricks/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" ) // unexported type that holds implementations of just AgentBricks API methods @@ -23,7 +22,7 @@ func (a *agentBricksImpl) CancelOptimize(ctx context.Context, request CancelCust headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -38,7 +37,7 @@ func (a *agentBricksImpl) CreateCustomLlm(ctx context.Context, request CreateCus headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &customLlm) @@ -51,7 +50,7 @@ func (a *agentBricksImpl) DeleteCustomLlm(ctx context.Context, request DeleteCus headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -65,7 +64,7 @@ func (a *agentBricksImpl) GetCustomLlm(ctx context.Context, request GetCustomLlm headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customLlm) @@ -80,7 +79,7 @@ func (a *agentBricksImpl) StartOptimize(ctx context.Context, request StartCustom headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &customLlm) @@ -95,7 +94,7 @@ func (a *agentBricksImpl) UpdateCustomLlm(ctx context.Context, request UpdateCus headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &customLlm) diff --git a/service/apps/impl.go b/service/apps/impl.go index 1e5f5c5e4..e3b8e0b0f 100755 --- a/service/apps/impl.go +++ b/service/apps/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -33,7 +32,7 @@ func (a *appsImpl) Create(ctx context.Context, request CreateAppRequest) (*App, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.App, &app) @@ -48,7 +47,7 @@ func (a *appsImpl) CreateSpace(ctx context.Context, request CreateSpaceRequest) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Space, &operation) @@ -63,7 +62,7 @@ func (a *appsImpl) CreateUpdate(ctx context.Context, request AsyncUpdateAppReque headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &appUpdate) @@ -77,7 +76,7 @@ func (a *appsImpl) Delete(ctx context.Context, request DeleteAppRequest) (*App, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &app) @@ -91,7 +90,7 @@ func (a *appsImpl) DeleteSpace(ctx context.Context, request DeleteSpaceRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -106,7 +105,7 @@ func (a *appsImpl) Deploy(ctx context.Context, request CreateAppDeploymentReques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.AppDeployment, &appDeployment) @@ -120,7 +119,7 @@ func (a *appsImpl) Get(ctx context.Context, request GetAppRequest) (*App, error) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &app) @@ -134,7 +133,7 @@ func (a *appsImpl) GetDeployment(ctx context.Context, request GetAppDeploymentRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &appDeployment) @@ -148,7 +147,7 @@ func (a *appsImpl) GetPermissionLevels(ctx context.Context, request GetAppPermis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getAppPermissionLevelsResponse) @@ -162,7 +161,7 @@ func (a *appsImpl) GetPermissions(ctx context.Context, request GetAppPermissions headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &appPermissions) @@ -176,7 +175,7 @@ func (a *appsImpl) GetSpace(ctx context.Context, request GetSpaceRequest) (*Spac headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &space) @@ -190,7 +189,7 @@ func (a *appsImpl) GetSpaceOperation(ctx context.Context, request GetOperationRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) @@ -204,7 +203,7 @@ func (a *appsImpl) GetUpdate(ctx context.Context, request GetAppUpdateRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &appUpdate) @@ -249,7 +248,7 @@ func (a *appsImpl) internalList(ctx context.Context, request ListAppsRequest) (* headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAppsResponse) @@ -294,7 +293,7 @@ func (a *appsImpl) internalListDeployments(ctx context.Context, request ListAppD headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAppDeploymentsResponse) @@ -339,7 +338,7 @@ func (a *appsImpl) internalListSpaces(ctx context.Context, request ListSpacesReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSpacesResponse) @@ -354,7 +353,7 @@ func (a *appsImpl) SetPermissions(ctx context.Context, request AppPermissionsReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &appPermissions) @@ -369,7 +368,7 @@ func (a *appsImpl) Start(ctx context.Context, request StartAppRequest) (*App, er headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &app) @@ -384,7 +383,7 @@ func (a *appsImpl) Stop(ctx context.Context, request StopAppRequest) (*App, erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &app) @@ -399,7 +398,7 @@ func (a *appsImpl) Update(ctx context.Context, request UpdateAppRequest) (*App, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.App, &app) @@ -414,7 +413,7 @@ func (a *appsImpl) UpdatePermissions(ctx context.Context, request AppPermissions headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &appPermissions) @@ -436,7 +435,7 @@ func (a *appsImpl) UpdateSpace(ctx context.Context, request UpdateSpaceRequest) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Space, &operation) @@ -456,7 +455,7 @@ func (a *appsSettingsImpl) CreateCustomTemplate(ctx context.Context, request Cre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Template, &customTemplate) @@ -470,7 +469,7 @@ func (a *appsSettingsImpl) DeleteCustomTemplate(ctx context.Context, request Del headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &customTemplate) @@ -484,7 +483,7 @@ func (a *appsSettingsImpl) GetCustomTemplate(ctx context.Context, request GetCus headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &customTemplate) @@ -529,7 +528,7 @@ func (a *appsSettingsImpl) internalListCustomTemplates(ctx context.Context, requ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCustomTemplatesResponse) @@ -544,7 +543,7 @@ func (a *appsSettingsImpl) UpdateCustomTemplate(ctx context.Context, request Upd headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Template, &customTemplate) diff --git a/service/catalog/impl.go b/service/catalog/impl.go index ee88c685a..87226e79e 100755 --- a/service/catalog/impl.go +++ b/service/catalog/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -292,7 +291,7 @@ func (a *artifactAllowlistsImpl) Get(ctx context.Context, request GetArtifactAll headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &artifactAllowlistInfo) @@ -307,7 +306,7 @@ func (a *artifactAllowlistsImpl) Update(ctx context.Context, request SetArtifact headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &artifactAllowlistInfo) @@ -327,7 +326,7 @@ func (a *catalogsImpl) Create(ctx context.Context, request CreateCatalog) (*Cata headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &catalogInfo) @@ -340,7 +339,7 @@ func (a *catalogsImpl) Delete(ctx context.Context, request DeleteCatalogRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -354,7 +353,7 @@ func (a *catalogsImpl) Get(ctx context.Context, request GetCatalogRequest) (*Cat headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &catalogInfo) @@ -425,7 +424,7 @@ func (a *catalogsImpl) internalList(ctx context.Context, request ListCatalogsReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCatalogsResponse) @@ -440,7 +439,7 @@ func (a *catalogsImpl) Update(ctx context.Context, request UpdateCatalog) (*Cata headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &catalogInfo) @@ -460,7 +459,7 @@ func (a *connectionsImpl) Create(ctx context.Context, request CreateConnection) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &connectionInfo) @@ -473,7 +472,7 @@ func (a *connectionsImpl) Delete(ctx context.Context, request DeleteConnectionRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -487,7 +486,7 @@ func (a *connectionsImpl) Get(ctx context.Context, request GetConnectionRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &connectionInfo) @@ -550,7 +549,7 @@ func (a *connectionsImpl) internalList(ctx context.Context, request ListConnecti headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listConnectionsResponse) @@ -565,7 +564,7 @@ func (a *connectionsImpl) Update(ctx context.Context, request UpdateConnection) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &connectionInfo) @@ -585,7 +584,7 @@ func (a *credentialsImpl) CreateCredential(ctx context.Context, request CreateCr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &credentialInfo) @@ -598,7 +597,7 @@ func (a *credentialsImpl) DeleteCredential(ctx context.Context, request DeleteCr headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -613,7 +612,7 @@ func (a *credentialsImpl) GenerateTemporaryServiceCredential(ctx context.Context headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &temporaryCredentials) @@ -627,7 +626,7 @@ func (a *credentialsImpl) GetCredential(ctx context.Context, request GetCredenti headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &credentialInfo) @@ -692,7 +691,7 @@ func (a *credentialsImpl) internalListCredentials(ctx context.Context, request L headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCredentialsResponse) @@ -707,7 +706,7 @@ func (a *credentialsImpl) UpdateCredential(ctx context.Context, request UpdateCr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &credentialInfo) @@ -722,7 +721,7 @@ func (a *credentialsImpl) ValidateCredential(ctx context.Context, request Valida headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &validateCredentialResponse) @@ -742,7 +741,7 @@ func (a *entityTagAssignmentsImpl) Create(ctx context.Context, request CreateEnt headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) @@ -755,7 +754,7 @@ func (a *entityTagAssignmentsImpl) Delete(ctx context.Context, request DeleteEnt headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -769,7 +768,7 @@ func (a *entityTagAssignmentsImpl) Get(ctx context.Context, request GetEntityTag headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &entityTagAssignment) @@ -824,7 +823,7 @@ func (a *entityTagAssignmentsImpl) internalList(ctx context.Context, request Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEntityTagAssignmentsResponse) @@ -843,7 +842,7 @@ func (a *entityTagAssignmentsImpl) Update(ctx context.Context, request UpdateEnt headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &entityTagAssignment) @@ -863,7 +862,7 @@ func (a *externalLineageImpl) CreateExternalLineageRelationship(ctx context.Cont headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.ExternalLineageRelationship, &externalLineageRelationship) @@ -876,7 +875,7 @@ func (a *externalLineageImpl) DeleteExternalLineageRelationship(ctx context.Cont headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -923,7 +922,7 @@ func (a *externalLineageImpl) internalListExternalLineageRelationships(ctx conte headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExternalLineageRelationshipsResponse) @@ -942,7 +941,7 @@ func (a *externalLineageImpl) UpdateExternalLineageRelationship(ctx context.Cont headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ExternalLineageRelationship, &externalLineageRelationship) @@ -962,7 +961,7 @@ func (a *externalLocationsImpl) Create(ctx context.Context, request CreateExtern headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &externalLocationInfo) @@ -975,7 +974,7 @@ func (a *externalLocationsImpl) Delete(ctx context.Context, request DeleteExtern headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -989,7 +988,7 @@ func (a *externalLocationsImpl) Get(ctx context.Context, request GetExternalLoca headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &externalLocationInfo) @@ -1060,7 +1059,7 @@ func (a *externalLocationsImpl) internalList(ctx context.Context, request ListEx headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExternalLocationsResponse) @@ -1075,7 +1074,7 @@ func (a *externalLocationsImpl) Update(ctx context.Context, request UpdateExtern headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &externalLocationInfo) @@ -1095,7 +1094,7 @@ func (a *externalMetadataImpl) CreateExternalMetadata(ctx context.Context, reque headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.ExternalMetadata, &externalMetadata) @@ -1108,7 +1107,7 @@ func (a *externalMetadataImpl) DeleteExternalMetadata(ctx context.Context, reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1122,7 +1121,7 @@ func (a *externalMetadataImpl) GetExternalMetadata(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &externalMetadata) @@ -1175,7 +1174,7 @@ func (a *externalMetadataImpl) internalListExternalMetadata(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExternalMetadataResponse) @@ -1194,7 +1193,7 @@ func (a *externalMetadataImpl) UpdateExternalMetadata(ctx context.Context, reque headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.ExternalMetadata, &externalMetadata) @@ -1214,7 +1213,7 @@ func (a *functionsImpl) Create(ctx context.Context, request CreateFunctionReques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &functionInfo) @@ -1226,7 +1225,7 @@ func (a *functionsImpl) Delete(ctx context.Context, request DeleteFunctionReques queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1240,7 +1239,7 @@ func (a *functionsImpl) Get(ctx context.Context, request GetFunctionRequest) (*F headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &functionInfo) @@ -1315,7 +1314,7 @@ func (a *functionsImpl) internalList(ctx context.Context, request ListFunctionsR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFunctionsResponse) @@ -1330,7 +1329,7 @@ func (a *functionsImpl) Update(ctx context.Context, request UpdateFunction) (*Fu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &functionInfo) @@ -1349,7 +1348,7 @@ func (a *grantsImpl) Get(ctx context.Context, request GetGrantRequest) (*GetPerm headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPermissionsResponse) @@ -1363,7 +1362,7 @@ func (a *grantsImpl) GetEffective(ctx context.Context, request GetEffectiveReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &effectivePermissionsList) @@ -1378,7 +1377,7 @@ func (a *grantsImpl) Update(ctx context.Context, request UpdatePermissions) (*Up headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updatePermissionsResponse) @@ -1397,7 +1396,7 @@ func (a *metastoresImpl) Assign(ctx context.Context, request CreateMetastoreAssi headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -1412,7 +1411,7 @@ func (a *metastoresImpl) Create(ctx context.Context, request CreateMetastore) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &metastoreInfo) @@ -1426,7 +1425,7 @@ func (a *metastoresImpl) Current(ctx context.Context) (*MetastoreAssignment, err headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &metastoreAssignment) @@ -1439,7 +1438,7 @@ func (a *metastoresImpl) Delete(ctx context.Context, request DeleteMetastoreRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1453,7 +1452,7 @@ func (a *metastoresImpl) Get(ctx context.Context, request GetMetastoreRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &metastoreInfo) @@ -1520,7 +1519,7 @@ func (a *metastoresImpl) internalList(ctx context.Context, request ListMetastore headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listMetastoresResponse) @@ -1534,7 +1533,7 @@ func (a *metastoresImpl) Summary(ctx context.Context) (*GetMetastoreSummaryRespo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getMetastoreSummaryResponse) @@ -1547,7 +1546,7 @@ func (a *metastoresImpl) Unassign(ctx context.Context, request UnassignRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1562,7 +1561,7 @@ func (a *metastoresImpl) Update(ctx context.Context, request UpdateMetastore) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &metastoreInfo) @@ -1576,7 +1575,7 @@ func (a *metastoresImpl) UpdateAssignment(ctx context.Context, request UpdateMet headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -1593,7 +1592,7 @@ func (a *modelVersionsImpl) Delete(ctx context.Context, request DeleteModelVersi queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1607,7 +1606,7 @@ func (a *modelVersionsImpl) Get(ctx context.Context, request GetModelVersionRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &modelVersionInfo) @@ -1621,7 +1620,7 @@ func (a *modelVersionsImpl) GetByAlias(ctx context.Context, request GetByAliasRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &modelVersionInfo) @@ -1700,7 +1699,7 @@ func (a *modelVersionsImpl) internalList(ctx context.Context, request ListModelV headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listModelVersionsResponse) @@ -1715,7 +1714,7 @@ func (a *modelVersionsImpl) Update(ctx context.Context, request UpdateModelVersi headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &modelVersionInfo) @@ -1735,7 +1734,7 @@ func (a *onlineTablesImpl) Create(ctx context.Context, request CreateOnlineTable headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Table, &onlineTable) @@ -1748,7 +1747,7 @@ func (a *onlineTablesImpl) Delete(ctx context.Context, request DeleteOnlineTable headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1762,7 +1761,7 @@ func (a *onlineTablesImpl) Get(ctx context.Context, request GetOnlineTableReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &onlineTable) @@ -1782,7 +1781,7 @@ func (a *policiesImpl) CreatePolicy(ctx context.Context, request CreatePolicyReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.PolicyInfo, &policyInfo) @@ -1796,7 +1795,7 @@ func (a *policiesImpl) DeletePolicy(ctx context.Context, request DeletePolicyReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deletePolicyResponse) @@ -1810,7 +1809,7 @@ func (a *policiesImpl) GetPolicy(ctx context.Context, request GetPolicyRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &policyInfo) @@ -1867,7 +1866,7 @@ func (a *policiesImpl) internalListPolicies(ctx context.Context, request ListPol headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPoliciesResponse) @@ -1886,7 +1885,7 @@ func (a *policiesImpl) UpdatePolicy(ctx context.Context, request UpdatePolicyReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.PolicyInfo, &policyInfo) @@ -1904,7 +1903,7 @@ func (a *qualityMonitorsImpl) CancelRefresh(ctx context.Context, request CancelR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -1919,7 +1918,7 @@ func (a *qualityMonitorsImpl) Create(ctx context.Context, request CreateMonitor) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &monitorInfo) @@ -1933,7 +1932,7 @@ func (a *qualityMonitorsImpl) Delete(ctx context.Context, request DeleteQualityM headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteMonitorResponse) @@ -1947,7 +1946,7 @@ func (a *qualityMonitorsImpl) Get(ctx context.Context, request GetQualityMonitor headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorInfo) @@ -1961,7 +1960,7 @@ func (a *qualityMonitorsImpl) GetRefresh(ctx context.Context, request GetRefresh headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorRefreshInfo) @@ -1975,7 +1974,7 @@ func (a *qualityMonitorsImpl) ListRefreshes(ctx context.Context, request ListRef headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitorRefreshListResponse) @@ -1990,7 +1989,7 @@ func (a *qualityMonitorsImpl) RegenerateDashboard(ctx context.Context, request R headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ®enerateDashboardResponse) @@ -2004,7 +2003,7 @@ func (a *qualityMonitorsImpl) RunRefresh(ctx context.Context, request RunRefresh headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &monitorRefreshInfo) @@ -2019,7 +2018,7 @@ func (a *qualityMonitorsImpl) Update(ctx context.Context, request UpdateMonitor) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &monitorInfo) @@ -2039,7 +2038,7 @@ func (a *registeredModelsImpl) Create(ctx context.Context, request CreateRegiste headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ®isteredModelInfo) @@ -2051,7 +2050,7 @@ func (a *registeredModelsImpl) Delete(ctx context.Context, request DeleteRegiste queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2063,7 +2062,7 @@ func (a *registeredModelsImpl) DeleteAlias(ctx context.Context, request DeleteAl queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2077,7 +2076,7 @@ func (a *registeredModelsImpl) Get(ctx context.Context, request GetRegisteredMod headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ®isteredModelInfo) @@ -2154,7 +2153,7 @@ func (a *registeredModelsImpl) internalList(ctx context.Context, request ListReg headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRegisteredModelsResponse) @@ -2169,7 +2168,7 @@ func (a *registeredModelsImpl) SetAlias(ctx context.Context, request SetRegister headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, ®isteredModelAlias) @@ -2184,7 +2183,7 @@ func (a *registeredModelsImpl) Update(ctx context.Context, request UpdateRegiste headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ®isteredModelInfo) @@ -2203,7 +2202,7 @@ func (a *resourceQuotasImpl) GetQuota(ctx context.Context, request GetQuotaReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getQuotaResponse) @@ -2262,7 +2261,7 @@ func (a *resourceQuotasImpl) internalListQuotas(ctx context.Context, request Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQuotasResponse) @@ -2282,7 +2281,7 @@ func (a *rfaImpl) BatchCreateAccessRequests(ctx context.Context, request BatchCr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &batchCreateAccessRequestsResponse) @@ -2296,7 +2295,7 @@ func (a *rfaImpl) GetAccessRequestDestinations(ctx context.Context, request GetA headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &accessRequestDestinations) @@ -2315,7 +2314,7 @@ func (a *rfaImpl) UpdateAccessRequestDestinations(ctx context.Context, request U headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.AccessRequestDestinations, &accessRequestDestinations) @@ -2335,7 +2334,7 @@ func (a *schemasImpl) Create(ctx context.Context, request CreateSchema) (*Schema headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &schemaInfo) @@ -2348,7 +2347,7 @@ func (a *schemasImpl) Delete(ctx context.Context, request DeleteSchemaRequest) e headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2362,7 +2361,7 @@ func (a *schemasImpl) Get(ctx context.Context, request GetSchemaRequest) (*Schem headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &schemaInfo) @@ -2433,7 +2432,7 @@ func (a *schemasImpl) internalList(ctx context.Context, request ListSchemasReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSchemasResponse) @@ -2448,7 +2447,7 @@ func (a *schemasImpl) Update(ctx context.Context, request UpdateSchema) (*Schema headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &schemaInfo) @@ -2468,7 +2467,7 @@ func (a *storageCredentialsImpl) Create(ctx context.Context, request CreateStora headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &storageCredentialInfo) @@ -2481,7 +2480,7 @@ func (a *storageCredentialsImpl) Delete(ctx context.Context, request DeleteStora headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2495,7 +2494,7 @@ func (a *storageCredentialsImpl) Get(ctx context.Context, request GetStorageCred headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &storageCredentialInfo) @@ -2566,7 +2565,7 @@ func (a *storageCredentialsImpl) internalList(ctx context.Context, request ListS headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listStorageCredentialsResponse) @@ -2581,7 +2580,7 @@ func (a *storageCredentialsImpl) Update(ctx context.Context, request UpdateStora headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &storageCredentialInfo) @@ -2596,7 +2595,7 @@ func (a *storageCredentialsImpl) Validate(ctx context.Context, request ValidateS headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &validateStorageCredentialResponse) @@ -2614,7 +2613,7 @@ func (a *systemSchemasImpl) Disable(ctx context.Context, request DisableRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2628,7 +2627,7 @@ func (a *systemSchemasImpl) Enable(ctx context.Context, request EnableRequest) e headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -2693,7 +2692,7 @@ func (a *systemSchemasImpl) internalList(ctx context.Context, request ListSystem headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSystemSchemasResponse) @@ -2713,7 +2712,7 @@ func (a *tableConstraintsImpl) Create(ctx context.Context, request CreateTableCo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &tableConstraint) @@ -2726,7 +2725,7 @@ func (a *tableConstraintsImpl) Delete(ctx context.Context, request DeleteTableCo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2746,7 +2745,7 @@ func (a *tablesImpl) Create(ctx context.Context, request CreateTableRequest) (*T headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &tableInfo) @@ -2759,7 +2758,7 @@ func (a *tablesImpl) Delete(ctx context.Context, request DeleteTableRequest) err headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -2773,7 +2772,7 @@ func (a *tablesImpl) Exists(ctx context.Context, request ExistsRequest) (*TableE headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tableExistsResponse) @@ -2787,7 +2786,7 @@ func (a *tablesImpl) Get(ctx context.Context, request GetTableRequest) (*TableIn headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tableInfo) @@ -2866,7 +2865,7 @@ func (a *tablesImpl) internalList(ctx context.Context, request ListTablesRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTablesResponse) @@ -2941,7 +2940,7 @@ func (a *tablesImpl) internalListSummaries(ctx context.Context, request ListSumm headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTableSummariesResponse) @@ -2955,7 +2954,7 @@ func (a *tablesImpl) Update(ctx context.Context, request UpdateTableRequest) err headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -2975,7 +2974,7 @@ func (a *temporaryPathCredentialsImpl) GenerateTemporaryPathCredentials(ctx cont headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &generateTemporaryPathCredentialResponse) @@ -2995,7 +2994,7 @@ func (a *temporaryTableCredentialsImpl) GenerateTemporaryTableCredentials(ctx co headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &generateTemporaryTableCredentialResponse) @@ -3015,7 +3014,7 @@ func (a *volumesImpl) Create(ctx context.Context, request CreateVolumeRequestCon headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &volumeInfo) @@ -3027,7 +3026,7 @@ func (a *volumesImpl) Delete(ctx context.Context, request DeleteVolumeRequest) e queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -3102,7 +3101,7 @@ func (a *volumesImpl) internalList(ctx context.Context, request ListVolumesReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVolumesResponseContent) @@ -3116,7 +3115,7 @@ func (a *volumesImpl) Read(ctx context.Context, request ReadVolumeRequest) (*Vol headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &volumeInfo) @@ -3131,7 +3130,7 @@ func (a *volumesImpl) Update(ctx context.Context, request UpdateVolumeRequestCon headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &volumeInfo) @@ -3150,7 +3149,7 @@ func (a *workspaceBindingsImpl) Get(ctx context.Context, request GetWorkspaceBin headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCatalogWorkspaceBindingsResponse) @@ -3215,7 +3214,7 @@ func (a *workspaceBindingsImpl) internalGetBindings(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWorkspaceBindingsResponse) @@ -3230,7 +3229,7 @@ func (a *workspaceBindingsImpl) Update(ctx context.Context, request UpdateWorksp headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCatalogWorkspaceBindingsResponse) @@ -3245,7 +3244,7 @@ func (a *workspaceBindingsImpl) UpdateBindings(ctx context.Context, request Upda headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateWorkspaceBindingsResponse) diff --git a/service/cleanrooms/impl.go b/service/cleanrooms/impl.go index 06177e94e..df70cc4ea 100755 --- a/service/cleanrooms/impl.go +++ b/service/cleanrooms/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -25,7 +24,7 @@ func (a *cleanRoomAssetRevisionsImpl) Get(ctx context.Context, request GetCleanR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoomAsset) @@ -70,7 +69,7 @@ func (a *cleanRoomAssetRevisionsImpl) internalList(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomAssetRevisionsResponse) @@ -90,7 +89,7 @@ func (a *cleanRoomAssetsImpl) Create(ctx context.Context, request CreateCleanRoo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Asset, &cleanRoomAsset) @@ -105,7 +104,7 @@ func (a *cleanRoomAssetsImpl) CreateCleanRoomAssetReview(ctx context.Context, re headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCleanRoomAssetReviewResponse) @@ -118,7 +117,7 @@ func (a *cleanRoomAssetsImpl) Delete(ctx context.Context, request DeleteCleanRoo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -132,7 +131,7 @@ func (a *cleanRoomAssetsImpl) Get(ctx context.Context, request GetCleanRoomAsset headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoomAsset) @@ -177,7 +176,7 @@ func (a *cleanRoomAssetsImpl) internalList(ctx context.Context, request ListClea headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomAssetsResponse) @@ -192,7 +191,7 @@ func (a *cleanRoomAssetsImpl) Update(ctx context.Context, request UpdateCleanRoo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Asset, &cleanRoomAsset) @@ -212,7 +211,7 @@ func (a *cleanRoomAutoApprovalRulesImpl) Create(ctx context.Context, request Cre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cleanRoomAutoApprovalRule) @@ -225,7 +224,7 @@ func (a *cleanRoomAutoApprovalRulesImpl) Delete(ctx context.Context, request Del headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -239,7 +238,7 @@ func (a *cleanRoomAutoApprovalRulesImpl) Get(ctx context.Context, request GetCle headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoomAutoApprovalRule) @@ -284,7 +283,7 @@ func (a *cleanRoomAutoApprovalRulesImpl) internalList(ctx context.Context, reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomAutoApprovalRulesResponse) @@ -299,7 +298,7 @@ func (a *cleanRoomAutoApprovalRulesImpl) Update(ctx context.Context, request Upd headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.AutoApprovalRule, &cleanRoomAutoApprovalRule) @@ -349,7 +348,7 @@ func (a *cleanRoomTaskRunsImpl) internalList(ctx context.Context, request ListCl headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomNotebookTaskRunsResponse) @@ -369,7 +368,7 @@ func (a *cleanRoomsImpl) Create(ctx context.Context, request CreateCleanRoomRequ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.CleanRoom, &cleanRoom) @@ -384,7 +383,7 @@ func (a *cleanRoomsImpl) CreateOutputCatalog(ctx context.Context, request Create headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.OutputCatalog, &createCleanRoomOutputCatalogResponse) @@ -397,7 +396,7 @@ func (a *cleanRoomsImpl) Delete(ctx context.Context, request DeleteCleanRoomRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -411,7 +410,7 @@ func (a *cleanRoomsImpl) Get(ctx context.Context, request GetCleanRoomRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &cleanRoom) @@ -458,7 +457,7 @@ func (a *cleanRoomsImpl) internalList(ctx context.Context, request ListCleanRoom headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCleanRoomsResponse) @@ -473,7 +472,7 @@ func (a *cleanRoomsImpl) Update(ctx context.Context, request UpdateCleanRoomRequ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &cleanRoom) diff --git a/service/compute/impl.go b/service/compute/impl.go index 672c3d02e..579a9110c 100755 --- a/service/compute/impl.go +++ b/service/compute/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *clusterPoliciesImpl) Create(ctx context.Context, request CreatePolicy) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPolicyResponse) @@ -40,7 +39,7 @@ func (a *clusterPoliciesImpl) Delete(ctx context.Context, request DeletePolicy) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -54,7 +53,7 @@ func (a *clusterPoliciesImpl) Edit(ctx context.Context, request EditPolicy) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -68,7 +67,7 @@ func (a *clusterPoliciesImpl) Get(ctx context.Context, request GetClusterPolicyR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &policy) @@ -82,7 +81,7 @@ func (a *clusterPoliciesImpl) GetPermissionLevels(ctx context.Context, request G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterPolicyPermissionLevelsResponse) @@ -96,7 +95,7 @@ func (a *clusterPoliciesImpl) GetPermissions(ctx context.Context, request GetClu headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterPolicyPermissions) @@ -135,7 +134,7 @@ func (a *clusterPoliciesImpl) internalList(ctx context.Context, request ListClus headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPoliciesResponse) @@ -150,7 +149,7 @@ func (a *clusterPoliciesImpl) SetPermissions(ctx context.Context, request Cluste headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &clusterPolicyPermissions) @@ -165,7 +164,7 @@ func (a *clusterPoliciesImpl) UpdatePermissions(ctx context.Context, request Clu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &clusterPolicyPermissions) @@ -184,7 +183,7 @@ func (a *clustersImpl) ChangeOwner(ctx context.Context, request ChangeClusterOwn headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -199,7 +198,7 @@ func (a *clustersImpl) Create(ctx context.Context, request CreateCluster) (*Crea headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createClusterResponse) @@ -213,7 +212,7 @@ func (a *clustersImpl) Delete(ctx context.Context, request DeleteCluster) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -227,7 +226,7 @@ func (a *clustersImpl) Edit(ctx context.Context, request EditCluster) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -279,7 +278,7 @@ func (a *clustersImpl) internalEvents(ctx context.Context, request GetEvents) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &getEventsResponse) @@ -293,7 +292,7 @@ func (a *clustersImpl) Get(ctx context.Context, request GetClusterRequest) (*Clu headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterDetails) @@ -307,7 +306,7 @@ func (a *clustersImpl) GetPermissionLevels(ctx context.Context, request GetClust headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterPermissionLevelsResponse) @@ -321,7 +320,7 @@ func (a *clustersImpl) GetPermissions(ctx context.Context, request GetClusterPer headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterPermissions) @@ -370,7 +369,7 @@ func (a *clustersImpl) internalList(ctx context.Context, request ListClustersReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listClustersResponse) @@ -384,7 +383,7 @@ func (a *clustersImpl) ListNodeTypes(ctx context.Context) (*ListNodeTypesRespons headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listNodeTypesResponse) @@ -398,7 +397,7 @@ func (a *clustersImpl) ListZones(ctx context.Context) (*ListAvailableZonesRespon headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listAvailableZonesResponse) @@ -412,7 +411,7 @@ func (a *clustersImpl) PermanentDelete(ctx context.Context, request PermanentDel headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -426,7 +425,7 @@ func (a *clustersImpl) Pin(ctx context.Context, request PinCluster) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -440,7 +439,7 @@ func (a *clustersImpl) Resize(ctx context.Context, request ResizeCluster) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -454,7 +453,7 @@ func (a *clustersImpl) Restart(ctx context.Context, request RestartCluster) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -469,7 +468,7 @@ func (a *clustersImpl) SetPermissions(ctx context.Context, request ClusterPermis headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &clusterPermissions) @@ -483,7 +482,7 @@ func (a *clustersImpl) SparkVersions(ctx context.Context) (*GetSparkVersionsResp headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getSparkVersionsResponse) @@ -497,7 +496,7 @@ func (a *clustersImpl) Start(ctx context.Context, request StartCluster) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -511,7 +510,7 @@ func (a *clustersImpl) Unpin(ctx context.Context, request UnpinCluster) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -525,7 +524,7 @@ func (a *clustersImpl) Update(ctx context.Context, request UpdateCluster) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -540,7 +539,7 @@ func (a *clustersImpl) UpdatePermissions(ctx context.Context, request ClusterPer headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &clusterPermissions) @@ -559,7 +558,7 @@ func (a *commandExecutionImpl) Cancel(ctx context.Context, request CancelCommand headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -573,7 +572,7 @@ func (a *commandExecutionImpl) CommandStatus(ctx context.Context, request Comman headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &commandStatusResponse) @@ -587,7 +586,7 @@ func (a *commandExecutionImpl) ContextStatus(ctx context.Context, request Contex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &contextStatusResponse) @@ -602,7 +601,7 @@ func (a *commandExecutionImpl) Create(ctx context.Context, request CreateContext headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &created) @@ -616,7 +615,7 @@ func (a *commandExecutionImpl) Destroy(ctx context.Context, request DestroyConte headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -631,7 +630,7 @@ func (a *commandExecutionImpl) Execute(ctx context.Context, request Command) (*C headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &created) @@ -651,7 +650,7 @@ func (a *globalInitScriptsImpl) Create(ctx context.Context, request GlobalInitSc headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) @@ -664,7 +663,7 @@ func (a *globalInitScriptsImpl) Delete(ctx context.Context, request DeleteGlobal headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -678,7 +677,7 @@ func (a *globalInitScriptsImpl) Get(ctx context.Context, request GetGlobalInitSc headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &globalInitScriptDetailsWithContent) @@ -724,7 +723,7 @@ func (a *globalInitScriptsImpl) internalList(ctx context.Context) (*ListGlobalIn headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listGlobalInitScriptsResponse) @@ -738,7 +737,7 @@ func (a *globalInitScriptsImpl) Update(ctx context.Context, request GlobalInitSc headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -758,7 +757,7 @@ func (a *instancePoolsImpl) Create(ctx context.Context, request CreateInstancePo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createInstancePoolResponse) @@ -772,7 +771,7 @@ func (a *instancePoolsImpl) Delete(ctx context.Context, request DeleteInstancePo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -786,7 +785,7 @@ func (a *instancePoolsImpl) Edit(ctx context.Context, request EditInstancePool) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -800,7 +799,7 @@ func (a *instancePoolsImpl) Get(ctx context.Context, request GetInstancePoolRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getInstancePool) @@ -814,7 +813,7 @@ func (a *instancePoolsImpl) GetPermissionLevels(ctx context.Context, request Get headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getInstancePoolPermissionLevelsResponse) @@ -828,7 +827,7 @@ func (a *instancePoolsImpl) GetPermissions(ctx context.Context, request GetInsta headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &instancePoolPermissions) @@ -868,7 +867,7 @@ func (a *instancePoolsImpl) internalList(ctx context.Context) (*ListInstancePool headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listInstancePools) @@ -883,7 +882,7 @@ func (a *instancePoolsImpl) SetPermissions(ctx context.Context, request Instance headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &instancePoolPermissions) @@ -898,7 +897,7 @@ func (a *instancePoolsImpl) UpdatePermissions(ctx context.Context, request Insta headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &instancePoolPermissions) @@ -917,7 +916,7 @@ func (a *instanceProfilesImpl) Add(ctx context.Context, request AddInstanceProfi headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -931,7 +930,7 @@ func (a *instanceProfilesImpl) Edit(ctx context.Context, request InstanceProfile headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -975,7 +974,7 @@ func (a *instanceProfilesImpl) internalList(ctx context.Context) (*ListInstanceP headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listInstanceProfilesResponse) @@ -989,7 +988,7 @@ func (a *instanceProfilesImpl) Remove(ctx context.Context, request RemoveInstanc headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1036,7 +1035,7 @@ func (a *librariesImpl) internalAllClusterStatuses(ctx context.Context) (*ListAl headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listAllClusterLibraryStatusesResponse) @@ -1087,7 +1086,7 @@ func (a *librariesImpl) internalClusterStatus(ctx context.Context, request Clust headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &clusterLibraryStatuses) @@ -1101,7 +1100,7 @@ func (a *librariesImpl) Install(ctx context.Context, request InstallLibraries) e headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1115,7 +1114,7 @@ func (a *librariesImpl) Uninstall(ctx context.Context, request UninstallLibrarie headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1135,7 +1134,7 @@ func (a *policyComplianceForClustersImpl) EnforceCompliance(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &enforceClusterComplianceResponse) @@ -1149,7 +1148,7 @@ func (a *policyComplianceForClustersImpl) GetCompliance(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getClusterComplianceResponse) @@ -1198,7 +1197,7 @@ func (a *policyComplianceForClustersImpl) internalListCompliance(ctx context.Con headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listClusterCompliancesResponse) @@ -1217,7 +1216,7 @@ func (a *policyFamiliesImpl) Get(ctx context.Context, request GetPolicyFamilyReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &policyFamily) @@ -1264,7 +1263,7 @@ func (a *policyFamiliesImpl) internalList(ctx context.Context, request ListPolic headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPolicyFamiliesResponse) diff --git a/service/dashboards/impl.go b/service/dashboards/impl.go index 066b093b2..ec8761f5b 100755 --- a/service/dashboards/impl.go +++ b/service/dashboards/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -27,7 +26,7 @@ func (a *genieImpl) CreateMessage(ctx context.Context, request GenieCreateConver headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieMessage) @@ -42,7 +41,7 @@ func (a *genieImpl) CreateSpace(ctx context.Context, request GenieCreateSpaceReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieSpace) @@ -55,7 +54,7 @@ func (a *genieImpl) DeleteConversation(ctx context.Context, request GenieDeleteC headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -68,7 +67,7 @@ func (a *genieImpl) DeleteConversationMessage(ctx context.Context, request Genie headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -82,7 +81,7 @@ func (a *genieImpl) ExecuteMessageAttachmentQuery(ctx context.Context, request G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGetMessageQueryResultResponse) @@ -96,7 +95,7 @@ func (a *genieImpl) ExecuteMessageQuery(ctx context.Context, request GenieExecut headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGetMessageQueryResultResponse) @@ -110,7 +109,7 @@ func (a *genieImpl) GenerateDownloadFullQueryResult(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, &genieGenerateDownloadFullQueryResultResponse) @@ -125,7 +124,7 @@ func (a *genieImpl) GenieCreateEvalRun(ctx context.Context, request GenieCreateE headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieEvalRunResponse) @@ -139,7 +138,7 @@ func (a *genieImpl) GenieGetEvalResultDetails(ctx context.Context, request Genie headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieEvalResultDetails) @@ -153,7 +152,7 @@ func (a *genieImpl) GenieGetEvalRun(ctx context.Context, request GenieGetEvalRun headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieEvalRunResponse) @@ -167,7 +166,7 @@ func (a *genieImpl) GenieListEvalResults(ctx context.Context, request GenieListE headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListEvalResultsResponse) @@ -181,7 +180,7 @@ func (a *genieImpl) GenieListEvalRuns(ctx context.Context, request GenieListEval headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListEvalRunsResponse) @@ -195,7 +194,7 @@ func (a *genieImpl) GetDownloadFullQueryResult(ctx context.Context, request Geni headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetDownloadFullQueryResultResponse) @@ -209,7 +208,7 @@ func (a *genieImpl) GetMessage(ctx context.Context, request GenieGetConversation headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieMessage) @@ -223,7 +222,7 @@ func (a *genieImpl) GetMessageAttachmentQueryResult(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) @@ -237,7 +236,7 @@ func (a *genieImpl) GetMessageQueryResult(ctx context.Context, request GenieGetM headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) @@ -251,7 +250,7 @@ func (a *genieImpl) GetMessageQueryResultByAttachment(ctx context.Context, reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieGetMessageQueryResultResponse) @@ -265,7 +264,7 @@ func (a *genieImpl) GetSpace(ctx context.Context, request GenieGetSpaceRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieSpace) @@ -279,7 +278,7 @@ func (a *genieImpl) ListConversationMessages(ctx context.Context, request GenieL headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListConversationMessagesResponse) @@ -293,7 +292,7 @@ func (a *genieImpl) ListConversations(ctx context.Context, request GenieListConv headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListConversationsResponse) @@ -307,7 +306,7 @@ func (a *genieImpl) ListSpaces(ctx context.Context, request GenieListSpacesReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &genieListSpacesResponse) @@ -321,7 +320,7 @@ func (a *genieImpl) SendMessageFeedback(ctx context.Context, request GenieSendMe headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -336,7 +335,7 @@ func (a *genieImpl) StartConversation(ctx context.Context, request GenieStartCon headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &genieStartConversationResponse) @@ -349,7 +348,7 @@ func (a *genieImpl) TrashSpace(ctx context.Context, request GenieTrashSpaceReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -364,7 +363,7 @@ func (a *genieImpl) UpdateSpace(ctx context.Context, request GenieUpdateSpaceReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &genieSpace) @@ -392,7 +391,7 @@ func (a *lakeviewImpl) Create(ctx context.Context, request CreateDashboardReques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Dashboard, &dashboard) @@ -407,7 +406,7 @@ func (a *lakeviewImpl) CreateSchedule(ctx context.Context, request CreateSchedul headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Schedule, &schedule) @@ -422,7 +421,7 @@ func (a *lakeviewImpl) CreateSubscription(ctx context.Context, request CreateSub headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Subscription, &subscription) @@ -435,7 +434,7 @@ func (a *lakeviewImpl) DeleteSchedule(ctx context.Context, request DeleteSchedul headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -448,7 +447,7 @@ func (a *lakeviewImpl) DeleteSubscription(ctx context.Context, request DeleteSub headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -462,7 +461,7 @@ func (a *lakeviewImpl) Get(ctx context.Context, request GetDashboardRequest) (*D headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboard) @@ -476,7 +475,7 @@ func (a *lakeviewImpl) GetPublished(ctx context.Context, request GetPublishedDas headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &publishedDashboard) @@ -490,7 +489,7 @@ func (a *lakeviewImpl) GetSchedule(ctx context.Context, request GetScheduleReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &schedule) @@ -504,7 +503,7 @@ func (a *lakeviewImpl) GetSubscription(ctx context.Context, request GetSubscript headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &subscription) @@ -549,7 +548,7 @@ func (a *lakeviewImpl) internalList(ctx context.Context, request ListDashboardsR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDashboardsResponse) @@ -594,7 +593,7 @@ func (a *lakeviewImpl) internalListSchedules(ctx context.Context, request ListSc headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSchedulesResponse) @@ -639,7 +638,7 @@ func (a *lakeviewImpl) internalListSubscriptions(ctx context.Context, request Li headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSubscriptionsResponse) @@ -654,7 +653,7 @@ func (a *lakeviewImpl) Migrate(ctx context.Context, request MigrateDashboardRequ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &dashboard) @@ -669,7 +668,7 @@ func (a *lakeviewImpl) Publish(ctx context.Context, request PublishRequest) (*Pu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &publishedDashboard) @@ -682,7 +681,7 @@ func (a *lakeviewImpl) Trash(ctx context.Context, request TrashDashboardRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -695,7 +694,7 @@ func (a *lakeviewImpl) Unpublish(ctx context.Context, request UnpublishDashboard headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -718,7 +717,7 @@ func (a *lakeviewImpl) Update(ctx context.Context, request UpdateDashboardReques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Dashboard, &dashboard) @@ -733,7 +732,7 @@ func (a *lakeviewImpl) UpdateSchedule(ctx context.Context, request UpdateSchedul headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Schedule, &schedule) @@ -752,7 +751,7 @@ func (a *lakeviewEmbeddedImpl) GetPublishedDashboardTokenInfo(ctx context.Contex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPublishedDashboardTokenInfoResponse) diff --git a/service/database/impl.go b/service/database/impl.go index 4b9d325a0..0e49aac2b 100755 --- a/service/database/impl.go +++ b/service/database/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "github.com/google/uuid" @@ -28,7 +27,7 @@ func (a *databaseImpl) CreateDatabaseCatalog(ctx context.Context, request Create headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Catalog, &databaseCatalog) @@ -43,7 +42,7 @@ func (a *databaseImpl) CreateDatabaseInstance(ctx context.Context, request Creat headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseInstance, &databaseInstance) @@ -62,7 +61,7 @@ func (a *databaseImpl) CreateDatabaseInstanceRole(ctx context.Context, request C headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DatabaseInstanceRole, &databaseInstanceRole) @@ -77,7 +76,7 @@ func (a *databaseImpl) CreateDatabaseTable(ctx context.Context, request CreateDa headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Table, &databaseTable) @@ -92,7 +91,7 @@ func (a *databaseImpl) CreateSyncedDatabaseTable(ctx context.Context, request Cr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.SyncedTable, &syncedDatabaseTable) @@ -105,7 +104,7 @@ func (a *databaseImpl) DeleteDatabaseCatalog(ctx context.Context, request Delete headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -118,7 +117,7 @@ func (a *databaseImpl) DeleteDatabaseInstance(ctx context.Context, request Delet headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -131,7 +130,7 @@ func (a *databaseImpl) DeleteDatabaseInstanceRole(ctx context.Context, request D headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -144,7 +143,7 @@ func (a *databaseImpl) DeleteDatabaseTable(ctx context.Context, request DeleteDa headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -157,7 +156,7 @@ func (a *databaseImpl) DeleteSyncedDatabaseTable(ctx context.Context, request De headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -171,7 +170,7 @@ func (a *databaseImpl) FindDatabaseInstanceByUid(ctx context.Context, request Fi headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseInstance) @@ -189,7 +188,7 @@ func (a *databaseImpl) GenerateDatabaseCredential(ctx context.Context, request G headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseCredential) @@ -203,7 +202,7 @@ func (a *databaseImpl) GetDatabaseCatalog(ctx context.Context, request GetDataba headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseCatalog) @@ -217,7 +216,7 @@ func (a *databaseImpl) GetDatabaseInstance(ctx context.Context, request GetDatab headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseInstance) @@ -231,7 +230,7 @@ func (a *databaseImpl) GetDatabaseInstanceRole(ctx context.Context, request GetD headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseInstanceRole) @@ -245,7 +244,7 @@ func (a *databaseImpl) GetDatabaseTable(ctx context.Context, request GetDatabase headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &databaseTable) @@ -259,7 +258,7 @@ func (a *databaseImpl) GetSyncedDatabaseTable(ctx context.Context, request GetSy headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &syncedDatabaseTable) @@ -304,7 +303,7 @@ func (a *databaseImpl) internalListDatabaseCatalogs(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseCatalogsResponse) @@ -357,7 +356,7 @@ func (a *databaseImpl) internalListDatabaseInstanceRoles(ctx context.Context, re headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseInstanceRolesResponse) @@ -402,7 +401,7 @@ func (a *databaseImpl) internalListDatabaseInstances(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabaseInstancesResponse) @@ -447,7 +446,7 @@ func (a *databaseImpl) internalListSyncedDatabaseTables(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSyncedDatabaseTablesResponse) @@ -466,7 +465,7 @@ func (a *databaseImpl) UpdateDatabaseCatalog(ctx context.Context, request Update headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseCatalog, &databaseCatalog) @@ -485,7 +484,7 @@ func (a *databaseImpl) UpdateDatabaseInstance(ctx context.Context, request Updat headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DatabaseInstance, &databaseInstance) @@ -504,7 +503,7 @@ func (a *databaseImpl) UpdateSyncedDatabaseTable(ctx context.Context, request Up headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.SyncedTable, &syncedDatabaseTable) diff --git a/service/dataclassification/impl.go b/service/dataclassification/impl.go index 3f1eac0b8..e3c716e07 100755 --- a/service/dataclassification/impl.go +++ b/service/dataclassification/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" ) // unexported type that holds implementations of just DataClassification API methods @@ -26,7 +25,7 @@ func (a *dataClassificationImpl) CreateCatalogConfig(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.CatalogConfig, &catalogConfig) @@ -39,7 +38,7 @@ func (a *dataClassificationImpl) DeleteCatalogConfig(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -53,7 +52,7 @@ func (a *dataClassificationImpl) GetCatalogConfig(ctx context.Context, request G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &catalogConfig) @@ -75,7 +74,7 @@ func (a *dataClassificationImpl) UpdateCatalogConfig(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.CatalogConfig, &catalogConfig) diff --git a/service/dataquality/impl.go b/service/dataquality/impl.go index e6d4c3c62..a769e0213 100755 --- a/service/dataquality/impl.go +++ b/service/dataquality/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *dataQualityImpl) CancelRefresh(ctx context.Context, request CancelRefre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &cancelRefreshResponse) @@ -41,7 +40,7 @@ func (a *dataQualityImpl) CreateMonitor(ctx context.Context, request CreateMonit headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Monitor, &monitor) @@ -56,7 +55,7 @@ func (a *dataQualityImpl) CreateRefresh(ctx context.Context, request CreateRefre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Refresh, &refresh) @@ -69,7 +68,7 @@ func (a *dataQualityImpl) DeleteMonitor(ctx context.Context, request DeleteMonit headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -82,7 +81,7 @@ func (a *dataQualityImpl) DeleteRefresh(ctx context.Context, request DeleteRefre headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -96,7 +95,7 @@ func (a *dataQualityImpl) GetMonitor(ctx context.Context, request GetMonitorRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &monitor) @@ -110,7 +109,7 @@ func (a *dataQualityImpl) GetRefresh(ctx context.Context, request GetRefreshRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &refresh) @@ -155,7 +154,7 @@ func (a *dataQualityImpl) internalListMonitor(ctx context.Context, request ListM headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listMonitorResponse) @@ -226,7 +225,7 @@ func (a *dataQualityImpl) internalListRefresh(ctx context.Context, request ListR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRefreshResponse) @@ -245,7 +244,7 @@ func (a *dataQualityImpl) UpdateMonitor(ctx context.Context, request UpdateMonit headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Monitor, &monitor) @@ -264,7 +263,7 @@ func (a *dataQualityImpl) UpdateRefresh(ctx context.Context, request UpdateRefre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Refresh, &refresh) diff --git a/service/environments/impl.go b/service/environments/impl.go index 42b04085c..4189abd48 100755 --- a/service/environments/impl.go +++ b/service/environments/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "github.com/google/uuid" @@ -41,7 +40,7 @@ func (a *environmentsImpl) CreateWorkspaceBaseEnvironment(ctx context.Context, r headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.WorkspaceBaseEnvironment, &operation) @@ -54,7 +53,7 @@ func (a *environmentsImpl) DeleteWorkspaceBaseEnvironment(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -68,7 +67,7 @@ func (a *environmentsImpl) GetDefaultWorkspaceBaseEnvironment(ctx context.Contex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultWorkspaceBaseEnvironment) @@ -82,7 +81,7 @@ func (a *environmentsImpl) GetOperation(ctx context.Context, request GetOperatio headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) @@ -96,7 +95,7 @@ func (a *environmentsImpl) GetWorkspaceBaseEnvironment(ctx context.Context, requ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceBaseEnvironment) @@ -141,7 +140,7 @@ func (a *environmentsImpl) internalListWorkspaceBaseEnvironments(ctx context.Con headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceBaseEnvironmentsResponse) @@ -156,7 +155,7 @@ func (a *environmentsImpl) RefreshWorkspaceBaseEnvironment(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &operation) @@ -178,7 +177,7 @@ func (a *environmentsImpl) UpdateDefaultWorkspaceBaseEnvironment(ctx context.Con headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DefaultWorkspaceBaseEnvironment, &defaultWorkspaceBaseEnvironment) @@ -193,7 +192,7 @@ func (a *environmentsImpl) UpdateWorkspaceBaseEnvironment(ctx context.Context, r headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.WorkspaceBaseEnvironment, &operation) diff --git a/service/files/impl.go b/service/files/impl.go index f07e2f3d6..85b82a7c3 100755 --- a/service/files/impl.go +++ b/service/files/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/httpclient" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" @@ -27,7 +26,7 @@ func (a *dbfsImpl) AddBlock(ctx context.Context, request AddBlock) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -41,7 +40,7 @@ func (a *dbfsImpl) Close(ctx context.Context, request Close) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -56,7 +55,7 @@ func (a *dbfsImpl) Create(ctx context.Context, request Create) (*CreateResponse, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) @@ -70,7 +69,7 @@ func (a *dbfsImpl) Delete(ctx context.Context, request Delete) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -84,7 +83,7 @@ func (a *dbfsImpl) GetStatus(ctx context.Context, request GetStatusRequest) (*Fi headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &fileInfo) @@ -143,7 +142,7 @@ func (a *dbfsImpl) internalList(ctx context.Context, request ListDbfsRequest) (* headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listStatusResponse) @@ -157,7 +156,7 @@ func (a *dbfsImpl) Mkdirs(ctx context.Context, request MkDirs) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -171,7 +170,7 @@ func (a *dbfsImpl) Move(ctx context.Context, request Move) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -185,7 +184,7 @@ func (a *dbfsImpl) Put(ctx context.Context, request Put) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -199,7 +198,7 @@ func (a *dbfsImpl) Read(ctx context.Context, request ReadDbfsRequest) (*ReadResp headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &readResponse) @@ -216,7 +215,7 @@ func (a *filesImpl) CreateDirectory(ctx context.Context, request CreateDirectory queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, nil, nil) @@ -228,7 +227,7 @@ func (a *filesImpl) Delete(ctx context.Context, request DeleteFileRequest) error queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -240,7 +239,7 @@ func (a *filesImpl) DeleteDirectory(ctx context.Context, request DeleteDirectory queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -254,7 +253,7 @@ func (a *filesImpl) Download(ctx context.Context, request DownloadRequest) (*Dow headers := make(map[string]string) headers["Accept"] = "application/octet-stream" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &downloadResponse) @@ -266,7 +265,7 @@ func (a *filesImpl) GetDirectoryMetadata(ctx context.Context, request GetDirecto queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodHead, path, headers, queryParams, request, nil) @@ -279,7 +278,7 @@ func (a *filesImpl) GetMetadata(ctx context.Context, request GetMetadataRequest) queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodHead, path, headers, queryParams, request, &getMetadataResponse) @@ -326,7 +325,7 @@ func (a *filesImpl) internalListDirectoryContents(ctx context.Context, request L headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDirectoryResponse) @@ -343,7 +342,7 @@ func (a *filesImpl) Upload(ctx context.Context, request UploadRequest) error { headers := make(map[string]string) headers["Content-Type"] = "application/octet-stream" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.Contents, nil) diff --git a/service/iam/impl.go b/service/iam/impl.go index f528ec2ae..b16ae3fb0 100755 --- a/service/iam/impl.go +++ b/service/iam/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -25,7 +24,7 @@ func (a *accessControlImpl) CheckPolicy(ctx context.Context, request CheckPolicy headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &checkPolicyResponse) @@ -83,7 +82,7 @@ func (a *accountAccessControlProxyImpl) GetAssignableRolesForResource(ctx contex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getAssignableRolesForResourceResponse) @@ -97,7 +96,7 @@ func (a *accountAccessControlProxyImpl) GetRuleSet(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &ruleSetResponse) @@ -112,7 +111,7 @@ func (a *accountAccessControlProxyImpl) UpdateRuleSet(ctx context.Context, reque headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &ruleSetResponse) @@ -456,7 +455,7 @@ func (a *currentUserImpl) Me(ctx context.Context) (*User, error) { headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &user) @@ -476,7 +475,7 @@ func (a *groupsV2Impl) Create(ctx context.Context, request CreateGroupRequest) ( headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &group) @@ -488,7 +487,7 @@ func (a *groupsV2Impl) Delete(ctx context.Context, request DeleteGroupRequest) e queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -502,7 +501,7 @@ func (a *groupsV2Impl) Get(ctx context.Context, request GetGroupRequest) (*Group headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &group) @@ -552,7 +551,7 @@ func (a *groupsV2Impl) internalList(ctx context.Context, request ListGroupsReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listGroupsResponse) @@ -566,7 +565,7 @@ func (a *groupsV2Impl) Patch(ctx context.Context, request PatchGroupRequest) err headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -580,7 +579,7 @@ func (a *groupsV2Impl) Update(ctx context.Context, request UpdateGroupRequest) e headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -600,7 +599,7 @@ func (a *permissionMigrationImpl) MigratePermissions(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &migratePermissionsResponse) @@ -619,7 +618,7 @@ func (a *permissionsImpl) Get(ctx context.Context, request GetPermissionRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &objectPermissions) @@ -633,7 +632,7 @@ func (a *permissionsImpl) GetPermissionLevels(ctx context.Context, request GetPe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPermissionLevelsResponse) @@ -648,7 +647,7 @@ func (a *permissionsImpl) Set(ctx context.Context, request SetObjectPermissions) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &objectPermissions) @@ -663,7 +662,7 @@ func (a *permissionsImpl) Update(ctx context.Context, request UpdateObjectPermis headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &objectPermissions) @@ -683,7 +682,7 @@ func (a *servicePrincipalsV2Impl) Create(ctx context.Context, request CreateServ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servicePrincipal) @@ -695,7 +694,7 @@ func (a *servicePrincipalsV2Impl) Delete(ctx context.Context, request DeleteServ queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -709,7 +708,7 @@ func (a *servicePrincipalsV2Impl) Get(ctx context.Context, request GetServicePri headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servicePrincipal) @@ -759,7 +758,7 @@ func (a *servicePrincipalsV2Impl) internalList(ctx context.Context, request List headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalResponse) @@ -773,7 +772,7 @@ func (a *servicePrincipalsV2Impl) Patch(ctx context.Context, request PatchServic headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -787,7 +786,7 @@ func (a *servicePrincipalsV2Impl) Update(ctx context.Context, request UpdateServ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -807,7 +806,7 @@ func (a *usersV2Impl) Create(ctx context.Context, request CreateUserRequest) (*U headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &user) @@ -819,7 +818,7 @@ func (a *usersV2Impl) Delete(ctx context.Context, request DeleteUserRequest) err queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -833,7 +832,7 @@ func (a *usersV2Impl) Get(ctx context.Context, request GetUserRequest) (*User, e headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &user) @@ -847,7 +846,7 @@ func (a *usersV2Impl) GetPermissionLevels(ctx context.Context, request GetPasswo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPasswordPermissionLevelsResponse) @@ -861,7 +860,7 @@ func (a *usersV2Impl) GetPermissions(ctx context.Context, request GetPasswordPer headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &passwordPermissions) @@ -911,7 +910,7 @@ func (a *usersV2Impl) internalList(ctx context.Context, request ListUsersRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUsersResponse) @@ -925,7 +924,7 @@ func (a *usersV2Impl) Patch(ctx context.Context, request PatchUserRequest) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -940,7 +939,7 @@ func (a *usersV2Impl) SetPermissions(ctx context.Context, request PasswordPermis headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &passwordPermissions) @@ -954,7 +953,7 @@ func (a *usersV2Impl) Update(ctx context.Context, request UpdateUserRequest) err headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -969,7 +968,7 @@ func (a *usersV2Impl) UpdatePermissions(ctx context.Context, request PasswordPer headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &passwordPermissions) diff --git a/service/iamv2/impl.go b/service/iamv2/impl.go index cd69babe4..7e5075e3f 100755 --- a/service/iamv2/impl.go +++ b/service/iamv2/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" ) // unexported type that holds implementations of just AccountIamV2 API methods @@ -75,7 +74,7 @@ func (a *workspaceIamV2Impl) GetWorkspaceAccessDetailLocal(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceAccessDetail) @@ -90,7 +89,7 @@ func (a *workspaceIamV2Impl) ResolveGroupProxy(ctx context.Context, request Reso headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveGroupResponse) @@ -105,7 +104,7 @@ func (a *workspaceIamV2Impl) ResolveServicePrincipalProxy(ctx context.Context, r headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveServicePrincipalResponse) @@ -120,7 +119,7 @@ func (a *workspaceIamV2Impl) ResolveUserProxy(ctx context.Context, request Resol headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &resolveUserResponse) diff --git a/service/jobs/impl.go b/service/jobs/impl.go index d967aa9b8..86eb0ede7 100755 --- a/service/jobs/impl.go +++ b/service/jobs/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -24,7 +23,7 @@ func (a *jobsImpl) CancelAllRuns(ctx context.Context, request CancelAllRuns) err headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -37,7 +36,7 @@ func (a *jobsImpl) CancelRun(ctx context.Context, request CancelRun) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -52,7 +51,7 @@ func (a *jobsImpl) Create(ctx context.Context, request CreateJob) (*CreateRespon headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createResponse) @@ -65,7 +64,7 @@ func (a *jobsImpl) Delete(ctx context.Context, request DeleteJob) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -78,7 +77,7 @@ func (a *jobsImpl) DeleteRun(ctx context.Context, request DeleteRun) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -92,7 +91,7 @@ func (a *jobsImpl) ExportRun(ctx context.Context, request ExportRunRequest) (*Ex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportRunOutput) @@ -106,7 +105,7 @@ func (a *jobsImpl) Get(ctx context.Context, request GetJobRequest) (*Job, error) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &job) @@ -120,7 +119,7 @@ func (a *jobsImpl) GetPermissionLevels(ctx context.Context, request GetJobPermis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getJobPermissionLevelsResponse) @@ -134,7 +133,7 @@ func (a *jobsImpl) GetPermissions(ctx context.Context, request GetJobPermissions headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &jobPermissions) @@ -148,7 +147,7 @@ func (a *jobsImpl) GetRun(ctx context.Context, request GetRunRequest) (*Run, err headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &run) @@ -162,7 +161,7 @@ func (a *jobsImpl) GetRunOutput(ctx context.Context, request GetRunOutputRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &runOutput) @@ -207,7 +206,7 @@ func (a *jobsImpl) internalList(ctx context.Context, request ListJobsRequest) (* headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listJobsResponse) @@ -252,7 +251,7 @@ func (a *jobsImpl) internalListRuns(ctx context.Context, request ListRunsRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRunsResponse) @@ -267,7 +266,7 @@ func (a *jobsImpl) RepairRun(ctx context.Context, request RepairRun) (*RepairRun headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &repairRunResponse) @@ -280,7 +279,7 @@ func (a *jobsImpl) Reset(ctx context.Context, request ResetJob) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -295,7 +294,7 @@ func (a *jobsImpl) RunNow(ctx context.Context, request RunNow) (*RunNowResponse, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &runNowResponse) @@ -310,7 +309,7 @@ func (a *jobsImpl) SetPermissions(ctx context.Context, request JobPermissionsReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &jobPermissions) @@ -325,7 +324,7 @@ func (a *jobsImpl) Submit(ctx context.Context, request SubmitRun) (*SubmitRunRes headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &submitRunResponse) @@ -338,7 +337,7 @@ func (a *jobsImpl) Update(ctx context.Context, request UpdateJob) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -353,7 +352,7 @@ func (a *jobsImpl) UpdatePermissions(ctx context.Context, request JobPermissions headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &jobPermissions) @@ -373,7 +372,7 @@ func (a *policyComplianceForJobsImpl) EnforceCompliance(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &enforcePolicyComplianceResponse) @@ -387,7 +386,7 @@ func (a *policyComplianceForJobsImpl) GetCompliance(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPolicyComplianceResponse) @@ -438,7 +437,7 @@ func (a *policyComplianceForJobsImpl) internalListCompliance(ctx context.Context headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listJobComplianceForPolicyResponse) diff --git a/service/knowledgeassistants/impl.go b/service/knowledgeassistants/impl.go index feabd348d..bd8ab0744 100755 --- a/service/knowledgeassistants/impl.go +++ b/service/knowledgeassistants/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -28,7 +27,7 @@ func (a *knowledgeAssistantsImpl) CreateKnowledgeAssistant(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.KnowledgeAssistant, &knowledgeAssistant) @@ -43,7 +42,7 @@ func (a *knowledgeAssistantsImpl) CreateKnowledgeSource(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.KnowledgeSource, &knowledgeSource) @@ -56,7 +55,7 @@ func (a *knowledgeAssistantsImpl) DeleteKnowledgeAssistant(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -69,7 +68,7 @@ func (a *knowledgeAssistantsImpl) DeleteKnowledgeSource(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -83,7 +82,7 @@ func (a *knowledgeAssistantsImpl) GetKnowledgeAssistant(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &knowledgeAssistant) @@ -97,7 +96,7 @@ func (a *knowledgeAssistantsImpl) GetKnowledgeSource(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &knowledgeSource) @@ -142,7 +141,7 @@ func (a *knowledgeAssistantsImpl) internalListKnowledgeAssistants(ctx context.Co headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listKnowledgeAssistantsResponse) @@ -187,7 +186,7 @@ func (a *knowledgeAssistantsImpl) internalListKnowledgeSources(ctx context.Conte headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listKnowledgeSourcesResponse) @@ -201,7 +200,7 @@ func (a *knowledgeAssistantsImpl) SyncKnowledgeSources(ctx context.Context, requ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -223,7 +222,7 @@ func (a *knowledgeAssistantsImpl) UpdateKnowledgeAssistant(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.KnowledgeAssistant, &knowledgeAssistant) @@ -245,7 +244,7 @@ func (a *knowledgeAssistantsImpl) UpdateKnowledgeSource(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.KnowledgeSource, &knowledgeSource) diff --git a/service/marketplace/impl.go b/service/marketplace/impl.go index a5f2208d8..d19721a8c 100755 --- a/service/marketplace/impl.go +++ b/service/marketplace/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -56,7 +55,7 @@ func (a *consumerFulfillmentsImpl) internalGet(ctx context.Context, request GetL headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingContentMetadataResponse) @@ -109,7 +108,7 @@ func (a *consumerFulfillmentsImpl) internalList(ctx context.Context, request Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFulfillmentsResponse) @@ -129,7 +128,7 @@ func (a *consumerInstallationsImpl) Create(ctx context.Context, request CreateIn headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &installation) @@ -142,7 +141,7 @@ func (a *consumerInstallationsImpl) Delete(ctx context.Context, request DeleteIn headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -187,7 +186,7 @@ func (a *consumerInstallationsImpl) internalList(ctx context.Context, request Li headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllInstallationsResponse) @@ -232,7 +231,7 @@ func (a *consumerInstallationsImpl) internalListListingInstallations(ctx context headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listInstallationsResponse) @@ -247,7 +246,7 @@ func (a *consumerInstallationsImpl) Update(ctx context.Context, request UpdateIn headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateInstallationResponse) @@ -266,7 +265,7 @@ func (a *consumerListingsImpl) BatchGet(ctx context.Context, request BatchGetLis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &batchGetListingsResponse) @@ -280,7 +279,7 @@ func (a *consumerListingsImpl) Get(ctx context.Context, request GetListingReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingResponse) @@ -327,7 +326,7 @@ func (a *consumerListingsImpl) internalList(ctx context.Context, request ListLis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listListingsResponse) @@ -376,7 +375,7 @@ func (a *consumerListingsImpl) internalSearch(ctx context.Context, request Searc headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchListingsResponse) @@ -396,7 +395,7 @@ func (a *consumerPersonalizationRequestsImpl) Create(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPersonalizationRequestResponse) @@ -410,7 +409,7 @@ func (a *consumerPersonalizationRequestsImpl) Get(ctx context.Context, request G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPersonalizationRequestResponse) @@ -455,7 +454,7 @@ func (a *consumerPersonalizationRequestsImpl) internalList(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllPersonalizationRequestsResponse) @@ -474,7 +473,7 @@ func (a *consumerProvidersImpl) BatchGet(ctx context.Context, request BatchGetPr headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &batchGetProvidersResponse) @@ -488,7 +487,7 @@ func (a *consumerProvidersImpl) Get(ctx context.Context, request GetProviderRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getProviderResponse) @@ -535,7 +534,7 @@ func (a *consumerProvidersImpl) internalList(ctx context.Context, request ListCo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) @@ -555,7 +554,7 @@ func (a *providerExchangeFiltersImpl) Create(ctx context.Context, request Create headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExchangeFilterResponse) @@ -568,7 +567,7 @@ func (a *providerExchangeFiltersImpl) Delete(ctx context.Context, request Delete headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -613,7 +612,7 @@ func (a *providerExchangeFiltersImpl) internalList(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangeFiltersResponse) @@ -628,7 +627,7 @@ func (a *providerExchangeFiltersImpl) Update(ctx context.Context, request Update headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateExchangeFilterResponse) @@ -648,7 +647,7 @@ func (a *providerExchangesImpl) AddListingToExchange(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &addExchangeForListingResponse) @@ -663,7 +662,7 @@ func (a *providerExchangesImpl) Create(ctx context.Context, request CreateExchan headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExchangeResponse) @@ -676,7 +675,7 @@ func (a *providerExchangesImpl) Delete(ctx context.Context, request DeleteExchan headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -689,7 +688,7 @@ func (a *providerExchangesImpl) DeleteListingFromExchange(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -703,7 +702,7 @@ func (a *providerExchangesImpl) Get(ctx context.Context, request GetExchangeRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExchangeResponse) @@ -748,7 +747,7 @@ func (a *providerExchangesImpl) internalList(ctx context.Context, request ListEx headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangesResponse) @@ -793,7 +792,7 @@ func (a *providerExchangesImpl) internalListExchangesForListing(ctx context.Cont headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExchangesForListingResponse) @@ -838,7 +837,7 @@ func (a *providerExchangesImpl) internalListListingsForExchange(ctx context.Cont headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listListingsForExchangeResponse) @@ -853,7 +852,7 @@ func (a *providerExchangesImpl) Update(ctx context.Context, request UpdateExchan headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateExchangeResponse) @@ -873,7 +872,7 @@ func (a *providerFilesImpl) Create(ctx context.Context, request CreateFileReques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createFileResponse) @@ -886,7 +885,7 @@ func (a *providerFilesImpl) Delete(ctx context.Context, request DeleteFileReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -900,7 +899,7 @@ func (a *providerFilesImpl) Get(ctx context.Context, request GetFileRequest) (*G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getFileResponse) @@ -945,7 +944,7 @@ func (a *providerFilesImpl) internalList(ctx context.Context, request ListFilesR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFilesResponse) @@ -965,7 +964,7 @@ func (a *providerListingsImpl) Create(ctx context.Context, request CreateListing headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createListingResponse) @@ -978,7 +977,7 @@ func (a *providerListingsImpl) Delete(ctx context.Context, request DeleteListing headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -992,7 +991,7 @@ func (a *providerListingsImpl) Get(ctx context.Context, request GetListingReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingResponse) @@ -1037,7 +1036,7 @@ func (a *providerListingsImpl) internalList(ctx context.Context, request GetList headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getListingsResponse) @@ -1052,7 +1051,7 @@ func (a *providerListingsImpl) Update(ctx context.Context, request UpdateListing headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateListingResponse) @@ -1104,7 +1103,7 @@ func (a *providerPersonalizationRequestsImpl) internalList(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAllPersonalizationRequestsResponse) @@ -1119,7 +1118,7 @@ func (a *providerPersonalizationRequestsImpl) Update(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updatePersonalizationRequestResponse) @@ -1138,7 +1137,7 @@ func (a *providerProviderAnalyticsDashboardsImpl) Create(ctx context.Context) (* headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, nil, nil, &providerAnalyticsDashboard) @@ -1152,7 +1151,7 @@ func (a *providerProviderAnalyticsDashboardsImpl) Get(ctx context.Context) (*Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listProviderAnalyticsDashboardResponse) @@ -1166,7 +1165,7 @@ func (a *providerProviderAnalyticsDashboardsImpl) GetLatestVersion(ctx context.C headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getLatestVersionProviderAnalyticsDashboardResponse) @@ -1181,7 +1180,7 @@ func (a *providerProviderAnalyticsDashboardsImpl) Update(ctx context.Context, re headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateProviderAnalyticsDashboardResponse) @@ -1201,7 +1200,7 @@ func (a *providerProvidersImpl) Create(ctx context.Context, request CreateProvid headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createProviderResponse) @@ -1214,7 +1213,7 @@ func (a *providerProvidersImpl) Delete(ctx context.Context, request DeleteProvid headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1228,7 +1227,7 @@ func (a *providerProvidersImpl) Get(ctx context.Context, request GetProviderRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getProviderResponse) @@ -1273,7 +1272,7 @@ func (a *providerProvidersImpl) internalList(ctx context.Context, request ListPr headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) @@ -1288,7 +1287,7 @@ func (a *providerProvidersImpl) Update(ctx context.Context, request UpdateProvid headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &updateProviderResponse) diff --git a/service/ml/impl.go b/service/ml/impl.go index 6e01078c3..499a032aa 100644 --- a/service/ml/impl.go +++ b/service/ml/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -29,7 +28,7 @@ func (a *experimentsImpl) CreateExperiment(ctx context.Context, request CreateEx headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createExperimentResponse) @@ -44,7 +43,7 @@ func (a *experimentsImpl) CreateLoggedModel(ctx context.Context, request CreateL headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createLoggedModelResponse) @@ -59,7 +58,7 @@ func (a *experimentsImpl) CreateRun(ctx context.Context, request CreateRun) (*Cr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createRunResponse) @@ -73,7 +72,7 @@ func (a *experimentsImpl) DeleteExperiment(ctx context.Context, request DeleteEx headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -86,7 +85,7 @@ func (a *experimentsImpl) DeleteLoggedModel(ctx context.Context, request DeleteL headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -99,7 +98,7 @@ func (a *experimentsImpl) DeleteLoggedModelTag(ctx context.Context, request Dele headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -113,7 +112,7 @@ func (a *experimentsImpl) DeleteRun(ctx context.Context, request DeleteRun) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -128,7 +127,7 @@ func (a *experimentsImpl) DeleteRuns(ctx context.Context, request DeleteRuns) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &deleteRunsResponse) @@ -142,7 +141,7 @@ func (a *experimentsImpl) DeleteTag(ctx context.Context, request DeleteTag) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -157,7 +156,7 @@ func (a *experimentsImpl) FinalizeLoggedModel(ctx context.Context, request Final headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &finalizeLoggedModelResponse) @@ -171,7 +170,7 @@ func (a *experimentsImpl) GetByName(ctx context.Context, request GetByNameReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentByNameResponse) @@ -185,7 +184,7 @@ func (a *experimentsImpl) GetExperiment(ctx context.Context, request GetExperime headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentResponse) @@ -230,7 +229,7 @@ func (a *experimentsImpl) internalGetHistory(ctx context.Context, request GetHis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getMetricHistoryResponse) @@ -244,7 +243,7 @@ func (a *experimentsImpl) GetLoggedModel(ctx context.Context, request GetLoggedM headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getLoggedModelResponse) @@ -258,7 +257,7 @@ func (a *experimentsImpl) GetPermissionLevels(ctx context.Context, request GetEx headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getExperimentPermissionLevelsResponse) @@ -272,7 +271,7 @@ func (a *experimentsImpl) GetPermissions(ctx context.Context, request GetExperim headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &experimentPermissions) @@ -286,7 +285,7 @@ func (a *experimentsImpl) GetRun(ctx context.Context, request GetRunRequest) (*G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRunResponse) @@ -341,7 +340,7 @@ func (a *experimentsImpl) internalListArtifacts(ctx context.Context, request Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listArtifactsResponse) @@ -386,7 +385,7 @@ func (a *experimentsImpl) internalListExperiments(ctx context.Context, request L headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listExperimentsResponse) @@ -400,7 +399,7 @@ func (a *experimentsImpl) LogBatch(ctx context.Context, request LogBatch) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -414,7 +413,7 @@ func (a *experimentsImpl) LogInputs(ctx context.Context, request LogInputs) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -428,7 +427,7 @@ func (a *experimentsImpl) LogLoggedModelParams(ctx context.Context, request LogL headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -442,7 +441,7 @@ func (a *experimentsImpl) LogMetric(ctx context.Context, request LogMetric) erro headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -456,7 +455,7 @@ func (a *experimentsImpl) LogModel(ctx context.Context, request LogModel) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -470,7 +469,7 @@ func (a *experimentsImpl) LogOutputs(ctx context.Context, request LogOutputsRequ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -484,7 +483,7 @@ func (a *experimentsImpl) LogParam(ctx context.Context, request LogParam) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -498,7 +497,7 @@ func (a *experimentsImpl) RestoreExperiment(ctx context.Context, request Restore headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -512,7 +511,7 @@ func (a *experimentsImpl) RestoreRun(ctx context.Context, request RestoreRun) er headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -527,7 +526,7 @@ func (a *experimentsImpl) RestoreRuns(ctx context.Context, request RestoreRuns) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &restoreRunsResponse) @@ -573,7 +572,7 @@ func (a *experimentsImpl) internalSearchExperiments(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchExperimentsResponse) @@ -588,7 +587,7 @@ func (a *experimentsImpl) SearchLoggedModels(ctx context.Context, request Search headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchLoggedModelsResponse) @@ -638,7 +637,7 @@ func (a *experimentsImpl) internalSearchRuns(ctx context.Context, request Search headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &searchRunsResponse) @@ -652,7 +651,7 @@ func (a *experimentsImpl) SetExperimentTag(ctx context.Context, request SetExper headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -666,7 +665,7 @@ func (a *experimentsImpl) SetLoggedModelTags(ctx context.Context, request SetLog headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -681,7 +680,7 @@ func (a *experimentsImpl) SetPermissions(ctx context.Context, request Experiment headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &experimentPermissions) @@ -695,7 +694,7 @@ func (a *experimentsImpl) SetTag(ctx context.Context, request SetTag) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -709,7 +708,7 @@ func (a *experimentsImpl) UpdateExperiment(ctx context.Context, request UpdateEx headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -724,7 +723,7 @@ func (a *experimentsImpl) UpdatePermissions(ctx context.Context, request Experim headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &experimentPermissions) @@ -739,7 +738,7 @@ func (a *experimentsImpl) UpdateRun(ctx context.Context, request UpdateRun) (*Up headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &updateRunResponse) @@ -759,7 +758,7 @@ func (a *featureEngineeringImpl) BatchCreateMaterializedFeatures(ctx context.Con headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &batchCreateMaterializedFeaturesResponse) @@ -774,7 +773,7 @@ func (a *featureEngineeringImpl) CreateFeature(ctx context.Context, request Crea headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Feature, &feature) @@ -789,7 +788,7 @@ func (a *featureEngineeringImpl) CreateKafkaConfig(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.KafkaConfig, &kafkaConfig) @@ -804,7 +803,7 @@ func (a *featureEngineeringImpl) CreateMaterializedFeature(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.MaterializedFeature, &materializedFeature) @@ -817,7 +816,7 @@ func (a *featureEngineeringImpl) DeleteFeature(ctx context.Context, request Dele headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -830,7 +829,7 @@ func (a *featureEngineeringImpl) DeleteKafkaConfig(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -843,7 +842,7 @@ func (a *featureEngineeringImpl) DeleteMaterializedFeature(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -857,7 +856,7 @@ func (a *featureEngineeringImpl) GetFeature(ctx context.Context, request GetFeat headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &feature) @@ -871,7 +870,7 @@ func (a *featureEngineeringImpl) GetKafkaConfig(ctx context.Context, request Get headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &kafkaConfig) @@ -885,7 +884,7 @@ func (a *featureEngineeringImpl) GetMaterializedFeature(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &materializedFeature) @@ -930,7 +929,7 @@ func (a *featureEngineeringImpl) internalListFeatures(ctx context.Context, reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFeaturesResponse) @@ -979,7 +978,7 @@ func (a *featureEngineeringImpl) internalListKafkaConfigs(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listKafkaConfigsResponse) @@ -1024,7 +1023,7 @@ func (a *featureEngineeringImpl) internalListMaterializedFeatures(ctx context.Co headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listMaterializedFeaturesResponse) @@ -1043,7 +1042,7 @@ func (a *featureEngineeringImpl) UpdateFeature(ctx context.Context, request Upda headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Feature, &feature) @@ -1065,7 +1064,7 @@ func (a *featureEngineeringImpl) UpdateKafkaConfig(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.KafkaConfig, &kafkaConfig) @@ -1084,7 +1083,7 @@ func (a *featureEngineeringImpl) UpdateMaterializedFeature(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.MaterializedFeature, &materializedFeature) @@ -1104,7 +1103,7 @@ func (a *featureStoreImpl) CreateOnlineStore(ctx context.Context, request Create headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.OnlineStore, &onlineStore) @@ -1117,7 +1116,7 @@ func (a *featureStoreImpl) DeleteOnlineStore(ctx context.Context, request Delete headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1130,7 +1129,7 @@ func (a *featureStoreImpl) DeleteOnlineTable(ctx context.Context, request Delete headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1144,7 +1143,7 @@ func (a *featureStoreImpl) GetOnlineStore(ctx context.Context, request GetOnline headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &onlineStore) @@ -1189,7 +1188,7 @@ func (a *featureStoreImpl) internalListOnlineStores(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listOnlineStoresResponse) @@ -1204,7 +1203,7 @@ func (a *featureStoreImpl) PublishTable(ctx context.Context, request PublishTabl headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &publishTableResponse) @@ -1223,7 +1222,7 @@ func (a *featureStoreImpl) UpdateOnlineStore(ctx context.Context, request Update headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.OnlineStore, &onlineStore) @@ -1243,7 +1242,7 @@ func (a *forecastingImpl) CreateExperiment(ctx context.Context, request CreateFo headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createForecastingExperimentResponse) @@ -1257,7 +1256,7 @@ func (a *forecastingImpl) GetExperiment(ctx context.Context, request GetForecast headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &forecastingExperiment) @@ -1277,7 +1276,7 @@ func (a *materializedFeaturesImpl) CreateFeatureTag(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.FeatureTag, &featureTag) @@ -1290,7 +1289,7 @@ func (a *materializedFeaturesImpl) DeleteFeatureTag(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1304,7 +1303,7 @@ func (a *materializedFeaturesImpl) GetFeatureLineage(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &featureLineage) @@ -1318,7 +1317,7 @@ func (a *materializedFeaturesImpl) GetFeatureTag(ctx context.Context, request Ge headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &featureTag) @@ -1363,7 +1362,7 @@ func (a *materializedFeaturesImpl) internalListFeatureTags(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFeatureTagsResponse) @@ -1382,7 +1381,7 @@ func (a *materializedFeaturesImpl) UpdateFeatureTag(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.FeatureTag, &featureTag) @@ -1402,7 +1401,7 @@ func (a *modelRegistryImpl) ApproveTransitionRequest(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &approveTransitionRequestResponse) @@ -1417,7 +1416,7 @@ func (a *modelRegistryImpl) CreateComment(ctx context.Context, request CreateCom headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCommentResponse) @@ -1432,7 +1431,7 @@ func (a *modelRegistryImpl) CreateModel(ctx context.Context, request CreateModel headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createModelResponse) @@ -1447,7 +1446,7 @@ func (a *modelRegistryImpl) CreateModelVersion(ctx context.Context, request Crea headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createModelVersionResponse) @@ -1462,7 +1461,7 @@ func (a *modelRegistryImpl) CreateTransitionRequest(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createTransitionRequestResponse) @@ -1477,7 +1476,7 @@ func (a *modelRegistryImpl) CreateWebhook(ctx context.Context, request CreateReg headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createWebhookResponse) @@ -1490,7 +1489,7 @@ func (a *modelRegistryImpl) DeleteComment(ctx context.Context, request DeleteCom headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1503,7 +1502,7 @@ func (a *modelRegistryImpl) DeleteModel(ctx context.Context, request DeleteModel headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1516,7 +1515,7 @@ func (a *modelRegistryImpl) DeleteModelTag(ctx context.Context, request DeleteMo headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1529,7 +1528,7 @@ func (a *modelRegistryImpl) DeleteModelVersion(ctx context.Context, request Dele headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1542,7 +1541,7 @@ func (a *modelRegistryImpl) DeleteModelVersionTag(ctx context.Context, request D headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1556,7 +1555,7 @@ func (a *modelRegistryImpl) DeleteTransitionRequest(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteTransitionRequestResponse) @@ -1569,7 +1568,7 @@ func (a *modelRegistryImpl) DeleteWebhook(ctx context.Context, request DeleteWeb headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1609,7 +1608,7 @@ func (a *modelRegistryImpl) internalGetLatestVersions(ctx context.Context, reque headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &getLatestVersionsResponse) @@ -1623,7 +1622,7 @@ func (a *modelRegistryImpl) GetModel(ctx context.Context, request GetModelReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelResponse) @@ -1637,7 +1636,7 @@ func (a *modelRegistryImpl) GetModelVersion(ctx context.Context, request GetMode headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelVersionResponse) @@ -1651,7 +1650,7 @@ func (a *modelRegistryImpl) GetModelVersionDownloadUri(ctx context.Context, requ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getModelVersionDownloadUriResponse) @@ -1665,7 +1664,7 @@ func (a *modelRegistryImpl) GetPermissionLevels(ctx context.Context, request Get headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRegisteredModelPermissionLevelsResponse) @@ -1679,7 +1678,7 @@ func (a *modelRegistryImpl) GetPermissions(ctx context.Context, request GetRegis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ®isteredModelPermissions) @@ -1726,7 +1725,7 @@ func (a *modelRegistryImpl) internalListModels(ctx context.Context, request List headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listModelsResponse) @@ -1765,7 +1764,7 @@ func (a *modelRegistryImpl) internalListTransitionRequests(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTransitionRequestsResponse) @@ -1810,7 +1809,7 @@ func (a *modelRegistryImpl) internalListWebhooks(ctx context.Context, request Li headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRegistryWebhooks) @@ -1825,7 +1824,7 @@ func (a *modelRegistryImpl) RejectTransitionRequest(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &rejectTransitionRequestResponse) @@ -1840,7 +1839,7 @@ func (a *modelRegistryImpl) RenameModel(ctx context.Context, request RenameModel headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &renameModelResponse) @@ -1885,7 +1884,7 @@ func (a *modelRegistryImpl) internalSearchModelVersions(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchModelVersionsResponse) @@ -1930,7 +1929,7 @@ func (a *modelRegistryImpl) internalSearchModels(ctx context.Context, request Se headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &searchModelsResponse) @@ -1944,7 +1943,7 @@ func (a *modelRegistryImpl) SetModelTag(ctx context.Context, request SetModelTag headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1958,7 +1957,7 @@ func (a *modelRegistryImpl) SetModelVersionTag(ctx context.Context, request SetM headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1973,7 +1972,7 @@ func (a *modelRegistryImpl) SetPermissions(ctx context.Context, request Register headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, ®isteredModelPermissions) @@ -1988,7 +1987,7 @@ func (a *modelRegistryImpl) TestRegistryWebhook(ctx context.Context, request Tes headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &testRegistryWebhookResponse) @@ -2003,7 +2002,7 @@ func (a *modelRegistryImpl) TransitionStage(ctx context.Context, request Transit headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &transitionStageResponse) @@ -2018,7 +2017,7 @@ func (a *modelRegistryImpl) UpdateComment(ctx context.Context, request UpdateCom headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateCommentResponse) @@ -2033,7 +2032,7 @@ func (a *modelRegistryImpl) UpdateModel(ctx context.Context, request UpdateModel headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateModelResponse) @@ -2048,7 +2047,7 @@ func (a *modelRegistryImpl) UpdateModelVersion(ctx context.Context, request Upda headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateModelVersionResponse) @@ -2063,7 +2062,7 @@ func (a *modelRegistryImpl) UpdatePermissions(ctx context.Context, request Regis headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ®isteredModelPermissions) @@ -2078,7 +2077,7 @@ func (a *modelRegistryImpl) UpdateWebhook(ctx context.Context, request UpdateReg headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateWebhookResponse) diff --git a/service/oauth2/impl.go b/service/oauth2/impl.go index 5b8b401f5..a19e5eca0 100755 --- a/service/oauth2/impl.go +++ b/service/oauth2/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -532,7 +531,7 @@ func (a *servicePrincipalSecretsProxyImpl) Create(ctx context.Context, request C headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createServicePrincipalSecretResponse) @@ -544,7 +543,7 @@ func (a *servicePrincipalSecretsProxyImpl) Delete(ctx context.Context, request D queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -593,7 +592,7 @@ func (a *servicePrincipalSecretsProxyImpl) internalList(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listServicePrincipalSecretsResponse) diff --git a/service/pipelines/impl.go b/service/pipelines/impl.go index 2842b1674..6a0013d73 100755 --- a/service/pipelines/impl.go +++ b/service/pipelines/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *pipelinesImpl) Clone(ctx context.Context, request ClonePipelineRequest) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &clonePipelineResponse) @@ -41,7 +40,7 @@ func (a *pipelinesImpl) Create(ctx context.Context, request CreatePipeline) (*Cr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createPipelineResponse) @@ -54,7 +53,7 @@ func (a *pipelinesImpl) Delete(ctx context.Context, request DeletePipelineReques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -68,7 +67,7 @@ func (a *pipelinesImpl) Get(ctx context.Context, request GetPipelineRequest) (*G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPipelineResponse) @@ -82,7 +81,7 @@ func (a *pipelinesImpl) GetPermissionLevels(ctx context.Context, request GetPipe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getPipelinePermissionLevelsResponse) @@ -96,7 +95,7 @@ func (a *pipelinesImpl) GetPermissions(ctx context.Context, request GetPipelineP headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &pipelinePermissions) @@ -110,7 +109,7 @@ func (a *pipelinesImpl) GetUpdate(ctx context.Context, request GetUpdateRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getUpdateResponse) @@ -155,7 +154,7 @@ func (a *pipelinesImpl) internalListPipelineEvents(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPipelineEventsResponse) @@ -200,7 +199,7 @@ func (a *pipelinesImpl) internalListPipelines(ctx context.Context, request ListP headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listPipelinesResponse) @@ -214,7 +213,7 @@ func (a *pipelinesImpl) ListUpdates(ctx context.Context, request ListUpdatesRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listUpdatesResponse) @@ -229,7 +228,7 @@ func (a *pipelinesImpl) SetPermissions(ctx context.Context, request PipelinePerm headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &pipelinePermissions) @@ -244,7 +243,7 @@ func (a *pipelinesImpl) StartUpdate(ctx context.Context, request StartUpdate) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &startUpdateResponse) @@ -257,7 +256,7 @@ func (a *pipelinesImpl) Stop(ctx context.Context, request StopRequest) error { headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -271,7 +270,7 @@ func (a *pipelinesImpl) Update(ctx context.Context, request EditPipeline) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -286,7 +285,7 @@ func (a *pipelinesImpl) UpdatePermissions(ctx context.Context, request PipelineP headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &pipelinePermissions) diff --git a/service/postgres/impl.go b/service/postgres/impl.go index a89ecae31..27467b538 100755 --- a/service/postgres/impl.go +++ b/service/postgres/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -33,7 +32,7 @@ func (a *postgresImpl) CreateBranch(ctx context.Context, request CreateBranchReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Branch, &operation) @@ -52,7 +51,7 @@ func (a *postgresImpl) CreateDatabase(ctx context.Context, request CreateDatabas headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Database, &operation) @@ -71,7 +70,7 @@ func (a *postgresImpl) CreateEndpoint(ctx context.Context, request CreateEndpoin headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Endpoint, &operation) @@ -90,7 +89,7 @@ func (a *postgresImpl) CreateProject(ctx context.Context, request CreateProjectR headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Project, &operation) @@ -109,7 +108,7 @@ func (a *postgresImpl) CreateRole(ctx context.Context, request CreateRoleRequest headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Role, &operation) @@ -123,7 +122,7 @@ func (a *postgresImpl) DeleteBranch(ctx context.Context, request DeleteBranchReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -137,7 +136,7 @@ func (a *postgresImpl) DeleteDatabase(ctx context.Context, request DeleteDatabas headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -151,7 +150,7 @@ func (a *postgresImpl) DeleteEndpoint(ctx context.Context, request DeleteEndpoin headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -165,7 +164,7 @@ func (a *postgresImpl) DeleteProject(ctx context.Context, request DeleteProjectR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -179,7 +178,7 @@ func (a *postgresImpl) DeleteRole(ctx context.Context, request DeleteRoleRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &operation) @@ -194,7 +193,7 @@ func (a *postgresImpl) GenerateDatabaseCredential(ctx context.Context, request G headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &databaseCredential) @@ -208,7 +207,7 @@ func (a *postgresImpl) GetBranch(ctx context.Context, request GetBranchRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &branch) @@ -222,7 +221,7 @@ func (a *postgresImpl) GetDatabase(ctx context.Context, request GetDatabaseReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &database) @@ -236,7 +235,7 @@ func (a *postgresImpl) GetEndpoint(ctx context.Context, request GetEndpointReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &endpoint) @@ -250,7 +249,7 @@ func (a *postgresImpl) GetOperation(ctx context.Context, request GetOperationReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &operation) @@ -264,7 +263,7 @@ func (a *postgresImpl) GetProject(ctx context.Context, request GetProjectRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &project) @@ -278,7 +277,7 @@ func (a *postgresImpl) GetRole(ctx context.Context, request GetRoleRequest) (*Ro headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &role) @@ -323,7 +322,7 @@ func (a *postgresImpl) internalListBranches(ctx context.Context, request ListBra headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listBranchesResponse) @@ -368,7 +367,7 @@ func (a *postgresImpl) internalListDatabases(ctx context.Context, request ListDa headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDatabasesResponse) @@ -413,7 +412,7 @@ func (a *postgresImpl) internalListEndpoints(ctx context.Context, request ListEn headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEndpointsResponse) @@ -460,7 +459,7 @@ func (a *postgresImpl) internalListProjects(ctx context.Context, request ListPro headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProjectsResponse) @@ -505,7 +504,7 @@ func (a *postgresImpl) internalListRoles(ctx context.Context, request ListRolesR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRolesResponse) @@ -527,7 +526,7 @@ func (a *postgresImpl) UpdateBranch(ctx context.Context, request UpdateBranchReq headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Branch, &operation) @@ -549,7 +548,7 @@ func (a *postgresImpl) UpdateDatabase(ctx context.Context, request UpdateDatabas headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Database, &operation) @@ -571,7 +570,7 @@ func (a *postgresImpl) UpdateEndpoint(ctx context.Context, request UpdateEndpoin headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Endpoint, &operation) @@ -593,7 +592,7 @@ func (a *postgresImpl) UpdateProject(ctx context.Context, request UpdateProjectR headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Project, &operation) @@ -615,7 +614,7 @@ func (a *postgresImpl) UpdateRole(ctx context.Context, request UpdateRoleRequest headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Role, &operation) diff --git a/service/qualitymonitorv2/impl.go b/service/qualitymonitorv2/impl.go index e38598c17..5aeadac7e 100755 --- a/service/qualitymonitorv2/impl.go +++ b/service/qualitymonitorv2/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *qualityMonitorV2Impl) CreateQualityMonitor(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.QualityMonitor, &qualityMonitor) @@ -39,7 +38,7 @@ func (a *qualityMonitorV2Impl) DeleteQualityMonitor(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -53,7 +52,7 @@ func (a *qualityMonitorV2Impl) GetQualityMonitor(ctx context.Context, request Ge headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &qualityMonitor) @@ -100,7 +99,7 @@ func (a *qualityMonitorV2Impl) internalListQualityMonitor(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQualityMonitorResponse) @@ -115,7 +114,7 @@ func (a *qualityMonitorV2Impl) UpdateQualityMonitor(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request.QualityMonitor, &qualityMonitor) diff --git a/service/serving/impl.go b/service/serving/impl.go index 3cc9cf63f..f9dde7b60 100755 --- a/service/serving/impl.go +++ b/service/serving/impl.go @@ -10,7 +10,6 @@ import ( "sync" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/config/experimental/auth/dataplane" "github.com/databricks/databricks-sdk-go/httpclient" "github.com/databricks/databricks-sdk-go/listing" @@ -29,7 +28,7 @@ func (a *servingEndpointsImpl) BuildLogs(ctx context.Context, request BuildLogsR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &buildLogsResponse) @@ -44,7 +43,7 @@ func (a *servingEndpointsImpl) Create(ctx context.Context, request CreateServing headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servingEndpointDetailed) @@ -59,7 +58,7 @@ func (a *servingEndpointsImpl) CreateProvisionedThroughputEndpoint(ctx context.C headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &servingEndpointDetailed) @@ -71,7 +70,7 @@ func (a *servingEndpointsImpl) Delete(ctx context.Context, request DeleteServing queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -85,7 +84,7 @@ func (a *servingEndpointsImpl) ExportMetrics(ctx context.Context, request Export headers := make(map[string]string) headers["Accept"] = "text/plain" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportMetricsResponse) @@ -99,7 +98,7 @@ func (a *servingEndpointsImpl) Get(ctx context.Context, request GetServingEndpoi headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servingEndpointDetailed) @@ -113,7 +112,7 @@ func (a *servingEndpointsImpl) GetOpenApi(ctx context.Context, request GetOpenAp headers := make(map[string]string) headers["Accept"] = "text/plain" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getOpenApiResponse) @@ -127,7 +126,7 @@ func (a *servingEndpointsImpl) GetPermissionLevels(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getServingEndpointPermissionLevelsResponse) @@ -141,7 +140,7 @@ func (a *servingEndpointsImpl) GetPermissions(ctx context.Context, request GetSe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &servingEndpointPermissions) @@ -156,7 +155,7 @@ func (a *servingEndpointsImpl) HttpRequest(ctx context.Context, request External headers["Accept"] = "text/plain" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &httpRequestResponse) @@ -196,7 +195,7 @@ func (a *servingEndpointsImpl) internalList(ctx context.Context) (*ListEndpoints headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listEndpointsResponse) @@ -210,7 +209,7 @@ func (a *servingEndpointsImpl) Logs(ctx context.Context, request LogsRequest) (* headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &serverLogsResponse) @@ -225,7 +224,7 @@ func (a *servingEndpointsImpl) Patch(ctx context.Context, request PatchServingEn headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &endpointTags) @@ -240,7 +239,7 @@ func (a *servingEndpointsImpl) Put(ctx context.Context, request PutRequest) (*Pu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &putResponse) @@ -255,7 +254,7 @@ func (a *servingEndpointsImpl) PutAiGateway(ctx context.Context, request PutAiGa headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &putAiGatewayResponse) @@ -270,7 +269,7 @@ func (a *servingEndpointsImpl) Query(ctx context.Context, request QueryEndpointI headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryEndpointResponse) @@ -285,7 +284,7 @@ func (a *servingEndpointsImpl) SetPermissions(ctx context.Context, request Servi headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointPermissions) @@ -300,7 +299,7 @@ func (a *servingEndpointsImpl) UpdateConfig(ctx context.Context, request Endpoin headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointDetailed) @@ -315,7 +314,7 @@ func (a *servingEndpointsImpl) UpdateNotifications(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateInferenceEndpointNotificationsResponse) @@ -330,7 +329,7 @@ func (a *servingEndpointsImpl) UpdatePermissions(ctx context.Context, request Se headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &servingEndpointPermissions) @@ -345,7 +344,7 @@ func (a *servingEndpointsImpl) UpdateProvisionedThroughputEndpointConfig(ctx con headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &servingEndpointDetailed) @@ -392,7 +391,7 @@ func (a *servingEndpointsDataPlaneImpl) Query(ctx context.Context, request Query headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } opts := []httpclient.DoOption{} diff --git a/service/settings/impl.go b/service/settings/impl.go index 50816f6c6..8f418202f 100755 --- a/service/settings/impl.go +++ b/service/settings/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -124,7 +123,7 @@ func (a *aibiDashboardEmbeddingAccessPolicyImpl) Delete(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAibiDashboardEmbeddingAccessPolicySettingResponse) @@ -138,7 +137,7 @@ func (a *aibiDashboardEmbeddingAccessPolicyImpl) Get(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aibiDashboardEmbeddingAccessPolicySetting) @@ -153,7 +152,7 @@ func (a *aibiDashboardEmbeddingAccessPolicyImpl) Update(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &aibiDashboardEmbeddingAccessPolicySetting) @@ -172,7 +171,7 @@ func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Delete(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteAibiDashboardEmbeddingApprovedDomainsSettingResponse) @@ -186,7 +185,7 @@ func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Get(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aibiDashboardEmbeddingApprovedDomainsSetting) @@ -201,7 +200,7 @@ func (a *aibiDashboardEmbeddingApprovedDomainsImpl) Update(ctx context.Context, headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &aibiDashboardEmbeddingApprovedDomainsSetting) @@ -220,7 +219,7 @@ func (a *automaticClusterUpdateImpl) Get(ctx context.Context, request GetAutomat headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &automaticClusterUpdateSetting) @@ -235,7 +234,7 @@ func (a *automaticClusterUpdateImpl) Update(ctx context.Context, request UpdateA headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &automaticClusterUpdateSetting) @@ -254,7 +253,7 @@ func (a *complianceSecurityProfileImpl) Get(ctx context.Context, request GetComp headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &complianceSecurityProfileSetting) @@ -269,7 +268,7 @@ func (a *complianceSecurityProfileImpl) Update(ctx context.Context, request Upda headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &complianceSecurityProfileSetting) @@ -289,7 +288,7 @@ func (a *credentialsManagerImpl) ExchangeToken(ctx context.Context, request Exch headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &exchangeTokenResponse) @@ -336,7 +335,7 @@ func (a *dashboardEmailSubscriptionsImpl) Delete(ctx context.Context, request De headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDashboardEmailSubscriptionsResponse) @@ -350,7 +349,7 @@ func (a *dashboardEmailSubscriptionsImpl) Get(ctx context.Context, request GetDa headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboardEmailSubscriptions) @@ -365,7 +364,7 @@ func (a *dashboardEmailSubscriptionsImpl) Update(ctx context.Context, request Up headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &dashboardEmailSubscriptions) @@ -384,7 +383,7 @@ func (a *defaultNamespaceImpl) Delete(ctx context.Context, request DeleteDefault headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDefaultNamespaceSettingResponse) @@ -398,7 +397,7 @@ func (a *defaultNamespaceImpl) Get(ctx context.Context, request GetDefaultNamesp headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultNamespaceSetting) @@ -413,7 +412,7 @@ func (a *defaultNamespaceImpl) Update(ctx context.Context, request UpdateDefault headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &defaultNamespaceSetting) @@ -432,7 +431,7 @@ func (a *defaultWarehouseIdImpl) Delete(ctx context.Context, request DeleteDefau headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDefaultWarehouseIdResponse) @@ -446,7 +445,7 @@ func (a *defaultWarehouseIdImpl) Get(ctx context.Context, request GetDefaultWare headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultWarehouseId) @@ -461,7 +460,7 @@ func (a *defaultWarehouseIdImpl) Update(ctx context.Context, request UpdateDefau headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &defaultWarehouseId) @@ -480,7 +479,7 @@ func (a *disableLegacyAccessImpl) Delete(ctx context.Context, request DeleteDisa headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDisableLegacyAccessResponse) @@ -494,7 +493,7 @@ func (a *disableLegacyAccessImpl) Get(ctx context.Context, request GetDisableLeg headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &disableLegacyAccess) @@ -509,7 +508,7 @@ func (a *disableLegacyAccessImpl) Update(ctx context.Context, request UpdateDisa headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &disableLegacyAccess) @@ -528,7 +527,7 @@ func (a *disableLegacyDbfsImpl) Delete(ctx context.Context, request DeleteDisabl headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDisableLegacyDbfsResponse) @@ -542,7 +541,7 @@ func (a *disableLegacyDbfsImpl) Get(ctx context.Context, request GetDisableLegac headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &disableLegacyDbfs) @@ -557,7 +556,7 @@ func (a *disableLegacyDbfsImpl) Update(ctx context.Context, request UpdateDisabl headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &disableLegacyDbfs) @@ -615,7 +614,7 @@ func (a *enableExportNotebookImpl) GetEnableExportNotebook(ctx context.Context) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableExportNotebook) @@ -630,7 +629,7 @@ func (a *enableExportNotebookImpl) PatchEnableExportNotebook(ctx context.Context headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableExportNotebook) @@ -688,7 +687,7 @@ func (a *enableNotebookTableClipboardImpl) GetEnableNotebookTableClipboard(ctx c headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableNotebookTableClipboard) @@ -703,7 +702,7 @@ func (a *enableNotebookTableClipboardImpl) PatchEnableNotebookTableClipboard(ctx headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableNotebookTableClipboard) @@ -722,7 +721,7 @@ func (a *enableResultsDownloadingImpl) GetEnableResultsDownloading(ctx context.C headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &enableResultsDownloading) @@ -737,7 +736,7 @@ func (a *enableResultsDownloadingImpl) PatchEnableResultsDownloading(ctx context headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enableResultsDownloading) @@ -756,7 +755,7 @@ func (a *enhancedSecurityMonitoringImpl) Get(ctx context.Context, request GetEnh headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &enhancedSecurityMonitoringSetting) @@ -771,7 +770,7 @@ func (a *enhancedSecurityMonitoringImpl) Update(ctx context.Context, request Upd headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &enhancedSecurityMonitoringSetting) @@ -819,7 +818,7 @@ func (a *ipAccessListsImpl) Create(ctx context.Context, request CreateIpAccessLi headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createIpAccessListResponse) @@ -831,7 +830,7 @@ func (a *ipAccessListsImpl) Delete(ctx context.Context, request DeleteIpAccessLi queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -845,7 +844,7 @@ func (a *ipAccessListsImpl) Get(ctx context.Context, request GetIpAccessListRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &fetchIpAccessListResponse) @@ -885,7 +884,7 @@ func (a *ipAccessListsImpl) internalList(ctx context.Context) (*ListIpAccessList headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listIpAccessListResponse) @@ -898,7 +897,7 @@ func (a *ipAccessListsImpl) Replace(ctx context.Context, request ReplaceIpAccess headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -911,7 +910,7 @@ func (a *ipAccessListsImpl) Update(ctx context.Context, request UpdateIpAccessLi headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -986,7 +985,7 @@ func (a *llmProxyPartnerPoweredWorkspaceImpl) Delete(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteLlmProxyPartnerPoweredWorkspaceResponse) @@ -1000,7 +999,7 @@ func (a *llmProxyPartnerPoweredWorkspaceImpl) Get(ctx context.Context, request G headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &llmProxyPartnerPoweredWorkspace) @@ -1015,7 +1014,7 @@ func (a *llmProxyPartnerPoweredWorkspaceImpl) Update(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &llmProxyPartnerPoweredWorkspace) @@ -1299,7 +1298,7 @@ func (a *notificationDestinationsImpl) Create(ctx context.Context, request Creat headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, ¬ificationDestination) @@ -1312,7 +1311,7 @@ func (a *notificationDestinationsImpl) Delete(ctx context.Context, request Delet headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1326,7 +1325,7 @@ func (a *notificationDestinationsImpl) Get(ctx context.Context, request GetNotif headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, ¬ificationDestination) @@ -1371,7 +1370,7 @@ func (a *notificationDestinationsImpl) internalList(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listNotificationDestinationsResponse) @@ -1386,7 +1385,7 @@ func (a *notificationDestinationsImpl) Update(ctx context.Context, request Updat headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, ¬ificationDestination) @@ -1444,7 +1443,7 @@ func (a *restrictWorkspaceAdminsImpl) Delete(ctx context.Context, request Delete headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteRestrictWorkspaceAdminsSettingResponse) @@ -1458,7 +1457,7 @@ func (a *restrictWorkspaceAdminsImpl) Get(ctx context.Context, request GetRestri headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &restrictWorkspaceAdminsSetting) @@ -1473,7 +1472,7 @@ func (a *restrictWorkspaceAdminsImpl) Update(ctx context.Context, request Update headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &restrictWorkspaceAdminsSetting) @@ -1497,7 +1496,7 @@ func (a *sqlResultsDownloadImpl) Delete(ctx context.Context, request DeleteSqlRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteSqlResultsDownloadResponse) @@ -1511,7 +1510,7 @@ func (a *sqlResultsDownloadImpl) Get(ctx context.Context, request GetSqlResultsD headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &sqlResultsDownload) @@ -1526,7 +1525,7 @@ func (a *sqlResultsDownloadImpl) Update(ctx context.Context, request UpdateSqlRe headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &sqlResultsDownload) @@ -1546,7 +1545,7 @@ func (a *tokenManagementImpl) CreateOboToken(ctx context.Context, request Create headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createOboTokenResponse) @@ -1558,7 +1557,7 @@ func (a *tokenManagementImpl) Delete(ctx context.Context, request DeleteTokenMan queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1572,7 +1571,7 @@ func (a *tokenManagementImpl) Get(ctx context.Context, request GetTokenManagemen headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getTokenResponse) @@ -1586,7 +1585,7 @@ func (a *tokenManagementImpl) GetPermissionLevels(ctx context.Context) (*GetToke headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getTokenPermissionLevelsResponse) @@ -1600,7 +1599,7 @@ func (a *tokenManagementImpl) GetPermissions(ctx context.Context) (*TokenPermiss headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &tokenPermissions) @@ -1639,7 +1638,7 @@ func (a *tokenManagementImpl) internalList(ctx context.Context, request ListToke headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTokensResponse) @@ -1654,7 +1653,7 @@ func (a *tokenManagementImpl) SetPermissions(ctx context.Context, request TokenP headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &tokenPermissions) @@ -1669,7 +1668,7 @@ func (a *tokenManagementImpl) UpdatePermissions(ctx context.Context, request Tok headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &tokenPermissions) @@ -1689,7 +1688,7 @@ func (a *tokensImpl) Create(ctx context.Context, request CreateTokenRequest) (*C headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createTokenResponse) @@ -1703,7 +1702,7 @@ func (a *tokensImpl) Delete(ctx context.Context, request RevokeTokenRequest) err headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1743,7 +1742,7 @@ func (a *tokensImpl) internalList(ctx context.Context) (*ListPublicTokensRespons headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listPublicTokensResponse) @@ -1762,7 +1761,7 @@ func (a *workspaceConfImpl) GetStatus(ctx context.Context, request GetStatusRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceConf) @@ -1775,7 +1774,7 @@ func (a *workspaceConfImpl) SetStatus(ctx context.Context, request WorkspaceConf headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) diff --git a/service/settingsv2/impl.go b/service/settingsv2/impl.go index 23666f2cd..a2ce211fe 100755 --- a/service/settingsv2/impl.go +++ b/service/settingsv2/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -172,7 +171,7 @@ func (a *workspaceSettingsV2Impl) GetPublicWorkspaceSetting(ctx context.Context, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &setting) @@ -221,7 +220,7 @@ func (a *workspaceSettingsV2Impl) internalListWorkspaceSettingsMetadata(ctx cont headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWorkspaceSettingsMetadataResponse) @@ -236,7 +235,7 @@ func (a *workspaceSettingsV2Impl) PatchPublicWorkspaceSetting(ctx context.Contex headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Setting, &setting) diff --git a/service/sharing/impl.go b/service/sharing/impl.go index aefba9379..9bacb9992 100644 --- a/service/sharing/impl.go +++ b/service/sharing/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *providersImpl) Create(ctx context.Context, request CreateProvider) (*Pr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &providerInfo) @@ -38,7 +37,7 @@ func (a *providersImpl) Delete(ctx context.Context, request DeleteProviderReques queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -52,7 +51,7 @@ func (a *providersImpl) Get(ctx context.Context, request GetProviderRequest) (*P headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &providerInfo) @@ -109,7 +108,7 @@ func (a *providersImpl) internalList(ctx context.Context, request ListProvidersR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProvidersResponse) @@ -123,7 +122,7 @@ func (a *providersImpl) ListProviderShareAssets(ctx context.Context, request Lis headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProviderShareAssetsResponse) @@ -174,7 +173,7 @@ func (a *providersImpl) internalListShares(ctx context.Context, request ListShar headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listProviderSharesResponse) @@ -189,7 +188,7 @@ func (a *providersImpl) Update(ctx context.Context, request UpdateProvider) (*Pr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &providerInfo) @@ -207,7 +206,7 @@ func (a *recipientActivationImpl) GetActivationUrlInfo(ctx context.Context, requ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, nil) @@ -221,7 +220,7 @@ func (a *recipientActivationImpl) RetrieveToken(ctx context.Context, request Ret headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &retrieveTokenResponse) @@ -241,7 +240,7 @@ func (a *recipientFederationPoliciesImpl) Create(ctx context.Context, request Cr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Policy, &federationPolicy) @@ -254,7 +253,7 @@ func (a *recipientFederationPoliciesImpl) Delete(ctx context.Context, request De headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -268,7 +267,7 @@ func (a *recipientFederationPoliciesImpl) GetFederationPolicy(ctx context.Contex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &federationPolicy) @@ -317,7 +316,7 @@ func (a *recipientFederationPoliciesImpl) internalList(ctx context.Context, requ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listFederationPoliciesResponse) @@ -337,7 +336,7 @@ func (a *recipientsImpl) Create(ctx context.Context, request CreateRecipient) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &recipientInfo) @@ -349,7 +348,7 @@ func (a *recipientsImpl) Delete(ctx context.Context, request DeleteRecipientRequ queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -363,7 +362,7 @@ func (a *recipientsImpl) Get(ctx context.Context, request GetRecipientRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &recipientInfo) @@ -416,7 +415,7 @@ func (a *recipientsImpl) internalList(ctx context.Context, request ListRecipient headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listRecipientsResponse) @@ -431,7 +430,7 @@ func (a *recipientsImpl) RotateToken(ctx context.Context, request RotateRecipien headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &recipientInfo) @@ -445,7 +444,7 @@ func (a *recipientsImpl) SharePermissions(ctx context.Context, request SharePerm headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRecipientSharePermissionsResponse) @@ -460,7 +459,7 @@ func (a *recipientsImpl) Update(ctx context.Context, request UpdateRecipient) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &recipientInfo) @@ -480,7 +479,7 @@ func (a *sharesImpl) Create(ctx context.Context, request CreateShare) (*ShareInf headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &shareInfo) @@ -492,7 +491,7 @@ func (a *sharesImpl) Delete(ctx context.Context, request DeleteShareRequest) err queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -506,7 +505,7 @@ func (a *sharesImpl) Get(ctx context.Context, request GetShareRequest) (*ShareIn headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &shareInfo) @@ -559,7 +558,7 @@ func (a *sharesImpl) internalListShares(ctx context.Context, request SharesListR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSharesResponse) @@ -573,7 +572,7 @@ func (a *sharesImpl) SharePermissions(ctx context.Context, request SharePermissi headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getSharePermissionsResponse) @@ -588,7 +587,7 @@ func (a *sharesImpl) Update(ctx context.Context, request UpdateShare) (*ShareInf headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &shareInfo) @@ -603,7 +602,7 @@ func (a *sharesImpl) UpdatePermissions(ctx context.Context, request UpdateShareP headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateSharePermissionsResponse) diff --git a/service/sql/impl.go b/service/sql/impl.go index f66ebb028..1d13caa6e 100755 --- a/service/sql/impl.go +++ b/service/sql/impl.go @@ -10,7 +10,6 @@ import ( "strings" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" "golang.org/x/exp/slices" @@ -29,7 +28,7 @@ func (a *alertsImpl) Create(ctx context.Context, request CreateAlertRequest) (*A headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &alert) @@ -42,7 +41,7 @@ func (a *alertsImpl) Delete(ctx context.Context, request TrashAlertRequest) erro headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -56,7 +55,7 @@ func (a *alertsImpl) Get(ctx context.Context, request GetAlertRequest) (*Alert, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &alert) @@ -105,7 +104,7 @@ func (a *alertsImpl) internalList(ctx context.Context, request ListAlertsRequest headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAlertsResponse) @@ -120,7 +119,7 @@ func (a *alertsImpl) Update(ctx context.Context, request UpdateAlertRequest) (*A headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &alert) @@ -140,7 +139,7 @@ func (a *alertsLegacyImpl) Create(ctx context.Context, request CreateAlert) (*Le headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyAlert) @@ -153,7 +152,7 @@ func (a *alertsLegacyImpl) Delete(ctx context.Context, request DeleteAlertsLegac headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -167,7 +166,7 @@ func (a *alertsLegacyImpl) Get(ctx context.Context, request GetAlertsLegacyReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &legacyAlert) @@ -181,7 +180,7 @@ func (a *alertsLegacyImpl) List(ctx context.Context) ([]LegacyAlert, error) { headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &legacyAlertList) @@ -195,7 +194,7 @@ func (a *alertsLegacyImpl) Update(ctx context.Context, request EditAlert) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -215,7 +214,7 @@ func (a *alertsV2Impl) CreateAlert(ctx context.Context, request CreateAlertV2Req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.Alert, &alertV2) @@ -229,7 +228,7 @@ func (a *alertsV2Impl) GetAlert(ctx context.Context, request GetAlertV2Request) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &alertV2) @@ -274,7 +273,7 @@ func (a *alertsV2Impl) internalListAlerts(ctx context.Context, request ListAlert headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAlertsV2Response) @@ -287,7 +286,7 @@ func (a *alertsV2Impl) TrashAlert(ctx context.Context, request TrashAlertV2Reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -306,7 +305,7 @@ func (a *alertsV2Impl) UpdateAlert(ctx context.Context, request UpdateAlertV2Req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.Alert, &alertV2) @@ -326,7 +325,7 @@ func (a *dashboardWidgetsImpl) Create(ctx context.Context, request CreateWidget) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &widget) @@ -339,7 +338,7 @@ func (a *dashboardWidgetsImpl) Delete(ctx context.Context, request DeleteDashboa headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -354,7 +353,7 @@ func (a *dashboardWidgetsImpl) Update(ctx context.Context, request UpdateWidgetR headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &widget) @@ -372,7 +371,7 @@ func (a *dashboardsImpl) Delete(ctx context.Context, request DeleteDashboardRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -386,7 +385,7 @@ func (a *dashboardsImpl) Get(ctx context.Context, request GetDashboardRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &dashboard) @@ -450,7 +449,7 @@ func (a *dashboardsImpl) internalList(ctx context.Context, request ListDashboard headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listResponse) @@ -463,7 +462,7 @@ func (a *dashboardsImpl) Restore(ctx context.Context, request RestoreDashboardRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -478,7 +477,7 @@ func (a *dashboardsImpl) Update(ctx context.Context, request DashboardEditConten headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &dashboard) @@ -497,7 +496,7 @@ func (a *dataSourcesImpl) List(ctx context.Context) ([]DataSource, error) { headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &dataSourceList) @@ -516,7 +515,7 @@ func (a *dbsqlPermissionsImpl) Get(ctx context.Context, request GetDbsqlPermissi headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getResponse) @@ -531,7 +530,7 @@ func (a *dbsqlPermissionsImpl) Set(ctx context.Context, request SetRequest) (*Se headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &setResponse) @@ -546,7 +545,7 @@ func (a *dbsqlPermissionsImpl) TransferOwnership(ctx context.Context, request Tr headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &success) @@ -566,7 +565,7 @@ func (a *queriesImpl) Create(ctx context.Context, request CreateQueryRequest) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &query) @@ -579,7 +578,7 @@ func (a *queriesImpl) Delete(ctx context.Context, request TrashQueryRequest) err headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -593,7 +592,7 @@ func (a *queriesImpl) Get(ctx context.Context, request GetQueryRequest) (*Query, headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &query) @@ -642,7 +641,7 @@ func (a *queriesImpl) internalList(ctx context.Context, request ListQueriesReque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQueryObjectsResponse) @@ -687,7 +686,7 @@ func (a *queriesImpl) internalListVisualizations(ctx context.Context, request Li headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVisualizationsForQueryResponse) @@ -702,7 +701,7 @@ func (a *queriesImpl) Update(ctx context.Context, request UpdateQueryRequest) (* headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &query) @@ -722,7 +721,7 @@ func (a *queriesLegacyImpl) Create(ctx context.Context, request QueryPostContent headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyQuery) @@ -735,7 +734,7 @@ func (a *queriesLegacyImpl) Delete(ctx context.Context, request DeleteQueriesLeg headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -749,7 +748,7 @@ func (a *queriesLegacyImpl) Get(ctx context.Context, request GetQueriesLegacyReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &legacyQuery) @@ -815,7 +814,7 @@ func (a *queriesLegacyImpl) internalList(ctx context.Context, request ListQuerie headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &queryList) @@ -828,7 +827,7 @@ func (a *queriesLegacyImpl) Restore(ctx context.Context, request RestoreQueriesL headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -843,7 +842,7 @@ func (a *queriesLegacyImpl) Update(ctx context.Context, request QueryEditContent headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyQuery) @@ -862,7 +861,7 @@ func (a *queryHistoryImpl) List(ctx context.Context, request ListQueryHistoryReq headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listQueriesResponse) @@ -882,7 +881,7 @@ func (a *queryVisualizationsImpl) Create(ctx context.Context, request CreateVisu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &visualization) @@ -895,7 +894,7 @@ func (a *queryVisualizationsImpl) Delete(ctx context.Context, request DeleteVisu headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -910,7 +909,7 @@ func (a *queryVisualizationsImpl) Update(ctx context.Context, request UpdateVisu headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &visualization) @@ -930,7 +929,7 @@ func (a *queryVisualizationsLegacyImpl) Create(ctx context.Context, request Crea headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyVisualization) @@ -943,7 +942,7 @@ func (a *queryVisualizationsLegacyImpl) Delete(ctx context.Context, request Dele headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -958,7 +957,7 @@ func (a *queryVisualizationsLegacyImpl) Update(ctx context.Context, request Lega headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &legacyVisualization) @@ -977,7 +976,7 @@ func (a *redashConfigImpl) GetConfig(ctx context.Context) (*ClientConfig, error) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &clientConfig) @@ -994,7 +993,7 @@ func (a *statementExecutionImpl) CancelExecution(ctx context.Context, request Ca queryParams := make(map[string]any) headers := make(map[string]string) cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -1009,7 +1008,7 @@ func (a *statementExecutionImpl) ExecuteStatement(ctx context.Context, request E headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &statementResponse) @@ -1023,7 +1022,7 @@ func (a *statementExecutionImpl) GetStatement(ctx context.Context, request GetSt headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &statementResponse) @@ -1037,7 +1036,7 @@ func (a *statementExecutionImpl) GetStatementResultChunkN(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &resultData) @@ -1057,7 +1056,7 @@ func (a *warehousesImpl) Create(ctx context.Context, request CreateWarehouseRequ headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createWarehouseResponse) @@ -1076,7 +1075,7 @@ func (a *warehousesImpl) CreateDefaultWarehouseOverride(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.DefaultWarehouseOverride, &defaultWarehouseOverride) @@ -1089,7 +1088,7 @@ func (a *warehousesImpl) Delete(ctx context.Context, request DeleteWarehouseRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1102,7 +1101,7 @@ func (a *warehousesImpl) DeleteDefaultWarehouseOverride(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -1116,7 +1115,7 @@ func (a *warehousesImpl) Edit(ctx context.Context, request EditWarehouseRequest) headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -1130,7 +1129,7 @@ func (a *warehousesImpl) Get(ctx context.Context, request GetWarehouseRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWarehouseResponse) @@ -1144,7 +1143,7 @@ func (a *warehousesImpl) GetDefaultWarehouseOverride(ctx context.Context, reques headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &defaultWarehouseOverride) @@ -1158,7 +1157,7 @@ func (a *warehousesImpl) GetPermissionLevels(ctx context.Context, request GetWar headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWarehousePermissionLevelsResponse) @@ -1172,7 +1171,7 @@ func (a *warehousesImpl) GetPermissions(ctx context.Context, request GetWarehous headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &warehousePermissions) @@ -1186,7 +1185,7 @@ func (a *warehousesImpl) GetWorkspaceWarehouseConfig(ctx context.Context) (*GetW headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &getWorkspaceWarehouseConfigResponse) @@ -1231,7 +1230,7 @@ func (a *warehousesImpl) internalList(ctx context.Context, request ListWarehouse headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listWarehousesResponse) @@ -1278,7 +1277,7 @@ func (a *warehousesImpl) internalListDefaultWarehouseOverrides(ctx context.Conte headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listDefaultWarehouseOverridesResponse) @@ -1293,7 +1292,7 @@ func (a *warehousesImpl) SetPermissions(ctx context.Context, request WarehousePe headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &warehousePermissions) @@ -1307,7 +1306,7 @@ func (a *warehousesImpl) SetWorkspaceWarehouseConfig(ctx context.Context, reques headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, nil) @@ -1320,7 +1319,7 @@ func (a *warehousesImpl) Start(ctx context.Context, request StartRequest) error headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -1333,7 +1332,7 @@ func (a *warehousesImpl) Stop(ctx context.Context, request StopRequest) error { headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -1359,7 +1358,7 @@ func (a *warehousesImpl) UpdateDefaultWarehouseOverride(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.DefaultWarehouseOverride, &defaultWarehouseOverride) @@ -1374,7 +1373,7 @@ func (a *warehousesImpl) UpdatePermissions(ctx context.Context, request Warehous headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &warehousePermissions) diff --git a/service/tags/impl.go b/service/tags/impl.go index 1db40d9a7..63c62fa62 100755 --- a/service/tags/impl.go +++ b/service/tags/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *tagPoliciesImpl) CreateTagPolicy(ctx context.Context, request CreateTag headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagPolicy, &tagPolicy) @@ -39,7 +38,7 @@ func (a *tagPoliciesImpl) DeleteTagPolicy(ctx context.Context, request DeleteTag headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -53,7 +52,7 @@ func (a *tagPoliciesImpl) GetTagPolicy(ctx context.Context, request GetTagPolicy headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagPolicy) @@ -108,7 +107,7 @@ func (a *tagPoliciesImpl) internalListTagPolicies(ctx context.Context, request L headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTagPoliciesResponse) @@ -127,7 +126,7 @@ func (a *tagPoliciesImpl) UpdateTagPolicy(ctx context.Context, request UpdateTag headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagPolicy, &tagPolicy) @@ -147,7 +146,7 @@ func (a *workspaceEntityTagAssignmentsImpl) CreateTagAssignment(ctx context.Cont headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request.TagAssignment, &tagAssignment) @@ -160,7 +159,7 @@ func (a *workspaceEntityTagAssignmentsImpl) DeleteTagAssignment(ctx context.Cont headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -174,7 +173,7 @@ func (a *workspaceEntityTagAssignmentsImpl) GetTagAssignment(ctx context.Context headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &tagAssignment) @@ -219,7 +218,7 @@ func (a *workspaceEntityTagAssignmentsImpl) internalListTagAssignments(ctx conte headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listTagAssignmentsResponse) @@ -238,7 +237,7 @@ func (a *workspaceEntityTagAssignmentsImpl) UpdateTagAssignment(ctx context.Cont headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request.TagAssignment, &tagAssignment) diff --git a/service/vectorsearch/impl.go b/service/vectorsearch/impl.go index 5106ab12f..52be72d2d 100755 --- a/service/vectorsearch/impl.go +++ b/service/vectorsearch/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *vectorSearchEndpointsImpl) CreateEndpoint(ctx context.Context, request headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &endpointInfo) @@ -39,7 +38,7 @@ func (a *vectorSearchEndpointsImpl) DeleteEndpoint(ctx context.Context, request headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -53,7 +52,7 @@ func (a *vectorSearchEndpointsImpl) GetEndpoint(ctx context.Context, request Get headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &endpointInfo) @@ -98,7 +97,7 @@ func (a *vectorSearchEndpointsImpl) internalListEndpoints(ctx context.Context, r headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listEndpointResponse) @@ -113,7 +112,7 @@ func (a *vectorSearchEndpointsImpl) PatchEndpoint(ctx context.Context, request P headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &endpointInfo) @@ -128,7 +127,7 @@ func (a *vectorSearchEndpointsImpl) RetrieveUserVisibleMetrics(ctx context.Conte headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &retrieveUserVisibleMetricsResponse) @@ -143,7 +142,7 @@ func (a *vectorSearchEndpointsImpl) UpdateEndpointBudgetPolicy(ctx context.Conte headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &patchEndpointBudgetPolicyResponse) @@ -158,7 +157,7 @@ func (a *vectorSearchEndpointsImpl) UpdateEndpointCustomTags(ctx context.Context headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &updateEndpointCustomTagsResponse) @@ -178,7 +177,7 @@ func (a *vectorSearchIndexesImpl) CreateIndex(ctx context.Context, request Creat headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &vectorIndex) @@ -192,7 +191,7 @@ func (a *vectorSearchIndexesImpl) DeleteDataVectorIndex(ctx context.Context, req headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, &deleteDataVectorIndexResponse) @@ -205,7 +204,7 @@ func (a *vectorSearchIndexesImpl) DeleteIndex(ctx context.Context, request Delet headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -219,7 +218,7 @@ func (a *vectorSearchIndexesImpl) GetIndex(ctx context.Context, request GetIndex headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &vectorIndex) @@ -264,7 +263,7 @@ func (a *vectorSearchIndexesImpl) internalListIndexes(ctx context.Context, reque headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listVectorIndexesResponse) @@ -279,7 +278,7 @@ func (a *vectorSearchIndexesImpl) QueryIndex(ctx context.Context, request QueryV headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryVectorIndexResponse) @@ -294,7 +293,7 @@ func (a *vectorSearchIndexesImpl) QueryNextPage(ctx context.Context, request Que headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &queryVectorIndexResponse) @@ -309,7 +308,7 @@ func (a *vectorSearchIndexesImpl) ScanIndex(ctx context.Context, request ScanVec headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &scanVectorIndexResponse) @@ -322,7 +321,7 @@ func (a *vectorSearchIndexesImpl) SyncIndex(ctx context.Context, request SyncInd headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, nil, nil) @@ -337,7 +336,7 @@ func (a *vectorSearchIndexesImpl) UpsertDataVectorIndex(ctx context.Context, req headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &upsertDataVectorIndexResponse) diff --git a/service/workspace/impl.go b/service/workspace/impl.go index 67f769a79..67e6df136 100755 --- a/service/workspace/impl.go +++ b/service/workspace/impl.go @@ -8,7 +8,6 @@ import ( "net/http" "github.com/databricks/databricks-sdk-go/client" - "github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/listing" "github.com/databricks/databricks-sdk-go/useragent" ) @@ -26,7 +25,7 @@ func (a *gitCredentialsImpl) Create(ctx context.Context, request CreateCredentia headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createCredentialsResponse) @@ -39,7 +38,7 @@ func (a *gitCredentialsImpl) Delete(ctx context.Context, request DeleteCredentia headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -53,7 +52,7 @@ func (a *gitCredentialsImpl) Get(ctx context.Context, request GetCredentialsRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getCredentialsResponse) @@ -92,7 +91,7 @@ func (a *gitCredentialsImpl) internalList(ctx context.Context, request ListCrede headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listCredentialsResponse) @@ -106,7 +105,7 @@ func (a *gitCredentialsImpl) Update(ctx context.Context, request UpdateCredentia headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -126,7 +125,7 @@ func (a *reposImpl) Create(ctx context.Context, request CreateRepoRequest) (*Cre headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, &createRepoResponse) @@ -139,7 +138,7 @@ func (a *reposImpl) Delete(ctx context.Context, request DeleteRepoRequest) error headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodDelete, path, headers, queryParams, request, nil) @@ -153,7 +152,7 @@ func (a *reposImpl) Get(ctx context.Context, request GetRepoRequest) (*GetRepoRe headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRepoResponse) @@ -167,7 +166,7 @@ func (a *reposImpl) GetPermissionLevels(ctx context.Context, request GetRepoPerm headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getRepoPermissionLevelsResponse) @@ -181,7 +180,7 @@ func (a *reposImpl) GetPermissions(ctx context.Context, request GetRepoPermissio headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &repoPermissions) @@ -228,7 +227,7 @@ func (a *reposImpl) internalList(ctx context.Context, request ListReposRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listReposResponse) @@ -243,7 +242,7 @@ func (a *reposImpl) SetPermissions(ctx context.Context, request RepoPermissionsR headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &repoPermissions) @@ -257,7 +256,7 @@ func (a *reposImpl) Update(ctx context.Context, request UpdateRepoRequest) error headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, nil) @@ -272,7 +271,7 @@ func (a *reposImpl) UpdatePermissions(ctx context.Context, request RepoPermissio headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &repoPermissions) @@ -290,7 +289,7 @@ func (a *secretsImpl) CreateScope(ctx context.Context, request CreateScope) erro headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -303,7 +302,7 @@ func (a *secretsImpl) DeleteAcl(ctx context.Context, request DeleteAcl) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -316,7 +315,7 @@ func (a *secretsImpl) DeleteScope(ctx context.Context, request DeleteScope) erro headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -330,7 +329,7 @@ func (a *secretsImpl) DeleteSecret(ctx context.Context, request DeleteSecret) er headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -344,7 +343,7 @@ func (a *secretsImpl) GetAcl(ctx context.Context, request GetAclRequest) (*AclIt headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &aclItem) @@ -358,7 +357,7 @@ func (a *secretsImpl) GetSecret(ctx context.Context, request GetSecretRequest) ( headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getSecretResponse) @@ -423,7 +422,7 @@ func (a *secretsImpl) internalListAcls(ctx context.Context, request ListAclsRequ headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listAclsResponse) @@ -483,7 +482,7 @@ func (a *secretsImpl) internalListScopes(ctx context.Context) (*ListScopesRespon headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, nil, nil, &listScopesResponse) @@ -554,7 +553,7 @@ func (a *secretsImpl) internalListSecrets(ctx context.Context, request ListSecre headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listSecretsResponse) @@ -567,7 +566,7 @@ func (a *secretsImpl) PutAcl(ctx context.Context, request PutAcl) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -580,7 +579,7 @@ func (a *secretsImpl) PutSecret(ctx context.Context, request PutSecret) error { headers := make(map[string]string) headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -599,7 +598,7 @@ func (a *workspaceImpl) Delete(ctx context.Context, request Delete) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -613,7 +612,7 @@ func (a *workspaceImpl) Export(ctx context.Context, request ExportRequest) (*Exp headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &exportResponse) @@ -627,7 +626,7 @@ func (a *workspaceImpl) GetPermissionLevels(ctx context.Context, request GetWork headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &getWorkspaceObjectPermissionLevelsResponse) @@ -641,7 +640,7 @@ func (a *workspaceImpl) GetPermissions(ctx context.Context, request GetWorkspace headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &workspaceObjectPermissions) @@ -655,7 +654,7 @@ func (a *workspaceImpl) GetStatus(ctx context.Context, request GetStatusRequest) headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &objectInfo) @@ -669,7 +668,7 @@ func (a *workspaceImpl) Import(ctx context.Context, request Import) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -712,7 +711,7 @@ func (a *workspaceImpl) internalList(ctx context.Context, request ListWorkspaceR headers := make(map[string]string) headers["Accept"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodGet, path, headers, queryParams, request, &listResponse) @@ -726,7 +725,7 @@ func (a *workspaceImpl) Mkdirs(ctx context.Context, request Mkdirs) error { headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPost, path, headers, queryParams, request, nil) @@ -741,7 +740,7 @@ func (a *workspaceImpl) SetPermissions(ctx context.Context, request WorkspaceObj headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPut, path, headers, queryParams, request, &workspaceObjectPermissions) @@ -756,7 +755,7 @@ func (a *workspaceImpl) UpdatePermissions(ctx context.Context, request Workspace headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" cfg := a.client.Config - if cfg.HostType() == config.UnifiedHost && cfg.WorkspaceID != "" { + if cfg.WorkspaceID != "" { headers["X-Databricks-Org-Id"] = cfg.WorkspaceID } err := a.client.Do(ctx, http.MethodPatch, path, headers, queryParams, request, &workspaceObjectPermissions) diff --git a/workspace_client.go b/workspace_client.go index f2dceec6d..9609951d6 100755 --- a/workspace_client.go +++ b/workspace_client.go @@ -1394,8 +1394,10 @@ type WorkspaceClient struct { Users iam.UsersInterface } -var ErrNotWorkspaceClient = errors.New("invalid Databricks Workspace configuration - host is not a workspace host") -var ErrWorkspaceIDRequired = errors.New("WorkspaceID must be set when using WorkspaceClient with unified host") +var ( + ErrNotWorkspaceClient = errors.New("invalid Databricks Workspace configuration - host is not a workspace host") + ErrWorkspaceIDRequired = errors.New("WorkspaceID must be set when using WorkspaceClient with unified host") +) // NewWorkspaceClient creates new Databricks SDK client for Workspaces or // returns error in case configuration is wrong @@ -1412,13 +1414,6 @@ func NewWorkspaceClient(c ...*Config) (*WorkspaceClient, error) { if err != nil { return nil, err } - hostType := cfg.HostType() - if hostType == config.AccountHost { - return nil, ErrNotWorkspaceClient - } - if hostType == config.UnifiedHost && cfg.WorkspaceID == "" { - return nil, ErrWorkspaceIDRequired - } apiClient, err := cfg.NewApiClient() if err != nil {