Documentation
¶
Overview ¶
Package config persists per-customer workspace aliases and favourites to a JSON file on disk. Each customer has a list of Environments where an Environment is an alias (e.g. "DEV", "feature") paired with the Fabric workspace display name that alias resolves to.
Index ¶
- func AddCustomer(path string, name string, customer Customer) error
- func EditCustomer(path string, name string, customer Customer) error
- func GetConfigPath() string
- func RemoveCustomer(path string, name string) error
- func Save(path string, cfg Config) error
- func SetFavorites(path string, name string, favorites []NotebookFavorite) error
- type Config
- type Customer
- func (c Customer) DeployMappings(alias string) ([]DeployMapping, bool)
- func (c Customer) EnvironmentByAlias(alias string) (Environment, bool)
- func (c Customer) FavoriteFor(name string) (NotebookFavorite, bool)
- func (c Customer) FavoriteNames() []string
- func (c Customer) IsIgnored(guid string) bool
- func (c Customer) MappingRepo(m DeployMapping) string
- func (c Customer) OverrideForGUID(guid string) (ReferenceOverride, bool)
- func (c *Customer) UnmarshalJSON(data []byte) error
- func (c Customer) Workspaces(alias string) ([]string, bool)
- type DeployMapping
- type Environment
- type NotebookFavorite
- type ReferenceOverride
- type Substitution
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigPath ¶
func GetConfigPath() string
GetConfigPath returns the platform-appropriate config location.
func RemoveCustomer ¶
func SetFavorites ¶
func SetFavorites(path string, name string, favorites []NotebookFavorite) error
Types ¶
type Customer ¶
type Customer struct {
Environments []Environment `json:"environments"`
Favorites []NotebookFavorite `json:"favorites,omitempty"`
RepoPath string `json:"repo_path,omitempty"`
BaselineEnvironment string `json:"baseline_environment,omitempty"`
ReferenceOverrides []ReferenceOverride `json:"reference_overrides,omitempty"`
IgnoredReferences []string `json:"ignored_references,omitempty"`
Substitutions []Substitution `json:"substitutions,omitempty"`
// ExcludedItemTypes lists item types to skip when comparing/deploying.
// Empty/nil = include every discovered type (the default).
ExcludedItemTypes []string `json:"excluded_item_types,omitempty"`
// DeployHistoryPath is a repo-relative folder where a timestamped HTML
// deploy-report is written after each real deploy. Empty = history off.
DeployHistoryPath string `json:"deploy_history_path,omitempty"`
// PostDeployRuns lists notebook display names offered for execution after
// a successful deploy. Only those actually deployed (created/updated) in a
// run are offered. List order = run order.
PostDeployRuns []string `json:"post_deploy_runs,omitempty"`
// SkipSchedules excludes .schedules definition parts from compare and
// deploy, so schedules configured directly in a target environment (e.g.
// pipelines scheduled in TEST/PROD but not in DEV) survive a deploy.
// Default false = schedules deploy like any other part.
SkipSchedules bool `json:"skip_schedules,omitempty"`
// UseBulkDeploy makes deploys use the bulk-import backend (PREVIEW beta
// API) without asking per run. Default false = the stable per-item
// backend, silently.
UseBulkDeploy bool `json:"use_bulk_deploy,omitempty"`
}
Customer groups one tenant's environments and notebook favourites. A customer with zero Environments is valid — they just can't run notebooks until they add at least one via `futils edit`.
func (Customer) DeployMappings ¶ added in v0.4.0
func (c Customer) DeployMappings(alias string) ([]DeployMapping, bool)
DeployMappings returns the folder→workspace mappings for an alias, plus a bool indicating whether the alias was found. An env with no mappings returns (nil, true).
func (Customer) EnvironmentByAlias ¶ added in v0.4.0
func (c Customer) EnvironmentByAlias(alias string) (Environment, bool)
EnvironmentByAlias returns the environment with the given alias, and whether it was found. Used to resolve the baseline environment's full workspace set.
func (Customer) FavoriteFor ¶
func (c Customer) FavoriteFor(name string) (NotebookFavorite, bool)
FavoriteFor returns the favourite entry for the given notebook name, and a boolean indicating whether it was found.
func (Customer) FavoriteNames ¶
FavoriteNames returns the display names of favourited notebooks in saved order.
func (Customer) IsIgnored ¶ added in v0.4.0
IsIgnored reports whether a baseline reference GUID was marked ignore (left as-is, suppressed from unresolved surfacing).
func (Customer) MappingRepo ¶ added in v0.5.0
func (c Customer) MappingRepo(m DeployMapping) string
MappingRepo resolves which repo a deployment mapping's folder lives in: the mapping's own Repo when set, otherwise the customer's primary RepoPath.
func (Customer) OverrideForGUID ¶ added in v0.4.0
func (c Customer) OverrideForGUID(guid string) (ReferenceOverride, bool)
OverrideForGUID returns the reference override registered for a baseline GUID, and whether one was found.
func (*Customer) UnmarshalJSON ¶
UnmarshalJSON transparently migrates three legacy shapes onto the current `environments: [{alias, workspaces: []}]` form:
- `workspace_pattern` + `environments: [string]` — earliest shape, a pattern with {env} placeholder substituted per env alias.
- `environments: [{alias, workspace_name: string}]` — intermediate shape, single workspace per alias.
- `environments: [{alias, workspaces: []string}]` — current shape.
Detection peeks at the first env entry: a quote means string (#1), otherwise it's an object — and we look for `workspace_name` (#2) vs `workspaces` (#3) inside it. On next Save the file is rewritten in the current shape and legacy fields disappear.
func (Customer) Workspaces ¶
Workspaces returns the workspace display names mapped to an alias, plus a boolean indicating whether the alias was found. Callers that previously expected a single workspace should now iterate the slice — every flow that resolves items by env is expected to aggregate across all of them.
type DeployMapping ¶ added in v0.4.0
type DeployMapping struct {
Folder string `json:"folder"`
Workspace string `json:"workspace"`
// Repo is the repo this folder lives in, when the customer deploys from more
// than one git repo. Empty = the customer's primary RepoPath (the common case).
Repo string `json:"repo,omitempty"`
// BaselineWorkspace isolates this mapping's reference resolution: when set,
// baked GUIDs resolve against ONLY this baseline workspace and references
// resolve into ONLY the mapping's own deploy workspace, instead of the
// customer-level baseline/target environment spans. Empty = inherit the
// baseline environment (the common case).
BaselineWorkspace string `json:"baselineWorkspace,omitempty"`
}
DeployMapping ties a repo subfolder to the workspace its items deploy to, for one environment. Used only by the deploy flow; absent for customers that don't deploy. The folder is repo-relative (e.g. "Backend").
type Environment ¶
type Environment struct {
Alias string `json:"alias"`
Workspaces []string `json:"workspaces"`
Deployments []DeployMapping `json:"deployments,omitempty"`
}
Environment pairs a user-chosen alias (menu label) with one or more Fabric workspaces it resolves to. Multiple workspaces per alias is the common case for real Fabric deployments — e.g. a "DEV" environment often spans both a Config workspace (notebooks) and a SemMod workspace (semantic models). Run / Refresh aggregate items across every workspace under the chosen alias.
func (Environment) AllWorkspaces ¶ added in v0.4.0
func (e Environment) AllWorkspaces() []string
AllWorkspaces returns every workspace this environment spans: the explicit Workspaces (which may include reference-only workspaces such as a Data workspace that is not a deploy target) unioned with every Deployment target, de-duplicated, preserving first-seen order. Used to build the env-wide name index for reference rebinding.
type NotebookFavorite ¶
type NotebookFavorite struct {
Name string `json:"name"`
Parameters []string `json:"parameters,omitempty"`
}
NotebookFavorite pins a single notebook (by displayName) and optionally a subset of its parameters. An empty Parameters slice means "no filter — show all parameters the Papermill cell declares".
type ReferenceOverride ¶ added in v0.4.0
type ReferenceOverride struct {
SourceGUID string `json:"source_guid"`
ItemType string `json:"item_type"`
ItemName string `json:"item_name"`
Note string `json:"note,omitempty"`
}
ReferenceOverride maps a baseline-environment GUID baked in git to a target item resolved by name. Unlike parameter.yml's per-env blocks it is env-agnostic: the same entry resolves correctly for TEST and PROD because ItemName is looked up in whichever target env the deploy targets.
type Substitution ¶ added in v0.4.0
type Substitution struct {
FindValue string `json:"find_value"`
IsRegex bool `json:"is_regex,omitempty"`
ItemType string `json:"item_type,omitempty"`
ItemName string `json:"item_name,omitempty"`
FilePath string `json:"file_path,omitempty"`
TargetType string `json:"target_type,omitempty"`
TargetName string `json:"target_name,omitempty"`
Attr string `json:"attr,omitempty"`
Literal string `json:"literal,omitempty"`
}
Substitution is a futils-native find→replace rule — the config-managed equivalent of a parameter.yml find_replace. The replacement is either a literal (Literal) or the resolved attribute of a target item looked up BY NAME in the target env (TargetType+TargetName+Attr), making it env-agnostic. ItemType/ItemName/FilePath are optional filters (empty = apply everywhere).