Documentation
¶
Overview ¶
Package inventory reads a Databricks workspace into a typed, read-only model and classifies every object by who should own it in Terraform.
Index ¶
- Variables
- func SelectResources(names []string, shared bool) ([]string, error)
- func ValidateName(resources []string, name *string) error
- type Catalog
- type ClusterPolicy
- type ExternalLocation
- type Grant
- type Identity
- type InstancePool
- type Inventory
- type Issue
- type Ownership
- type Permission
- type Reader
- type Schema
- type SecretScope
- type ServicePrincipal
- type Skipped
- type StorageCredential
- type Warehouse
Constants ¶
This section is empty.
Variables ¶
var ResourceNames = []string{
"catalogs", "storage_credentials", "external_locations", "cluster_policies",
"instance_pools", "warehouses", "secret_scopes", "service_principals",
}
ResourceNames lists the resource groups accepted by the reader.
Functions ¶
func SelectResources ¶
SelectResources validates a selection and returns it in canonical order. Nil selects every available group. Shared scope includes only UC groups.
func ValidateName ¶
ValidateName requires one group and a non-empty name for object selection. Nil selects every visible object in the selected groups.
Types ¶
type Catalog ¶
type Catalog struct {
Info catalog.CatalogInfo `json:"info"`
Ownership Ownership `json:"ownership"`
WorkspaceIDs []int64 `json:"workspace_ids,omitempty"`
WorkspaceBindings []catalog.WorkspaceBinding `json:"workspace_bindings,omitempty"`
GrantsRead bool `json:"grants_read"`
Grants []Grant `json:"grants"`
Schemas []Schema `json:"schemas"`
}
Catalog is a managed catalog with its direct grants.
type ClusterPolicy ¶
type ClusterPolicy struct {
Info compute.Policy `json:"info"`
Permissions []Permission `json:"permissions"`
}
ClusterPolicy is a non-default cluster policy with its direct permissions.
type ExternalLocation ¶
type ExternalLocation struct {
Info catalog.ExternalLocationInfo `json:"info"`
Ownership Ownership `json:"ownership"`
WorkspaceIDs []int64 `json:"workspace_ids,omitempty"`
WorkspaceBindings []catalog.WorkspaceBinding `json:"workspace_bindings,omitempty"`
GrantsRead bool `json:"grants_read"`
Grants []Grant `json:"grants"`
}
ExternalLocation is a UC external location with its direct grants.
type Identity ¶
type Identity struct {
Host string `json:"host"`
UserName string `json:"user_name"`
AuthType string `json:"auth_type"`
WorkspaceID int64 `json:"workspace_id,omitempty"`
MetastoreID string `json:"metastore_id,omitempty"`
}
Identity is who the client authenticates as and where.
type InstancePool ¶
type InstancePool struct {
Info compute.GetInstancePool `json:"info"`
Permissions []Permission `json:"permissions"`
}
InstancePool is an instance pool with its direct permissions.
type Inventory ¶
type Inventory struct {
Host string `json:"host"`
WorkspaceID int64 `json:"workspace_id"`
MetastoreID string `json:"metastore_id,omitempty"`
UserName string `json:"user_name"`
Resources []string `json:"resources"`
Name *string `json:"name,omitempty"`
Catalogs []Catalog `json:"catalogs"`
StorageCredentials []StorageCredential `json:"storage_credentials"`
ExternalLocations []ExternalLocation `json:"external_locations"`
ClusterPolicies []ClusterPolicy `json:"cluster_policies"`
InstancePools []InstancePool `json:"instance_pools"`
Warehouses []Warehouse `json:"warehouses"`
SecretScopes []SecretScope `json:"secret_scopes"`
ServicePrincipals []ServicePrincipal `json:"service_principals"`
Issues []Issue `json:"issues"`
Skipped []Skipped `json:"skipped"`
}
Inventory contains the selected resource groups read from one workspace.
type Issue ¶
type Issue struct {
Area string `json:"area"`
ObjectName string `json:"object_name"`
Operation string `json:"operation"`
Message string `json:"message"`
diagnostic.Details
}
Issue is a read or build failure. Any issue makes the export partial.
type Ownership ¶
type Ownership string
Ownership says which Terraform root should manage a Unity Catalog securable.
const ( // OwnedByWorkspace: ISOLATED and bound to exactly this workspace. OwnedByWorkspace Ownership = "workspace" OwnedShared Ownership = "shared" // OwnedBySystem: Databricks-managed; never exported. OwnedBySystem Ownership = "system" // OwnedUnknown: ownership could not be verified; never exported. OwnedUnknown Ownership = "unknown" )
type Permission ¶
type Permission struct {
PermissionLevel string `json:"permission_level"`
GroupName string `json:"group_name,omitempty"`
UserName string `json:"user_name,omitempty"`
ServicePrincipalName string `json:"service_principal_name,omitempty"`
}
Permission is one direct (non-inherited) workspace object permission.
type Reader ¶
type Reader struct {
Parallelism int
// Resources limits reads to the selected resource groups. Nil selects all groups.
Resources []string
// Name selects one exact name (service principal key) in one resource group.
Name *string
// Log receives progress lines. Nil disables progress.
Log func(format string, args ...any)
// contains filtered or unexported fields
}
Reader reads one workspace. It never writes to Databricks and never reads secret values.
func New ¶
func New(ws *databricks.WorkspaceClient) *Reader
New returns a Reader that fans each resource group out to 8 concurrent reads. Groups run concurrently; the SDK rate limit paces the total request rate.
type Schema ¶
type Schema struct {
Info catalog.SchemaInfo `json:"info"`
GrantsRead bool `json:"grants_read"`
Grants []Grant `json:"grants"`
}
Schema is a user schema with its direct grants.
type SecretScope ¶
type SecretScope struct {
Info workspace.SecretScope `json:"info"`
ACLsRead bool `json:"acls_read"`
ACLs []workspace.AclItem `json:"acls"`
}
SecretScope is a secret scope with its ACLs. Secret values are never read.
type ServicePrincipal ¶
type ServicePrincipal struct {
Info iam.ServicePrincipal `json:"info"`
DisplayName string `json:"display_name"`
Key string `json:"key"`
Entitlements []string `json:"entitlements"`
}
ServicePrincipal is a workspace-level service principal.
type Skipped ¶
type Skipped struct {
Area string `json:"area"`
ObjectName string `json:"object_name"`
Reason string `json:"reason"`
}
Skipped records an object that was seen and deliberately left out.
type StorageCredential ¶
type StorageCredential struct {
Info catalog.StorageCredentialInfo `json:"info"`
Ownership Ownership `json:"ownership"`
WorkspaceIDs []int64 `json:"workspace_ids,omitempty"`
WorkspaceBindings []catalog.WorkspaceBinding `json:"workspace_bindings,omitempty"`
GrantsRead bool `json:"grants_read"`
Grants []Grant `json:"grants"`
}
StorageCredential is a UC storage credential with its direct grants.
type Warehouse ¶
type Warehouse struct {
Info sql.GetWarehouseResponse `json:"info"`
Permissions []Permission `json:"permissions"`
}
Warehouse is a SQL warehouse with its direct permissions.