resources

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySecretChanges

func ApplySecretChanges(old map[string]string, changes SecretChanges) (map[string]string, error)

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 CheckEnvironmentNames(config Config, secretNames []string, variables map[string]string, sources map[string]catalog.HTTPHeaderSource, secrets map[string]string) error

func EnvironmentVariableContext added in v1.0.2

func EnvironmentVariableContext(variables map[string]string, sources map[string]catalog.HTTPHeaderSource, secrets map[string]string) error

func HeaderTLS

func HeaderTLS(source catalog.HTTPHeaderSource, secrets map[string]string) (*tls.Config, error)

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 NormalizeNewVariables(values map[string]string) map[string]string

func NormalizeResourceVariables added in v1.0.1

func NormalizeResourceVariables(values map[string]VariableDefinition) map[string]VariableDefinition

func NormalizeVariableWriteJSON added in v1.0.1

func NormalizeVariableWriteJSON(raw []byte) []byte

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 SecretNames(values map[string]string) []string

func TLS

func TLS(c Config, secrets map[string]string) (*tls.Config, error)

func ValidateConfig

func ValidateConfig(kind string, c Config, secrets map[string]string, sourceSecrets ...map[string]string) error

func ValidateVariableDefinitions added in v1.0.1

func ValidateVariableDefinitions(config Config, secrets map[string]string, checkTLS bool) error

func ValidateVariables

func ValidateVariables(values map[string]string, secrets map[string]string) error

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

func VariableError(name string) error

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.
	UnavailableReason string                  `json:"unavailableReason,omitempty"`
	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

func NewRedactor(values map[string]string) *Redactor

func (*Redactor) Mask

func (r *Redactor) Mask(value string) string

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(pool *pgxpool.Pool, vault *Vault) *Repository

func (*Repository) Freeze

func (r *Repository) Freeze(ctx context.Context, environmentID string, needs map[string]string) (Snapshot, error)

func (*Repository) GetEnvironment

func (r *Repository) GetEnvironment(ctx context.Context, id string) (Environment, error)

func (*Repository) GetResource

func (r *Repository) GetResource(ctx context.Context, id string) (Resource, error)

func (*Repository) ListEnvironments

func (r *Repository) ListEnvironments(ctx context.Context, limit int, cursor string) (catalog.Page[Environment], error)

func (*Repository) ListResources

func (r *Repository) ListResources(ctx context.Context, environmentID string, limit int, cursor string) (catalog.Page[Resource], error)

func (*Repository) Resolve

func (r *Repository) Resolve(ctx context.Context, snapshot Snapshot, name string) (Resolved, error)

func (*Repository) ResolveProbe added in v1.0.3

func (r *Repository) ResolveProbe(ctx context.Context, envID, resourceID string) (Resolved, error)

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)

func (*Repository) UploadProto

func (r *Repository) UploadProto(ctx context.Context, id string, revision int64, files map[string]string) (Resource, 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

func (res Resolved) EnvironmentSourceContext() Resolved

Environment sources never inherit a target resource's credentials or locals.

func (Resolved) Expand

func (res Resolved) Expand(value string, secretAllowed bool, escape func(string) string) (string, error)

func (Resolved) Plan added in v1.0.1

func (res Resolved) Plan(block catalog.Block) (catalog.Block, Resolved, error)

func (Resolved) PlanRequest added in v1.0.1

func (res Resolved) PlanRequest(block catalog.Block) (catalog.Block, Resolved, error)

func (Resolved) Prepare

func (res Resolved) Prepare(original catalog.Block) (catalog.Block, Resolved, error)

func (Resolved) PrepareNamedVariableSource added in v1.0.2

func (res Resolved) PrepareNamedVariableSource(name string) (catalog.HTTPHeaderSource, Resolved, error)

func (Resolved) PrepareRequest

func (res Resolved) PrepareRequest(original catalog.Block) (catalog.Block, Resolved, error)

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 (res Resolved) RequiredVariables(block catalog.Block) ([]string, error)

func (Resolved) VariableOwner added in v1.0.2

func (res Resolved) VariableOwner(name string) (scope, version string)

func (Resolved) WithDynamicValues added in v1.0.1

func (res Resolved) WithDynamicValues(values map[string]string) Resolved

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 Snapshot

type Snapshot struct {
	EnvironmentID        string            `json:"environmentId"`
	EnvironmentName      string            `json:"environmentName"`
	EnvironmentVersionID string            `json:"environmentVersionId"`
	ResourceVersions     map[string]string `json:"resourceVersions"`
	Resources            []Resource        `json:"resources"`
}

type TLSConfig

type TLSConfig = catalog.TLSConfig

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"`
}

type Vault

type Vault struct {
	// contains filtered or unexported fields
}

func NewVault

func NewVault(key []byte) (*Vault, error)

func (*Vault) Open

func (v *Vault) Open(id string, data []byte) (map[string]string, error)

func (*Vault) Seal

func (v *Vault) Seal(id string, values map[string]string) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL