Documentation
¶
Index ¶
- Constants
- type AnomalyDetectorApplyResult
- type Applier
- func (a *Applier) Apply(fileData []byte, opts ApplyOptions) ([]ApplyResult, error)
- func (a *Applier) WithHookOutputs(stdout, stderr io.Writer) *Applier
- func (a *Applier) WithPostApplyHook(command string) *Applier
- func (a *Applier) WithPreApplyHook(command string) *Applier
- func (a *Applier) WithSafetyChecker(checker *safety.Checker) *Applier
- func (a *Applier) WithSourceFile(filename string) *Applier
- func (a *Applier) WithStderr(w io.Writer) *Applier
- func (a *Applier) WithVFS(env vfs.Env) *Applier
- type ApplyOptions
- type ApplyResult
- type ApplyResultBase
- type BucketApplyResult
- type ConnectionApplyResult
- type DashboardApplyResult
- type DocumentApplyResult
- type DryRunResult
- type ExtensionConfigApplyResult
- type HookRejectedError
- type ListApplyError
- type MonitoringConfigApplyResult
- type NotebookApplyResult
- type ResourceType
- type SLOApplyResult
- type SchedulingRuleApplyResult
- type SegmentApplyResult
- type SettingsApplyResult
- type WorkflowApplyResult
Constants ¶
const ( ActionCreated = "created" ActionUpdated = "updated" ActionUnchanged = "unchanged" )
Action constants
const StdinSourceFile = "<stdin>"
StdinSourceFile is the source-file name for input read from `apply -f -`. It appears in output and as the hooks' source-file argument, and is never a path: write-back and the write-back hint skip it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnomalyDetectorApplyResult ¶
type AnomalyDetectorApplyResult struct {
ApplyResultBase `yaml:",inline"`
}
AnomalyDetectorApplyResult is the result of applying a custom anomaly detector.
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
Applier handles resource apply operations
func (*Applier) Apply ¶
func (a *Applier) Apply(fileData []byte, opts ApplyOptions) ([]ApplyResult, error)
Apply applies a resource configuration from file. Returns a slice of results (most resource types return a single-element slice; connection resources may return multiple results when applying a list).
func (*Applier) WithHookOutputs ¶
WithHookOutputs overrides where hook stdout and stderr are forwarded. Pass nil to keep the default (os.Stdout / os.Stderr).
In agent mode, callers should route both to os.Stderr so that hook output does not corrupt the JSON envelope written to os.Stdout by the printer.
func (*Applier) WithPostApplyHook ¶
WithPostApplyHook sets the post-apply hook command. Invocation is identical to the pre-apply hook (direct exec, resource type and source file appended as args). Stdin is the apply result JSON. The hook runs after a successful apply; a non-zero exit is treated as a warning (the resource is already persisted), not an error.
func (*Applier) WithPreApplyHook ¶
WithPreApplyHook sets the pre-apply hook command. The command is parsed with POSIX-style shell quoting and executed directly (no `sh -c`); the resource type and source file are appended as the final two arguments. The processed JSON is piped on stdin.
func (*Applier) WithSafetyChecker ¶
WithSafetyChecker sets the safety checker for the applier
func (*Applier) WithSourceFile ¶
WithSourceFile sets the original filename (passed to hook as context). This is the file path from "dtctl apply -f <file>" — informational only.
func (*Applier) WithStderr ¶
WithStderr sets where the applier writes its notes, diffs and setup instructions. nil keeps os.Stderr.
type ApplyOptions ¶
type ApplyOptions struct {
TemplateVars map[string]interface{}
DryRun bool
Force bool
ShowDiff bool
NoHooks bool // skip pre-apply hooks
OverrideID string // override or inject resource ID (from --id flag)
WriteID bool // write created resource ID back into the source file (from --write-id flag)
Type string // document type override (from --type flag); forces generic document handling
RequireExisting bool // fail instead of creating when a document ID is missing (update semantics)
Labels []string // document labels (from --label flags); when non-empty, overrides labels in the payload
// CreateSnapshot snapshots a document's current state before overwriting it
// (from --create-snapshot). Documents only, and only on the update path:
// there is nothing to snapshot when the document is being created.
CreateSnapshot bool
// SnapshotDescription describes the snapshot created by CreateSnapshot
// (from --snapshot-description); ignored without CreateSnapshot.
SnapshotDescription string
}
ApplyOptions holds options for apply operation
type ApplyResult ¶
type ApplyResult interface {
// contains filtered or unexported methods
}
ApplyResult is the interface implemented by all apply result types. Each resource type has its own concrete struct embedding ApplyResultBase.
type ApplyResultBase ¶
type ApplyResultBase struct {
Action string `json:"action" yaml:"action" table:"ACTION"`
ResourceType string `json:"resourceType" yaml:"resourceType" table:"TYPE"`
ID string `json:"id" yaml:"id" table:"ID"`
Name string `json:"name,omitempty" yaml:"name,omitempty" table:"NAME"`
Warnings []string `json:"warnings,omitempty" yaml:"warnings,omitempty" table:"-"`
}
ApplyResultBase contains fields common to all apply results. Embed this in every per-resource result type.
type BucketApplyResult ¶
type BucketApplyResult struct {
ApplyResultBase `yaml:",inline"`
Status string `json:"status,omitempty" yaml:"status,omitempty" table:"STATUS"`
}
BucketApplyResult is the result of applying a bucket resource.
type ConnectionApplyResult ¶
type ConnectionApplyResult struct {
ApplyResultBase `yaml:",inline"`
SchemaID string `json:"schemaId,omitempty" yaml:"schemaId,omitempty" table:"SCHEMA"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty" table:"SCOPE"`
}
ConnectionApplyResult is the result of applying a cloud connection (Azure or GCP).
type DashboardApplyResult ¶
type DashboardApplyResult struct {
ApplyResultBase `yaml:",inline"`
URL string `json:"url,omitempty" yaml:"url,omitempty" table:"URL,wide"`
TileCount int `json:"tileCount,omitempty" yaml:"tileCount,omitempty" table:"TILES"`
}
DashboardApplyResult is the result of applying a dashboard resource.
type DocumentApplyResult ¶
type DocumentApplyResult struct {
ApplyResultBase `yaml:",inline"`
URL string `json:"url,omitempty" yaml:"url,omitempty" table:"URL,wide"`
Labels []string `json:"labels,omitempty" yaml:"labels,omitempty" table:"-"`
}
DocumentApplyResult is the result of applying a document of a custom type (any type other than dashboard or notebook, e.g. "launchpad" or "acme:config").
type DryRunResult ¶
type DryRunResult struct {
ApplyResultBase `yaml:",inline"`
URL string `json:"url,omitempty" yaml:"url,omitempty" table:"URL,wide"`
ItemCount int `json:"itemCount,omitempty" yaml:"itemCount,omitempty" table:"ITEMS"`
ItemType string `json:"itemType,omitempty" yaml:"itemType,omitempty" table:"-"`
ExistingName string `json:"existingName,omitempty" yaml:"existingName,omitempty" table:"-"`
ExtensionName string `json:"extensionName,omitempty" yaml:"extensionName,omitempty" table:"EXTENSION"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty" table:"SCOPE"`
ValidationWarns []string `json:"validationWarnings,omitempty" yaml:"validationWarnings,omitempty" table:"-"`
}
DryRunResult is the result of a dry-run apply operation. It reports what would happen without actually modifying anything.
type ExtensionConfigApplyResult ¶
type ExtensionConfigApplyResult struct {
ApplyResultBase `yaml:",inline"`
ExtensionName string `json:"extensionName,omitempty" yaml:"extensionName,omitempty" table:"EXTENSION"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty" table:"SCOPE"`
}
ExtensionConfigApplyResult is the result of applying an extension monitoring configuration.
type HookRejectedError ¶
HookRejectedError is returned when a pre-apply hook exits with a non-zero exit code, indicating the resource was rejected by the hook.
func (*HookRejectedError) Error ¶
func (e *HookRejectedError) Error() string
type ListApplyError ¶
ListApplyError is returned when some items in a batch apply fail. It includes results for successful items alongside the error details.
func (*ListApplyError) Error ¶
func (e *ListApplyError) Error() string
type MonitoringConfigApplyResult ¶
type MonitoringConfigApplyResult struct {
ApplyResultBase `yaml:",inline"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty" table:"SCOPE"`
}
MonitoringConfigApplyResult is the result of applying a monitoring config (Azure or GCP).
type NotebookApplyResult ¶
type NotebookApplyResult struct {
ApplyResultBase `yaml:",inline"`
URL string `json:"url,omitempty" yaml:"url,omitempty" table:"URL,wide"`
SectionCount int `json:"sectionCount,omitempty" yaml:"sectionCount,omitempty" table:"SECTIONS"`
}
NotebookApplyResult is the result of applying a notebook resource.
type ResourceType ¶
type ResourceType string
ResourceType represents the type of resource
const ( ResourceWorkflow ResourceType = "workflow" ResourceSchedulingRule ResourceType = "scheduling-rule" ResourceDashboard ResourceType = "dashboard" ResourceNotebook ResourceType = "notebook" ResourceSLO ResourceType = "slo" ResourceBucket ResourceType = "bucket" ResourceSettings ResourceType = "settings" ResourceAWSMonitoringConfig ResourceType = "aws_monitoring_config" ResourceAzureConnection ResourceType = "azure_connection" ResourceAzureMonitoringConfig ResourceType = "azure_monitoring_config" ResourceGCPConnection ResourceType = "gcp_connection" ResourceGCPMonitoringConfig ResourceType = "gcp_monitoring_config" ResourceExtensionConfig ResourceType = "extension_config" ResourceSegment ResourceType = "segment" ResourceAnomalyDetector ResourceType = "anomaly_detector" ResourceDocument ResourceType = "document" ResourceUnknown ResourceType = "unknown" )
type SLOApplyResult ¶
type SLOApplyResult struct {
ApplyResultBase `yaml:",inline"`
}
SLOApplyResult is the result of applying an SLO resource.
type SchedulingRuleApplyResult ¶
type SchedulingRuleApplyResult struct {
ApplyResultBase `yaml:",inline"`
}
SchedulingRuleApplyResult is the result of applying a scheduling rule resource.
type SegmentApplyResult ¶
type SegmentApplyResult struct {
ApplyResultBase `yaml:",inline"`
}
SegmentApplyResult is the result of applying a filter segment.
type SettingsApplyResult ¶
type SettingsApplyResult struct {
ApplyResultBase `yaml:",inline"`
SchemaID string `json:"schemaId,omitempty" yaml:"schemaId,omitempty" table:"SCHEMA"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty" table:"SCOPE"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty" table:"-"`
}
SettingsApplyResult is the result of applying a settings object.
type WorkflowApplyResult ¶
type WorkflowApplyResult struct {
ApplyResultBase `yaml:",inline"`
}
WorkflowApplyResult is the result of applying a workflow resource.