resourceapply

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package resourceapply checks and converges declarative SecondBox resources.

Index

Constants

View Source
const SchemaVersion = "secondbox.resources/v1"

Variables

This section is empty.

Functions

func Encode

func Encode(document Document) ([]byte, error)

Types

type Action

type Action string
const (
	ActionCreate Action = "create"
	ActionUpdate Action = "update"
	ActionAppend Action = "append"
	ActionNoop   Action = "noop"
)

type Document

type Document struct {
	SchemaVersion string       `json:"schemaVersion"`
	RunnerPools   []RunnerPool `json:"runnerPools"`
	Profiles      []Profile    `json:"profiles"`
}

Document is a non-secret desired-state document. Absence never means delete.

func Decode

func Decode(data []byte) (Document, error)

func (Document) Validate

func (document Document) Validate() error

type Profile

type Profile struct {
	Name      string            `json:"name"`
	Revisions []ProfileRevision `json:"revisions"`
}

type ProfileRevision

type ProfileRevision struct {
	Number     int64                               `json:"number"`
	SpecDigest string                              `json:"specDigest"`
	Spec       secondboxclient.ProfileRevisionSpec `json:"spec"`
}

type Report

type Report struct {
	SchemaVersion string   `json:"schemaVersion"`
	Applied       bool     `json:"applied"`
	Results       []Result `json:"results"`
}

func Apply

func Apply(ctx context.Context, client Client, document Document) (Report, error)

func Check

func Check(ctx context.Context, client Client, document Document) (Report, error)

type Result

type Result struct {
	Kind         string `json:"kind"`
	Name         string `json:"name"`
	Action       Action `json:"action"`
	FromRevision int64  `json:"fromRevision,omitempty"`
	ToRevision   int64  `json:"toRevision,omitempty"`
}

type RunnerPool

type RunnerPool struct {
	Name           string                                 `json:"name"`
	Architectures  secondboxclient.RunnerArchitectureList `json:"architectures"`
	Capabilities   secondboxclient.RunnerCapabilityList   `json:"capabilities"`
	CapacityPolicy secondboxclient.RunnerCapacityPolicy   `json:"capacityPolicy"`
	State          secondboxclient.RunnerPoolState        `json:"state"`
	MutableFields  []string                               `json:"mutableFields"`
}

Jump to

Keyboard shortcuts

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