project

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package project loads and validates the native UWS/Ramen desired-state project format.

The project package is part of Ramen's supported v0.1 core API.

Index

Constants

View Source
const (
	Version      = "ramen.project.v1"
	ExtensionKey = "x-ramen-desired-state"
	DefaultFile  = "project.uws.yaml"
	DefaultJSON  = "project.uws.json"
	DefaultYAML  = "project.uws.yml"
	WorkflowYAML = "workflows/workflow.uws.yaml"
	WorkflowJSON = "workflows/workflow.uws.json"
	WorkflowYML  = "workflows/workflow.uws.yml"
)
View Source
const InputsVersion = "ramen.inputs.v1"

Variables

This section is empty.

Functions

func ApplyValues

func ApplyValues(profile Profile, values map[string]resolvedValueInternal) (Profile, []ValueDiagnostic)

func AttributeStrings

func AttributeStrings(attrs map[string]any) map[string]string

func ResolvePath

func ResolvePath(path string) (string, error)

func ResolveProfile

func ResolveProfile(profile Profile, projectDir string, opts ValuesOptions) (Profile, ResolvedInputs, []ValueDiagnostic)

func ResolveValues

func ResolveValues(profile Profile, projectDir string, opts ValuesOptions) (map[string]resolvedValueInternal, ResolvedInputs, []ValueDiagnostic)

func ValidateProfile

func ValidateProfile(profile Profile) error

Types

type AIMetadata

type AIMetadata struct {
	Confidence  *Confidence `json:"confidence,omitempty"`
	Uncertainty string      `json:"uncertainty,omitempty"`
	Rationale   string      `json:"rationale,omitempty"`
	Citations   []string    `json:"citations,omitempty"`
}

type APISource

type APISource struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
	Path string `json:"path"`
}

func SourceForRole

func SourceForRole(profile Profile, role OperationRole) APISource

type Confidence

type Confidence struct {
	Score  float64 `json:"score"`
	Reason string  `json:"reason,omitempty"`
}

type Document

type Document struct {
	Path    string
	Dir     string
	UWS     *uws1.Document
	Profile Profile
}

func Load

func Load(path string) (*Document, error)

type IdentityAttribute

type IdentityAttribute struct {
	Name          string   `json:"name"`
	Path          string   `json:"path"`
	RequestKeys   []string `json:"request_keys,omitempty"`
	ResponsePaths []string `json:"response_paths,omitempty"`
	Required      bool     `json:"required,omitempty"`
}

type Lifecycle

type Lifecycle struct {
	PreventDestroy     bool     `json:"prevent_destroy,omitempty"`
	IgnoreAll          bool     `json:"ignore_all,omitempty"`
	IgnorePaths        []string `json:"ignore_paths,omitempty"`
	ReplaceTriggeredBy []string `json:"replace_triggered_by,omitempty"`
}

type MappingLifecycle

type MappingLifecycle struct {
	OperationRoles []string               `json:"operation_roles,omitempty"`
	Paths          []MappingLifecyclePath `json:"paths,omitempty"`
}

type MappingLifecyclePath

type MappingLifecyclePath struct {
	Path            string `json:"path"`
	Immutable       bool   `json:"immutable,omitempty"`
	CreateOnly      bool   `json:"create_only,omitempty"`
	Updateable      bool   `json:"updateable,omitempty"`
	ReplaceOnChange bool   `json:"replace_on_change,omitempty"`
	Computed        bool   `json:"computed,omitempty"`
	Ignored         bool   `json:"ignored,omitempty"`
}

type Normalizer

type Normalizer struct {
	Path string `json:"path"`
	Kind string `json:"kind"`
}

type OperationRole

type OperationRole struct {
	Purpose            string      `json:"purpose,omitempty"`
	Method             string      `json:"method,omitempty"`
	SourceKind         string      `json:"source_kind,omitempty"`
	SourceID           string      `json:"source_id,omitempty"`
	SourcePath         string      `json:"source_path,omitempty"`
	OperationID        string      `json:"operation_id,omitempty"`
	CredentialBindings []string    `json:"credential_bindings,omitempty"`
	AI                 *AIMetadata `json:"ai,omitempty"`
}

type Profile

type Profile struct {
	Version    string         `json:"version"`
	APISources []APISource    `json:"api_sources,omitempty"`
	Variables  []Variable     `json:"variables,omitempty"`
	Resources  []Resource     `json:"resources,omitempty"`
	Redaction  Redaction      `json:"redaction,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
}

func ProfileFromDocument

func ProfileFromDocument(doc *uws1.Document) (Profile, error)

type Redaction

type Redaction struct {
	Paths []string `json:"paths,omitempty"`
}

type RequestBinding

type RequestBinding struct {
	OperationRole string `json:"operation_role"`
	OperationID   string `json:"operation_id,omitempty"`
	Path          string `json:"path"`
	RequestPath   string `json:"request_path"`
	Location      string `json:"location,omitempty"`
	Encoding      string `json:"encoding,omitempty"`
	Required      bool   `json:"required,omitempty"`
	Identity      bool   `json:"identity,omitempty"`
}

type ResolvedInputs

type ResolvedInputs struct {
	Version string          `json:"version"`
	Digest  string          `json:"digest,omitempty"`
	Values  []ResolvedValue `json:"values,omitempty"`
}

type ResolvedValue

type ResolvedValue struct {
	Name      string `json:"name"`
	Type      string `json:"type,omitempty"`
	Source    string `json:"source"`
	Sensitive bool   `json:"sensitive,omitempty"`
	Value     any    `json:"value,omitempty"`
	Digest    string `json:"digest,omitempty"`
}

type Resource

type Resource struct {
	Address            string                   `json:"address"`
	Kind               string                   `json:"kind"`
	Type               string                   `json:"type"`
	Name               string                   `json:"name,omitempty"`
	Provider           string                   `json:"provider,omitempty"`
	Attributes         map[string]any           `json:"attributes,omitempty"`
	Lifecycle          Lifecycle                `json:"lifecycle,omitempty"`
	Dependencies       []string                 `json:"dependencies,omitempty"`
	Operations         map[string]OperationRole `json:"operations,omitempty"`
	IdentityAttributes []IdentityAttribute      `json:"identity_attributes,omitempty"`
	Schema             []SchemaPath             `json:"schema,omitempty"`
	RequestBindings    []RequestBinding         `json:"request_bindings,omitempty"`
	ResponseBindings   []ResponseBinding        `json:"response_bindings,omitempty"`
	Normalizers        []Normalizer             `json:"normalizers,omitempty"`
	MappingLifecycle   *MappingLifecycle        `json:"mapping_lifecycle,omitempty"`
	RequiredOperations []string                 `json:"required_operations,omitempty"`
	CredentialBindings []string                 `json:"credential_bindings,omitempty"`
	RuntimeHints       *RuntimeHints            `json:"runtime_hints,omitempty"`
	Redaction          Redaction                `json:"redaction,omitempty"`
	AI                 *AIMetadata              `json:"ai,omitempty"`
	Metadata           map[string]any           `json:"metadata,omitempty"`
}

type ResponseBinding

type ResponseBinding struct {
	OperationRole           string `json:"operation_role"`
	OperationID             string `json:"operation_id,omitempty"`
	ResponsePath            string `json:"response_path"`
	StatePath               string `json:"state_path"`
	Identity                bool   `json:"identity,omitempty"`
	ResponseDerivedIdentity bool   `json:"response_derived_identity,omitempty"`
	Computed                bool   `json:"computed,omitempty"`
	Observed                bool   `json:"observed,omitempty"`
	Sensitive               bool   `json:"sensitive,omitempty"`
}

type RuntimeHints

type RuntimeHints struct {
	Retry  map[string]any `json:"retry,omitempty"`
	Waiter map[string]any `json:"waiter,omitempty"`
	Settle map[string]any `json:"settle,omitempty"`
}

type SchemaPath

type SchemaPath struct {
	Path                    string   `json:"path"`
	Type                    string   `json:"type,omitempty"`
	EnumValues              []string `json:"enum_values,omitempty"`
	Required                bool     `json:"required,omitempty"`
	Optional                bool     `json:"optional,omitempty"`
	Computed                bool     `json:"computed,omitempty"`
	Sensitive               bool     `json:"sensitive,omitempty"`
	Identity                bool     `json:"identity,omitempty"`
	ResponseDerivedIdentity bool     `json:"response_derived_identity,omitempty"`
	Immutable               bool     `json:"immutable,omitempty"`
	CreateOnly              bool     `json:"create_only,omitempty"`
	Updateable              bool     `json:"updateable,omitempty"`
	ReplaceOnChange         bool     `json:"replace_on_change,omitempty"`
	ReadOnly                bool     `json:"read_only,omitempty"`
	Ignored                 bool     `json:"ignored,omitempty"`
}

type ValueDiagnostic

type ValueDiagnostic struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
	Name     string `json:"name,omitempty"`
	Path     string `json:"path,omitempty"`
}

type ValuesOptions

type ValuesOptions struct {
	VarFiles []string
	Vars     []string
}

type Variable

type Variable struct {
	Name        string `json:"name"`
	Type        string `json:"type,omitempty"`
	Description string `json:"description,omitempty"`
	Default     any    `json:"default,omitempty"`
	Sensitive   bool   `json:"sensitive,omitempty"`
}

Jump to

Keyboard shortcuts

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