Documentation
¶
Index ¶
- func ApplySecretChanges(old map[string]string, changes SecretChanges) (map[string]string, error)
- func CheckEnvironmentNames(config Config, secretNames []string, variables map[string]string, ...) error
- func EnvironmentVariableContext(variables map[string]string, sources map[string]catalog.HTTPHeaderSource, ...) error
- func HeaderTLS(source catalog.HTTPHeaderSource, secrets map[string]string) (*tls.Config, error)
- func NormalizeConfig(config *Config)
- func NormalizeHTTPVariables(values map[string]catalog.HTTPHeaderSource) map[string]catalog.HTTPHeaderSource
- func NormalizeNewVariables(values map[string]string) map[string]string
- func NormalizeResourceVariables(values map[string]VariableDefinition) map[string]VariableDefinition
- func NormalizeVariableWriteJSON(raw []byte) []byte
- func ProbeSource(res Resolved, source catalog.HTTPHeaderSource) (catalog.HTTPHeaderSource, error)
- func SecretNames(values map[string]string) []string
- func TLS(c Config, secrets map[string]string) (*tls.Config, error)
- func ValidateConfig(kind string, c Config, secrets map[string]string, ...) error
- func ValidateVariableDefinitions(config Config, secrets map[string]string, checkTLS bool) error
- func ValidateVariables(values map[string]string, secrets map[string]string) error
- func VariableContext(config Config, variables, secrets map[string]string, ...) error
- func VariableError(name string) error
- type Config
- type Environment
- type HTTPVariables
- type Redactor
- type Repository
- func (r *Repository) Freeze(ctx context.Context, environmentID string, needs map[string]string) (Snapshot, error)
- func (r *Repository) GetEnvironment(ctx context.Context, id string) (Environment, error)
- func (r *Repository) GetResource(ctx context.Context, id string) (Resource, error)
- func (r *Repository) ListEnvironments(ctx context.Context, limit int, cursor string) (catalog.Page[Environment], error)
- func (r *Repository) ListResources(ctx context.Context, environmentID string, limit int, cursor string) (catalog.Page[Resource], error)
- func (r *Repository) Resolve(ctx context.Context, snapshot Snapshot, name string) (Resolved, error)
- func (r *Repository) ResolveProbe(ctx context.Context, envID, resourceID string) (Resolved, error)
- func (r *Repository) SaveEnvironment(ctx context.Context, id, value string, revision int64, ...) (Environment, error)
- func (r *Repository) SaveEnvironmentMetadata(ctx context.Context, id, name, description string, revision int64) (Environment, error)
- func (r *Repository) SaveResource(ctx context.Context, id, environmentID, name, kind string, revision int64, ...) (Resource, error)
- func (r *Repository) SaveVariables(ctx context.Context, id string, revision int64, variables map[string]string, ...) (Environment, error)
- func (r *Repository) UploadProto(ctx context.Context, id string, revision int64, files map[string]string) (Resource, error)
- type Resolved
- func (res Resolved) DynamicVariable(name string) (VariableDefinition, bool)
- func (res Resolved) EnvironmentSourceContext() Resolved
- func (res Resolved) Expand(value string, secretAllowed bool, escape func(string) string) (string, error)
- func (res Resolved) Plan(block catalog.Block) (catalog.Block, Resolved, error)
- func (res Resolved) PlanRequest(block catalog.Block) (catalog.Block, Resolved, error)
- func (res Resolved) Prepare(original catalog.Block) (catalog.Block, Resolved, error)
- func (res Resolved) PrepareNamedVariableSource(name string) (catalog.HTTPHeaderSource, Resolved, error)
- func (res Resolved) PrepareRequest(original catalog.Block) (catalog.Block, Resolved, error)
- func (res Resolved) PrepareVariableSource(source catalog.HTTPHeaderSource) (catalog.HTTPHeaderSource, error)
- func (res Resolved) RequiredVariables(block catalog.Block) ([]string, error)
- func (res Resolved) VariableOwner(name string) (scope, version string)
- func (res Resolved) WithDynamicValues(values map[string]string) Resolved
- type Resource
- type SecretChanges
- type Snapshot
- type TLSConfig
- type VariableDefinition
- type Vault
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySecretChanges ¶
ApplySecretChanges keeps absent fields, supports explicit clear, and never mutates the map retained by an older version.
func CheckEnvironmentNames ¶ added in v1.0.2
func EnvironmentVariableContext ¶ added in v1.0.2
func NormalizeConfig ¶
func NormalizeConfig(config *Config)
func NormalizeHTTPVariables ¶ added in v1.0.2
func NormalizeHTTPVariables(values map[string]catalog.HTTPHeaderSource) map[string]catalog.HTTPHeaderSource
func NormalizeNewVariables ¶ added in v1.0.1
func NormalizeResourceVariables ¶ added in v1.0.1
func NormalizeResourceVariables(values map[string]VariableDefinition) map[string]VariableDefinition
func NormalizeVariableWriteJSON ¶ added in v1.0.1
NormalizeVariableWriteJSON removes unnamed new rows before wire validation. RawMessage keeps authored JSON strings and exact numeric tokens intact.
func ProbeSource ¶ added in v1.0.3
func ProbeSource(res Resolved, source catalog.HTTPHeaderSource) (catalog.HTTPHeaderSource, error)
ProbeSource restricts validation to the selected source and the static values it needs. Unrelated unfinished HTTP definitions in a draft are not executed.
func SecretNames ¶
func ValidateConfig ¶
func ValidateVariableDefinitions ¶ added in v1.0.1
func ValidateVariables ¶
func VariableContext ¶ added in v1.0.1
func VariableContext(config Config, variables, secrets map[string]string, sources ...map[string]catalog.HTTPHeaderSource) error
VariableContext checks only configuration. It never fetches an HTTP value.
func VariableError ¶ added in v1.0.1
Types ¶
type Config ¶
type Config struct {
Variables map[string]VariableDefinition `json:"variables,omitempty"`
// UnavailableReason is set only by bootstrap for a version of built-in SQL.
BaseURL string `json:"baseUrl,omitempty"`
Address string `json:"address,omitempty"`
Database string `json:"database,omitempty"`
Username string `json:"username,omitempty"`
Headers []catalog.RequestHeader `json:"headers"`
TLS TLSConfig `json:"tls"`
ProtoFiles map[string]string `json:"protoFiles,omitempty"`
}
type Environment ¶
type Environment struct {
Description string `json:"description"`
ReadOnly bool `json:"readOnly"`
ID string `json:"id"`
Name string `json:"name"`
Revision int64 `json:"revision"`
Variables map[string]string `json:"variables"`
HTTPVariables map[string]catalog.HTTPHeaderSource `json:"httpVariables,omitempty"`
SecretNames []string `json:"secretNames"`
}
type HTTPVariables ¶ added in v1.0.2
type HTTPVariables map[string]catalog.HTTPHeaderSource
HTTPVariables distinguishes an omitted update (nil) from an explicit empty set. A null update is never an implicit delete.
func (*HTTPVariables) UnmarshalJSON ¶ added in v1.0.2
func (v *HTTPVariables) UnmarshalJSON(raw []byte) error
type Redactor ¶
type Redactor struct {
// contains filtered or unexported fields
}
Redactor replaces only known plaintext secrets; it never persists a raw response to discover them later. Longer matches take precedence.
func NewRedactor ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(pool *pgxpool.Pool, vault *Vault) *Repository
func (*Repository) GetEnvironment ¶
func (r *Repository) GetEnvironment(ctx context.Context, id string) (Environment, error)
func (*Repository) GetResource ¶
func (*Repository) ListEnvironments ¶
func (r *Repository) ListEnvironments(ctx context.Context, limit int, cursor string) (catalog.Page[Environment], error)
func (*Repository) ListResources ¶
func (*Repository) ResolveProbe ¶ added in v1.0.3
ResolveProbe reads a consistent current owner context, including keep secrets, without requiring a valid target connection or performing network requests.
func (*Repository) SaveEnvironment ¶
func (r *Repository) SaveEnvironment(ctx context.Context, id, value string, revision int64, variables map[string]string, changes SecretChanges) (Environment, error)
func (*Repository) SaveEnvironmentMetadata ¶
func (r *Repository) SaveEnvironmentMetadata(ctx context.Context, id, name, description string, revision int64) (Environment, error)
func (*Repository) SaveResource ¶
func (r *Repository) SaveResource(ctx context.Context, id, environmentID, name, kind string, revision int64, config Config, changes SecretChanges) (Resource, error)
func (*Repository) SaveVariables ¶
func (r *Repository) SaveVariables(ctx context.Context, id string, revision int64, variables map[string]string, changes SecretChanges, sources ...map[string]catalog.HTTPHeaderSource) (Environment, error)
type Resolved ¶
type Resolved struct {
EnvironmentName string
EnvironmentRevision int64
EnvironmentID string
EnvironmentVersionID string
EnvironmentHTTPVariables map[string]catalog.HTTPHeaderSource
EnvironmentVariables map[string]string
EnvironmentSecrets map[string]string
Prepared bool
Deferred bool
DynamicValues map[string]string
Resource Resource
Variables map[string]string
Secrets map[string]string
// contains filtered or unexported fields
}
func (Resolved) DynamicVariable ¶ added in v1.0.1
func (res Resolved) DynamicVariable(name string) (VariableDefinition, bool)
func (Resolved) EnvironmentSourceContext ¶ added in v1.0.2
Environment sources never inherit a target resource's credentials or locals.
func (Resolved) PlanRequest ¶ added in v1.0.1
func (Resolved) PrepareNamedVariableSource ¶ added in v1.0.2
func (Resolved) PrepareRequest ¶
func (Resolved) PrepareVariableSource ¶ added in v1.0.1
func (res Resolved) PrepareVariableSource(source catalog.HTTPHeaderSource) (catalog.HTTPHeaderSource, error)
PrepareVariableSource reuses the independent HTTP/TLS source contract, with dynamic-to-dynamic dependencies explicitly prohibited before any request.
func (Resolved) RequiredVariables ¶ added in v1.0.1
func (Resolved) VariableOwner ¶ added in v1.0.2
type Resource ¶
type Resource struct {
ReadOnly bool `json:"readOnly"`
ID string `json:"id"`
EnvironmentID string `json:"environmentId"`
Name string `json:"name"`
Kind string `json:"kind"`
VersionID string `json:"versionId"`
Revision int64 `json:"revision"`
Config Config `json:"config"`
SecretNames []string `json:"secretNames"`
UpdatedAt time.Time `json:"updatedAt"`
}
Resource is the public representation. Secret values are never returned.
type SecretChanges ¶
type SecretChanges struct {
Replace map[string]string `json:"replace"`
Clear []string `json:"clear"`
}
SecretChanges distinguishes replacing a secret, including with an empty value, from retaining or explicitly clearing a previously stored secret.
type VariableDefinition ¶ added in v1.0.1
type VariableDefinition struct {
Mode string `json:"mode"`
Value string `json:"value,omitempty"`
Source *catalog.HTTPHeaderSource `json:"source,omitempty"`
}