Documentation
¶
Overview ¶
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
Index ¶
- Variables
- func AddAccountIdField(s map[string]*schema.Schema) map[string]*schema.Schema
- func AddContextToAllResources(p *schema.Provider, prefix string)
- func AddNamespaceInSchema(m map[string]*schema.Schema) map[string]*schema.Schema
- func CalculateMd5Hash(content []byte) string
- func CopyViaJSON[T any](src T, includeFields []string) T
- func DataToReflectValue(d *schema.ResourceData, s map[string]*schema.Schema, rv reflect.Value) error
- func DataToStructPointer(d *schema.ResourceData, scm map[string]*schema.Schema, result any)
- func DiffToStructPointer(d attributeGetter, scm map[string]*schema.Schema, result any)
- func EqualFoldDiffSuppress(k, old, new string, d *schema.ResourceData) bool
- func GetInt64(d *schema.ResourceData, key string) int64
- func GetTerraformVersionFromContext(ctx context.Context) string
- func IgnoreNotFoundError(err error) error
- func IsExporter(ctx context.Context) bool
- func IsRequestEmpty(v any) (bool, error)
- func MustCompileKeyRE(name string) *regexp.Regexp
- func MustInt64(s string) int64
- func MustSchemaMap(s map[string]*schema.Schema, path ...string) map[string]*schema.Schema
- func MustSchemaPath(s map[string]*schema.Schema, path ...string) *schema.Schema
- func NamespaceCustomizeDiff(ctx context.Context, d *schema.ResourceDiff, c *DatabricksClient) error
- func NamespaceCustomizeSchema(s *CustomizableSchema)
- func NamespaceCustomizeSchemaMap(m map[string]*schema.Schema) map[string]*schema.Schema
- func NoCustomize(m map[string]*schema.Schema) map[string]*schema.Schema
- func OwnerRollbackError(err error, rollbackErr error, oldOwner string, newOwner string) error
- func ReadFileContent(source string) ([]byte, error)
- func ReadSerializedJsonContent(jsonStr, filePath string) (serJSON string, md5Hash string, err error)
- func RegisterResourceProvider(v any, r ResourceProvider)
- func RetryOn504[T any](ctx context.Context, f func(context.Context) (*T, error)) (*T, error)
- func RetryOnTimeout[T any](ctx context.Context, f func(context.Context) (*T, error)) (*T, error)
- func SchemaMap(s map[string]*schema.Schema, path ...string) (map[string]*schema.Schema, error)
- func SchemaPath(s map[string]*schema.Schema, path ...string) (*schema.Schema, error)
- func SetDefault(v *schema.Schema, value any)
- func SetForceSendFields(req any, d attributeGetter, fields []string)
- func SetReadOnly(v *schema.Schema)
- func SetRequired(v *schema.Schema)
- func StringIsUUID(s string) bool
- func StructToData(result any, s map[string]*schema.Schema, d *schema.ResourceData) error
- func StructToSchema(v any, customize func(map[string]*schema.Schema) map[string]*schema.Schema) map[string]*schema.Schema
- func SuppressDiffWhitespaceChange(k, old, new string, d *schema.ResourceData) bool
- func Version() string
- func WorkspaceOrEmptyPathPrefixDiffSuppress(k, old, new string, d *schema.ResourceData) bool
- func WorkspacePathPrefixDiffSuppress(k, old, new string, d *schema.ResourceData) bool
- type ApiVersion
- type BindResource
- type CommandExecutor
- type CommandMock
- type CommandResults
- type CustomizableSchema
- func (s *CustomizableSchema) AddNewField(key string, newField *schema.Schema) *CustomizableSchema
- func (s *CustomizableSchema) GetSchemaMap() map[string]*schema.Schema
- func (s *CustomizableSchema) RemoveField(key string) *CustomizableSchema
- func (s *CustomizableSchema) SchemaPath(path ...string) *CustomizableSchema
- func (s *CustomizableSchema) SetAtLeastOneOf(value []string) *CustomizableSchema
- func (s *CustomizableSchema) SetComputed() *CustomizableSchema
- func (s *CustomizableSchema) SetConflictsWith(value []string) *CustomizableSchema
- func (s *CustomizableSchema) SetCustomSuppressDiff(suppressor func(k, old, new string, d *schema.ResourceData) bool) *CustomizableSchema
- func (s *CustomizableSchema) SetDefault(value any) *CustomizableSchema
- func (s *CustomizableSchema) SetDeprecated(reason string) *CustomizableSchema
- func (s *CustomizableSchema) SetExactlyOneOf(value []string) *CustomizableSchema
- func (s *CustomizableSchema) SetForceNew() *CustomizableSchema
- func (s *CustomizableSchema) SetMaxItems(value int) *CustomizableSchema
- func (s *CustomizableSchema) SetMinItems(value int) *CustomizableSchema
- func (s *CustomizableSchema) SetOptional() *CustomizableSchema
- func (s *CustomizableSchema) SetReadOnly() *CustomizableSchema
- func (s *CustomizableSchema) SetRequired() *CustomizableSchema
- func (s *CustomizableSchema) SetRequiredWith(value []string) *CustomizableSchema
- func (s *CustomizableSchema) SetSensitive() *CustomizableSchema
- func (s *CustomizableSchema) SetSliceSet() *CustomizableSchema
- func (s *CustomizableSchema) SetSuppressDiff() *CustomizableSchema
- func (s *CustomizableSchema) SetSuppressDiffWithDefault(dv any) *CustomizableSchema
- func (s *CustomizableSchema) SetValidateDiagFunc(validate func(interface{}, cty.Path) diag.Diagnostics) *CustomizableSchema
- func (s *CustomizableSchema) SetValidateFunc(validate func(interface{}, string) ([]string, []error)) *CustomizableSchema
- type DatabricksClient
- func (c *DatabricksClient) AccountClient() (*databricks.AccountClient, error)
- func (c *DatabricksClient) AccountClientWithAccountIdFromConfig(d *schema.ResourceData) (*databricks.AccountClient, error)
- func (c *DatabricksClient) AccountClientWithAccountIdFromPair(d *schema.ResourceData, p *Pair) (*databricks.AccountClient, string, error)
- func (c *DatabricksClient) AccountOrWorkspaceRequest(accCallback func(*databricks.AccountClient) error, ...) error
- func (c *DatabricksClient) ClientForHost(ctx context.Context, url string) (*DatabricksClient, error)
- func (c *DatabricksClient) CommandExecutor(ctx context.Context) CommandExecutor
- func (c *DatabricksClient) DatabricksClientForUnifiedProvider(ctx context.Context, d *schema.ResourceData) (*DatabricksClient, error)
- func (c *DatabricksClient) Delete(ctx context.Context, path string, request any) error
- func (c *DatabricksClient) DeleteWithResponse(ctx context.Context, path string, request any, response any) error
- func (c *DatabricksClient) FormatURL(strs ...string) string
- func (c *DatabricksClient) Get(ctx context.Context, path string, request any, response any) error
- func (c *DatabricksClient) GetAccountClient() (*databricks.AccountClient, diag.Diagnostics)
- func (aa *DatabricksClient) GetAzureJwtProperty(key string) (any, error)
- func (c *DatabricksClient) GetWorkspaceClient() (*databricks.WorkspaceClient, diag.Diagnostics)
- func (c *DatabricksClient) GetWorkspaceClientForUnifiedProvider(ctx context.Context, workspaceID string) (*databricks.WorkspaceClient, error)
- func (c *DatabricksClient) GetWorkspaceClientForUnifiedProviderWithDiagnostics(ctx context.Context, workspaceID string) (*databricks.WorkspaceClient, diag.Diagnostics)
- func (c *DatabricksClient) IsAws() bool
- func (c *DatabricksClient) IsAzure() bool
- func (c *DatabricksClient) IsGcp() bool
- func (c *DatabricksClient) Patch(ctx context.Context, path string, request any) error
- func (c *DatabricksClient) PatchWithResponse(ctx context.Context, path string, request any, response any) error
- func (c *DatabricksClient) Post(ctx context.Context, path string, request any, response any) error
- func (c *DatabricksClient) Put(ctx context.Context, path string, request any) error
- func (c *DatabricksClient) Scim(ctx context.Context, method, path string, request any, response any) error
- func (c *DatabricksClient) SetAccountClient(a *databricks.AccountClient)
- func (c *DatabricksClient) SetWorkspaceClient(w *databricks.WorkspaceClient)
- func (c *DatabricksClient) SetWorkspaceClientForWorkspace(workspaceId int64, w *databricks.WorkspaceClient)
- func (c *DatabricksClient) WithCommandExecutor(cef func(context.Context, *DatabricksClient) CommandExecutor)
- func (c *DatabricksClient) WithCommandMock(mock CommandMock)
- func (c *DatabricksClient) WorkspaceClient() (*databricks.WorkspaceClient, error)
- func (c *DatabricksClient) WorkspaceClientForWorkspace(ctx context.Context, workspaceId int64) (*databricks.WorkspaceClient, error)
- func (c *DatabricksClient) WorkspaceClientUnifiedProvider(ctx context.Context, d *schema.ResourceData) (*databricks.WorkspaceClient, error)
- type Namespace
- type Pair
- type ProviderConfig
- type RecursiveResourceProvider
- type Resource
- func AccountData[T any](read func(context.Context, *T, *databricks.AccountClient) error) Resource
- func AccountDataWithParams[T, P any](read func(context.Context, P, *databricks.AccountClient) (*T, error)) Resource
- func DataResource(sc any, read func(context.Context, any, *DatabricksClient) error) Resourcedeprecated
- func NoClientData[T any](read func(context.Context, *T) error) Resource
- func WorkspaceData[T any](read func(context.Context, *T, *databricks.WorkspaceClient) error) Resource
- func WorkspaceDataWithCustomizeFunc[T any](read func(context.Context, *T, *databricks.WorkspaceClient) error, ...) Resource
- func WorkspaceDataWithParams[T, P any](read func(context.Context, P, *databricks.WorkspaceClient) (*T, error)) Resource
- type ResourceProvider
- type ResourceProviderWithAlias
- type ResourceProviderWithResourceSpecificCustomization
Constants ¶
This section is empty.
Variables ¶
var ( // ResourceName is resource name without databricks_ prefix ResourceName contextKey = 1 // Provider is the current instance of provider Provider contextKey = 2 // Current is the current name of integration test Current contextKey = 3 // If current resource is data IsData contextKey = 4 // apiVersion Api contextKey = 5 // SDK used Sdk contextKey = 6 )
var NoAuth string = "default auth: cannot configure default credentials, " +
"please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication " +
"to configure credentials for your preferred authentication method"
var (
TerraformBugErrorMessage = "This is a bug. Please report this to the maintainers at github.com/databricks/terraform-provider-databricks."
)
Functions ¶
func AddAccountIdField ¶ added in v1.35.0
func AddContextToAllResources ¶
AddContextToAllResources ...
func AddNamespaceInSchema ¶ added in v1.97.0
AddNamespaceInSchema adds the provider_config schema to the given schema map. This is used by resources and data sources that are developed over SDKv2 and not using Go SDK that manually defines the schema without Structs
func CalculateMd5Hash ¶ added in v1.49.0
Calculates MD5 hash of the given content
func CopyViaJSON ¶ added in v1.85.0
CopyViaJSON copies the fields of the source struct to the destination struct. The fields to copy are specified by the includeFields parameter. Each entry in the includeFields parameter is a JSON path to a field in the source struct. It supports nested fields and maps via dot notation.
func DataToReflectValue ¶
func DataToReflectValue(d *schema.ResourceData, s map[string]*schema.Schema, rv reflect.Value) error
DataToReflectValue reads reflect value from data
func DataToStructPointer ¶
DataToStructPointer reads resource data with given schema onto result pointer. Panics.
func DiffToStructPointer ¶
DiffToStructPointer reads resource diff with given schema onto result pointer. Panics.
func EqualFoldDiffSuppress ¶ added in v1.14.3
func EqualFoldDiffSuppress(k, old, new string, d *schema.ResourceData) bool
func GetInt64 ¶ added in v1.50.0
func GetInt64(d *schema.ResourceData, key string) int64
GetInt64 returns the data for the given key and cast it to int64
func GetTerraformVersionFromContext ¶ added in v1.34.0
func IgnoreNotFoundError ¶ added in v1.52.0
Suppress the error if it is 404
func IsExporter ¶ added in v1.34.0
func IsRequestEmpty ¶ added in v1.32.0
func MustCompileKeyRE ¶
func MustSchemaMap ¶ added in v1.40.0
func MustSchemaPath ¶
func NamespaceCustomizeDiff ¶ added in v1.96.0
func NamespaceCustomizeDiff(ctx context.Context, d *schema.ResourceDiff, c *DatabricksClient) error
NamespaceCustomizeDiff is used to customize the diff for the provider configuration in a resource diff.
func NamespaceCustomizeSchema ¶ added in v1.96.0
func NamespaceCustomizeSchema(s *CustomizableSchema)
NamespaceCustomizeSchema is used to customize the schema for the provider configuration for a single schema.
func NamespaceCustomizeSchemaMap ¶ added in v1.96.0
NamespaceCustomizeSchemaMap is used to customize the schema for the provider configuration in a map of schemas.
func NoCustomize ¶ added in v1.29.0
func OwnerRollbackError ¶ added in v1.33.0
func ReadFileContent ¶ added in v1.49.0
Reads the file content from a given path
func ReadSerializedJsonContent ¶ added in v1.49.0
func ReadSerializedJsonContent(jsonStr, filePath string) (serJSON string, md5Hash string, err error)
Reads content from a JSON string or a file path and returns the content and its MD5 hash
func RegisterResourceProvider ¶ added in v1.39.0
func RegisterResourceProvider(v any, r ResourceProvider)
Pre-registered ResourceProvider for a given struct into resourceProviderRegistry. This function should be called in the init() function in packages with ResourceProvider. Example:
func init() {
common.RegisterResourceProvider(jobs.JobSettings{}) = JobSettingsResource{}
}
func RetryOn504 ¶ added in v1.62.1
RetryOn504 returns a retries.Retrier that calls the given method until it either succeeds or returns an error that is different from apierr.ErrDeadlineExceeded.
func RetryOnTimeout ¶ added in v1.43.0
func SchemaPath ¶
SchemaPath helps to navigate
func SetDefault ¶ added in v1.34.0
SetDefault sets the default value for a schema.
func SetForceSendFields ¶ added in v1.35.0
SetForceSendFields adds any fields specified in the `fields` parameter to the ForceSendFields field of the request structure if they are present in the resource state. The provided fields must match the JSON tag for some field in the request structure. This ensures that fields explicitly set to the zero value of its type (e.g. `0` for an `int`) will be serialized and sent to the platform.
This function requires that the request structure has a `ForceSendFields` field of type `[]string`. If not, it panics with an appropriate error message.
func SetReadOnly ¶ added in v1.34.0
SetReadOnly sets the schema to be read-only (i.e. computed, non-optional). This should be used for fields that are not user-configurable but are returned by the platform.
func SetRequired ¶ added in v1.34.0
SetRequired sets the schema to be required.
func StringIsUUID ¶ added in v1.28.0
func StructToData ¶
StructToData reads result using schema onto resource data
func StructToSchema ¶
func StructToSchema(v any, customize func(map[string]*schema.Schema) map[string]*schema.Schema) map[string]*schema.Schema
StructToSchema makes schema from a struct type & applies customizations from callback given
func SuppressDiffWhitespaceChange ¶ added in v1.37.0
func SuppressDiffWhitespaceChange(k, old, new string, d *schema.ResourceData) bool
func WorkspaceOrEmptyPathPrefixDiffSuppress ¶ added in v1.55.0
func WorkspaceOrEmptyPathPrefixDiffSuppress(k, old, new string, d *schema.ResourceData) bool
WorkspaceOrEmptyPathPrefixDiffSuppress is similar WorkspacePathPrefixDiffSuppress but also suppresses diffs when the new value is empty (not specified by user).
func WorkspacePathPrefixDiffSuppress ¶ added in v1.53.0
func WorkspacePathPrefixDiffSuppress(k, old, new string, d *schema.ResourceData) bool
WorkspacePathPrefixDiffSuppress suppresses diffs for workspace paths where both sides may or may not include the `/Workspace` prefix.
This is the case for dashboards, alerts and queries where at create time, the user may include the `/Workspace` prefix for the `parent_path` field, but the read response will not include the prefix.
Types ¶
type ApiVersion ¶
type ApiVersion string
const ( API_1_2 ApiVersion = "1.2" API_2_0 ApiVersion = "2.0" API_2_1 ApiVersion = "2.1" )
type BindResource ¶
type BindResource struct {
ReadContext func(ctx context.Context, left, right string, c *DatabricksClient) error
CreateContext func(ctx context.Context, left, right string, c *DatabricksClient) error
DeleteContext func(ctx context.Context, left, right string, c *DatabricksClient) error
}
BindResource defines resource with simplified functions
type CommandExecutor ¶
type CommandExecutor interface {
Execute(clusterID, language, commandStr string) CommandResults
}
CommandExecutor creates a spark context and executes a command and then closes context
type CommandMock ¶
type CommandMock func(commandStr string) CommandResults
CommandMock mocks the execution of command
type CommandResults ¶
type CommandResults struct {
ResultType string `json:"resultType,omitempty"`
Summary string `json:"summary,omitempty"`
Cause string `json:"cause,omitempty"`
Data any `json:"data,omitempty"`
Schema any `json:"schema,omitempty"`
Truncated bool `json:"truncated,omitempty"`
IsJSONSchema bool `json:"isJsonSchema,omitempty"`
// contains filtered or unexported fields
}
CommandResults captures results of a command
func (*CommandResults) Error ¶
func (cr *CommandResults) Error() string
Error returns error in a bit more friendly way
func (*CommandResults) Failed ¶
func (cr *CommandResults) Failed() bool
Failed tells if command execution failed
func (*CommandResults) Scan ¶
func (cr *CommandResults) Scan(dest ...any) bool
Scan scans for results
func (*CommandResults) Text ¶
func (cr *CommandResults) Text() string
Text returns plain text results
type CustomizableSchema ¶ added in v1.36.0
func CustomizeSchemaPath ¶ added in v1.36.0
func CustomizeSchemaPath(s map[string]*schema.Schema, path ...string) *CustomizableSchema
func (*CustomizableSchema) AddNewField ¶ added in v1.36.0
func (s *CustomizableSchema) AddNewField(key string, newField *schema.Schema) *CustomizableSchema
func (*CustomizableSchema) GetSchemaMap ¶ added in v1.41.0
func (s *CustomizableSchema) GetSchemaMap() map[string]*schema.Schema
func (*CustomizableSchema) RemoveField ¶ added in v1.43.0
func (s *CustomizableSchema) RemoveField(key string) *CustomizableSchema
func (*CustomizableSchema) SchemaPath ¶ added in v1.41.0
func (s *CustomizableSchema) SchemaPath(path ...string) *CustomizableSchema
func (*CustomizableSchema) SetAtLeastOneOf ¶ added in v1.36.0
func (s *CustomizableSchema) SetAtLeastOneOf(value []string) *CustomizableSchema
func (*CustomizableSchema) SetComputed ¶ added in v1.36.0
func (s *CustomizableSchema) SetComputed() *CustomizableSchema
func (*CustomizableSchema) SetConflictsWith ¶ added in v1.36.0
func (s *CustomizableSchema) SetConflictsWith(value []string) *CustomizableSchema
func (*CustomizableSchema) SetCustomSuppressDiff ¶ added in v1.36.0
func (s *CustomizableSchema) SetCustomSuppressDiff(suppressor func(k, old, new string, d *schema.ResourceData) bool) *CustomizableSchema
func (*CustomizableSchema) SetDefault ¶ added in v1.36.0
func (s *CustomizableSchema) SetDefault(value any) *CustomizableSchema
func (*CustomizableSchema) SetDeprecated ¶ added in v1.36.0
func (s *CustomizableSchema) SetDeprecated(reason string) *CustomizableSchema
func (*CustomizableSchema) SetExactlyOneOf ¶ added in v1.36.0
func (s *CustomizableSchema) SetExactlyOneOf(value []string) *CustomizableSchema
func (*CustomizableSchema) SetForceNew ¶ added in v1.36.0
func (s *CustomizableSchema) SetForceNew() *CustomizableSchema
func (*CustomizableSchema) SetMaxItems ¶ added in v1.36.0
func (s *CustomizableSchema) SetMaxItems(value int) *CustomizableSchema
func (*CustomizableSchema) SetMinItems ¶ added in v1.36.0
func (s *CustomizableSchema) SetMinItems(value int) *CustomizableSchema
func (*CustomizableSchema) SetOptional ¶ added in v1.36.0
func (s *CustomizableSchema) SetOptional() *CustomizableSchema
func (*CustomizableSchema) SetReadOnly ¶ added in v1.36.0
func (s *CustomizableSchema) SetReadOnly() *CustomizableSchema
SetReadOnly sets the schema to be read-only (i.e. computed, non-optional). This should be used for fields that are not user-configurable but are returned by the platform.
func (*CustomizableSchema) SetRequired ¶ added in v1.36.0
func (s *CustomizableSchema) SetRequired() *CustomizableSchema
SetRequired sets the schema to be required.
func (*CustomizableSchema) SetRequiredWith ¶ added in v1.36.0
func (s *CustomizableSchema) SetRequiredWith(value []string) *CustomizableSchema
func (*CustomizableSchema) SetSensitive ¶ added in v1.36.0
func (s *CustomizableSchema) SetSensitive() *CustomizableSchema
func (*CustomizableSchema) SetSliceSet ¶ added in v1.40.0
func (s *CustomizableSchema) SetSliceSet() *CustomizableSchema
func (*CustomizableSchema) SetSuppressDiff ¶ added in v1.36.0
func (s *CustomizableSchema) SetSuppressDiff() *CustomizableSchema
func (*CustomizableSchema) SetSuppressDiffWithDefault ¶ added in v1.40.0
func (s *CustomizableSchema) SetSuppressDiffWithDefault(dv any) *CustomizableSchema
SetSuppressDiffWithDefault suppresses the diff if the new value (ie value from HCL config) is not set and the old value (ie value from state / platform) is equal to the default value.
Often Databricks HTTP APIs will return values for fields that were not set by the author in their terraform configuration. This function allows us to suppress the diff in these cases.
func (*CustomizableSchema) SetValidateDiagFunc ¶ added in v1.36.0
func (s *CustomizableSchema) SetValidateDiagFunc(validate func(interface{}, cty.Path) diag.Diagnostics) *CustomizableSchema
func (*CustomizableSchema) SetValidateFunc ¶ added in v1.36.0
func (s *CustomizableSchema) SetValidateFunc(validate func(interface{}, string) ([]string, []error)) *CustomizableSchema
type DatabricksClient ¶
type DatabricksClient struct {
*client.DatabricksClient
// contains filtered or unexported fields
}
DatabricksClient holds properties needed for authentication and HTTP client setup fields with `name` struct tags become Terraform provider attributes. `env` struct tag can hold one or more coma-separated env variable names to find value, if not specified directly. `auth` struct tag describes the type of conflicting authentication used.
func CommonEnvironmentClient ¶
func CommonEnvironmentClient() *DatabricksClient
func (*DatabricksClient) AccountClient ¶ added in v1.21.0
func (c *DatabricksClient) AccountClient() (*databricks.AccountClient, error)
func (*DatabricksClient) AccountClientWithAccountIdFromConfig ¶ added in v1.35.0
func (c *DatabricksClient) AccountClientWithAccountIdFromConfig(d *schema.ResourceData) (*databricks.AccountClient, error)
func (*DatabricksClient) AccountClientWithAccountIdFromPair ¶ added in v1.35.0
func (c *DatabricksClient) AccountClientWithAccountIdFromPair(d *schema.ResourceData, p *Pair) (*databricks.AccountClient, string, error)
func (*DatabricksClient) AccountOrWorkspaceRequest ¶ added in v1.24.0
func (c *DatabricksClient) AccountOrWorkspaceRequest(accCallback func(*databricks.AccountClient) error, wsCallback func(*databricks.WorkspaceClient) error) error
func (*DatabricksClient) ClientForHost ¶
func (c *DatabricksClient) ClientForHost(ctx context.Context, url string) (*DatabricksClient, error)
ClientForHost creates a new DatabricksClient instance with the same auth parameters, but for the given host. Authentication has to be reinitialized, as Google OIDC has different authorizers, depending if it's workspace or Accounts API we're talking to.
func (*DatabricksClient) CommandExecutor ¶
func (c *DatabricksClient) CommandExecutor(ctx context.Context) CommandExecutor
CommandExecutor service
func (*DatabricksClient) DatabricksClientForUnifiedProvider ¶ added in v1.97.0
func (c *DatabricksClient) DatabricksClientForUnifiedProvider(ctx context.Context, d *schema.ResourceData) (*DatabricksClient, error)
DatabricksClientForUnifiedProvider returns a new Databricks Client for the workspace ID from the resource data This is used by resources and data sources that are developed over SDKv2 and are not using Go SDK.
func (*DatabricksClient) DeleteWithResponse ¶ added in v1.30.0
func (c *DatabricksClient) DeleteWithResponse(ctx context.Context, path string, request any, response any) error
Delete on path. Deserializes the response into the response parameter.
func (*DatabricksClient) FormatURL ¶
func (c *DatabricksClient) FormatURL(strs ...string) string
FormatURL creates URL from the client Host and additional strings
func (*DatabricksClient) GetAccountClient ¶ added in v1.52.0
func (c *DatabricksClient) GetAccountClient() (*databricks.AccountClient, diag.Diagnostics)
GetAccountClient returns the Databricks Account client or a diagnostics if that fails. This is used by resources and data sources that are developed over plugin framework.
func (*DatabricksClient) GetAzureJwtProperty ¶
func (aa *DatabricksClient) GetAzureJwtProperty(key string) (any, error)
func (*DatabricksClient) GetWorkspaceClient ¶ added in v1.52.0
func (c *DatabricksClient) GetWorkspaceClient() (*databricks.WorkspaceClient, diag.Diagnostics)
GetWorkspaceClient returns the Databricks WorkspaceClient or a diagnostics if that fails. This is used by resources and data sources that are developed over plugin framework.
func (*DatabricksClient) GetWorkspaceClientForUnifiedProvider ¶ added in v1.92.0
func (c *DatabricksClient) GetWorkspaceClientForUnifiedProvider( ctx context.Context, workspaceID string, ) (*databricks.WorkspaceClient, error)
GetWorkspaceClientForUnifiedProvider returns the Databricks WorkspaceClient for workspace level resources or diagnostics if that fails for terraform provider, the provider can be configured at account level or workspace level. This implementation will be used by resources and data sources that are developed over SDKv2.
func (*DatabricksClient) GetWorkspaceClientForUnifiedProviderWithDiagnostics ¶ added in v1.95.0
func (c *DatabricksClient) GetWorkspaceClientForUnifiedProviderWithDiagnostics( ctx context.Context, workspaceID string, ) (*databricks.WorkspaceClient, diag.Diagnostics)
GetWorkspaceClientForUnifiedProviderWithDiagnostics returns the Databricks WorkspaceClient for workspace level resources or diagnostics if that fails for terraform provider, the provider can be configured at account level or workspace level. This implementation will be used by resources and data sources that are developed over plugin framework.
func (*DatabricksClient) IsAws ¶
func (c *DatabricksClient) IsAws() bool
acceptance.IsAws returns true if client is configured for AWS
func (*DatabricksClient) IsAzure ¶
func (c *DatabricksClient) IsAzure() bool
IsAzure returns true if client is configured for Azure Databricks - either by using AAD auth or with host+token combination
func (*DatabricksClient) IsGcp ¶
func (c *DatabricksClient) IsGcp() bool
acceptance.IsGcp returns true if client is configured for GCP
func (*DatabricksClient) PatchWithResponse ¶ added in v1.30.0
func (c *DatabricksClient) PatchWithResponse(ctx context.Context, path string, request any, response any) error
Patch on path. Deserializes the response into the response parameter.
func (*DatabricksClient) Scim ¶
func (c *DatabricksClient) Scim(ctx context.Context, method, path string, request any, response any) error
Scim sets SCIM headers
func (*DatabricksClient) SetAccountClient ¶ added in v1.35.0
func (c *DatabricksClient) SetAccountClient(a *databricks.AccountClient)
Set the cached account client.
func (*DatabricksClient) SetWorkspaceClient ¶ added in v1.35.0
func (c *DatabricksClient) SetWorkspaceClient(w *databricks.WorkspaceClient)
Set the cached workspace client.
func (*DatabricksClient) SetWorkspaceClientForWorkspace ¶ added in v1.74.0
func (c *DatabricksClient) SetWorkspaceClientForWorkspace(workspaceId int64, w *databricks.WorkspaceClient)
SetWorkspaceClientForWorkspace sets the cached workspace client for a specific workspace ID.
func (*DatabricksClient) WithCommandExecutor ¶
func (c *DatabricksClient) WithCommandExecutor(cef func(context.Context, *DatabricksClient) CommandExecutor)
WithCommandExecutor sets command executor implementation to use
func (*DatabricksClient) WithCommandMock ¶
func (c *DatabricksClient) WithCommandMock(mock CommandMock)
WithCommandMock mocks all command executions for this client
func (*DatabricksClient) WorkspaceClient ¶ added in v1.10.0
func (c *DatabricksClient) WorkspaceClient() (*databricks.WorkspaceClient, error)
func (*DatabricksClient) WorkspaceClientForWorkspace ¶ added in v1.74.0
func (c *DatabricksClient) WorkspaceClientForWorkspace(ctx context.Context, workspaceId int64) (*databricks.WorkspaceClient, error)
func (*DatabricksClient) WorkspaceClientUnifiedProvider ¶ added in v1.96.0
func (c *DatabricksClient) WorkspaceClientUnifiedProvider(ctx context.Context, d *schema.ResourceData) (*databricks.WorkspaceClient, error)
WorkspaceClientUnifiedProvider returns the WorkspaceClient for the workspace ID from the resource data This is used by resources and data sources that are developed over SDKv2.
type Namespace ¶ added in v1.96.0
type Namespace struct {
ProviderConfig *ProviderConfig `json:"provider_config,omitempty"`
}
Namespace stores the provider configurations for unified terraform provider This should be kept in sync with Namespace for plugin framework resources and data sources defined in internal/providers/pluginfw/tfschema/unified_provider.go and for autogenerated resources.
type Pair ¶
type Pair struct {
// contains filtered or unexported fields
}
Pair defines an ID pair
func NewPairSeparatedID ¶
NewPairSeparatedID creates new ID pair with a custom separator
func (*Pair) BindResource ¶
func (p *Pair) BindResource(pr BindResource) Resource
BindResource creates resource that relies on binding ID pair with simple schema & importer
type ProviderConfig ¶ added in v1.96.0
type ProviderConfig struct {
WorkspaceID string `json:"workspace_id"`
}
ProviderConfig is used to store the provider configurations for unified terraform provider across resources onboarded to SDKv2.
type RecursiveResourceProvider ¶ added in v1.39.0
type RecursiveResourceProvider interface {
ResourceProvider
MaxDepthForTypes() map[string]int
}
Interface for ResourceProvider instances that have recursive references in its schema. The function MaxDepthForTypes allows us to specify the max number of recursive depth for a specific field
Example:
func (JobSettings) MaxDepthForTypes map[string]int {
return map[string]int{"for_each_task": 2}
}
type Resource ¶
type Resource struct {
Create func(ctx context.Context, d *schema.ResourceData, c *DatabricksClient) error
Read func(ctx context.Context, d *schema.ResourceData, c *DatabricksClient) error
Update func(ctx context.Context, d *schema.ResourceData, c *DatabricksClient) error
Delete func(ctx context.Context, d *schema.ResourceData, c *DatabricksClient) error
CustomizeDiff func(ctx context.Context, d *schema.ResourceDiff, c *DatabricksClient) error
StateUpgraders []schema.StateUpgrader
Schema map[string]*schema.Schema
SchemaVersion int
Timeouts *schema.ResourceTimeout
DeprecationMessage string
Importer *schema.ResourceImporter
CanSkipReadAfterCreateAndUpdate func(d *schema.ResourceData) bool
}
Resource aims to simplify things like error & deleted entities handling
func AccountData ¶ added in v1.21.0
func AccountData[T any](read func(context.Context, *T, *databricks.AccountClient) error) Resource
AccountData is a generic way to define account data resources in Terraform provider.
Example usage:
type metastoresData struct {
Ids map[string]string `json:"ids,omitempty" tf:"computed"`
}
return common.AccountData(func(ctx context.Context, d *metastoresData, acc *databricks.AccountClient) error {
metastores, err := acc.Metastores.List(ctx)
...
})
func AccountDataWithParams ¶ added in v1.34.0
func AccountDataWithParams[T, P any](read func(context.Context, P, *databricks.AccountClient) (*T, error)) Resource
AccountDataWithParams defines a data source that can be used to read data from the account API. It differs from AccountData in that it allows extra attributes to be provided as a separate argument, so the original type used to define the resource can also be used to define the data source.
The first type parameter is the type of the resource. This can be a type directly from the SDK, or a custom type defined in the provider that embeds the SDK type.
The second type parameter is the type of the extra attributes that should be provided to the data source. These are the attributes that the user can specify in the data source configuration, but are not part of the resource type. If there are no extra attributes, this should be `struct{}`. If there are any fields with the same JSON name as fields in the resource type, these fields will override the values from the resource type.
The single argument is a function that will be called to read the data from the workspace API, returning the requested resource. The function should return an error if the data cannot be read or the resource cannot be found.
Example usage:
type MwsWorkspace struct { ... }
type MwsWorkspaceDataParams struct {
Id string `json:"id" tf:"computed,optional"`
Name string `json:"name" tf:"computed,optional"`
}
AccountDataWithParams(
func(ctx context.Context, data MwsWorkspaceDataParams, a *databricks.AccountClient) (*MwsWorkspace, error) {
// User-provided attributes are present in the `data` parameter.
// The resource should be populated in the `workspace` parameter.
...
})
func DataResource
deprecated
func NoClientData ¶ added in v1.42.0
NoClientData is a generic way to define data resources in Terraform provider that doesn't require any client. usage is similar to AccountData and WorkspaceData, but the read function doesn't take a client.
func WorkspaceData ¶ added in v1.10.1
func WorkspaceData[T any](read func(context.Context, *T, *databricks.WorkspaceClient) error) Resource
WorkspaceData is a generic way to define workspace data resources in Terraform provider.
Example usage:
type catalogsData struct {
Ids []string `json:"ids,omitempty" tf:"computed,slice_set"`
}
return common.WorkspaceData(func(ctx context.Context, data *catalogsData, w *databricks.WorkspaceClient) error {
catalogs, err := w.Catalogs.ListAll(ctx)
...
})
func WorkspaceDataWithCustomizeFunc ¶ added in v1.49.1
func WorkspaceDataWithCustomizeFunc[T any]( read func(context.Context, *T, *databricks.WorkspaceClient) error, customizeSchemaFunc func(map[string]*schema.Schema) map[string]*schema.Schema) Resource
WorkspaceDataWithCustomizeFunc defines a data source that can be used to read data from the workspace API. It differs from WorkspaceData in that it allows the schema to be customized further using a customizeSchemaFunc function.
The additional argument is a function that will be called to customize the schema of the data source.
func WorkspaceDataWithParams ¶ added in v1.34.0
func WorkspaceDataWithParams[T, P any](read func(context.Context, P, *databricks.WorkspaceClient) (*T, error)) Resource
WorkspaceDataWithParams defines a data source that can be used to read data from the workspace API. It differs from WorkspaceData in that it separates the definition of the computed fields (the resource type) from the definition of the user-supplied parameters.
The first type parameter is the type representing parameters that a user may provide to the data source. These are the attributes that the user can specify in the data source configuration, but are not part of the resource type. If there are no extra attributes, this should be `struct{}`. If there are any fields with the same JSON name as fields in the resource type, these fields will override the values from the resource type.
The second type parameter is the type of the resource. This can be a type directly from the SDK, or a custom type defined in the provider that embeds the SDK type.
The single argument is a function that will be called to read the data from the workspace API, returning the value of the resource type. The function should return an error if the data cannot be read or the resource cannot be found.
Example usage:
type SqlWarehouse struct { ... }
type SqlWarehouseDataParams struct {
Id string `json:"id" tf:"computed,optional"`
Name string `json:"name" tf:"computed,optional"`
}
WorkspaceDataWithParams(
func(ctx context.Context, data SqlWarehouseDataParams, w *databricks.WorkspaceClient) (*SqlWarehouse, error) {
// User-provided attributes are present in the `data` parameter.
// The resource should be returned.
...
})
func (Resource) ToResource ¶
ToResource converts to Terraform resource definition
type ResourceProvider ¶ added in v1.36.3
type ResourceProvider interface {
CustomizeSchema(*CustomizableSchema) *CustomizableSchema
}
Generic interface for ResourceProvider. Using CustomizeSchema function to keep track of additional information on top of the generated go-sdk struct.
type ResourceProviderWithAlias ¶ added in v1.39.0
type ResourceProviderWithAlias interface {
ResourceProvider
// Aliases() returns a two dimensional map where the top level key is the name of the struct, the second level key is the name of the field,
// the values are the alias for the corresponding field under the specified struct.
// Example:
//
// {
// "compute.ClusterSpec": {
// "libraries": "library"
// }
// }
// Note: In case the struct is derived from another struct example:
// type LibraryList compute.InstallLibraries
// The top level key would still be the name of the struct i.e. LibraryList in this example.
Aliases() map[string]map[string]string
}
Interface for ResourceProvider instances that need aliases for fields.
type ResourceProviderWithResourceSpecificCustomization ¶ added in v1.43.0
type ResourceProviderWithResourceSpecificCustomization interface {
ResourceProvider
// Customizations in this function will not be applied when this type is referenced from another resource by resourceProviderRegistry.
// Example use case:
// // autotermination_minutes should only have a default value of 60 for the clusters resource, but not in the nested cluster schema in jobs
// func (ClusterSpec) CustomizeSchemaResourceSpecific(s *common.CustomizableSchema) *common.CustomizableSchema {
// s.SchemaPath("autotermination_minutes").SetDefault(60)
// return s
// }
CustomizeSchemaResourceSpecific(*CustomizableSchema) *CustomizableSchema
}
Interface for ResourcePrivider that needs certain customizaitons that shouldn't be shared.