project

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ManifestFileName is the canonical project file.
	ManifestFileName = "sling_project.yml"
	// LegacyFileName is the older JSON project file.
	LegacyFileName = ".sling.json"
)

Variables

This section is empty.

Functions

func FindRoot

func FindRoot(start string) (string, error)

FindRoot walks up from start and returns the nearest folder with a manifest.

func FormatPlan

func FormatPlan(p JobPlan) string

FormatPlan prints a job plan as a table plus warnings.

func HasManifest

func HasManifest(dir string) bool

HasManifest reports whether dir has sling_project.yml or .sling.json.

func ResolveLinkProjectID

func ResolveLinkProjectID(tokenID string, listed []LinkProject, pick func([]LinkProject) (string, error)) (string, error)

ResolveLinkProjectID picks the platform project id to attach a folder to. A token-scoped id wins. Otherwise one listed project is used, or pick() when more than one exists.

func SetProjectID

func SetProjectID(folderPath, projectID string) error

SetProjectID writes project_id into sling_project.yml and keeps comments.

Types

type JobPlan

type JobPlan struct {
	Items    []PlanItem
	Warnings []string
}

JobPlan is the diff of manifest jobs vs stamped jobs.

func PlanJobs

func PlanJobs(m Manifest, stamped []StampedJob, opts PlanOptions) JobPlan

PlanJobs diffs manifest jobs against the stamped (source_key) set.

func (JobPlan) HasPushActions

func (p JobPlan) HasPushActions() bool

HasPushActions reports whether the plan creates, updates, renames, or (when prune) deletes.

type JobSpec

type JobSpec struct {
	File      string            `yaml:"file,omitempty" json:"file,omitempty"`
	Schedules []string          `yaml:"schedules,omitempty" json:"schedules,omitempty"`
	Streams   []string          `yaml:"streams,omitempty" json:"streams,omitempty"`
	Mode      string            `yaml:"mode,omitempty" json:"mode,omitempty"`
	Variables map[string]string `yaml:"variables,omitempty" json:"variables,omitempty"`
	Retries   *int              `yaml:"retries,omitempty" json:"retries,omitempty"`
	Timezone  string            `yaml:"timezone,omitempty" json:"timezone,omitempty"`
}

JobSpec is one entry under manifest jobs:. Extra YAML keys are ignored.

func ResolveJob

func ResolveJob(startDir, key string) (root string, spec JobSpec, err error)

ResolveJob finds the project root from startDir and returns the job spec for key. The error lists the available keys when the key misses.

type LinkProject

type LinkProject struct {
	ID   string
	Name string
}

LinkProject is one platform project a token can attach to.

type Manifest

type Manifest struct {
	Name      string             `yaml:"name,omitempty" json:"name,omitempty"`
	ProjectID string             `yaml:"project_id,omitempty" json:"id,omitempty"`
	Paths     []string           `yaml:"paths,omitempty" json:"paths,omitempty"`
	Jobs      map[string]JobSpec `yaml:"jobs,omitempty" json:"jobs,omitempty"`
	Root      string             `yaml:"-" json:"-"`
	Path      string             `yaml:"-" json:"-"`
}

Manifest is a local Sling project file. Unknown YAML/JSON keys are ignored.

func Load

func Load(folderPath string) (Manifest, error)

Load reads sling_project.yml first, then .sling.json.

func Parse

func Parse(body []byte) (Manifest, error)

Parse unmarshals a sling_project.yml body. Extra keys are ignored.

func (Manifest) Linked

func (m Manifest) Linked() bool

Linked reports whether the manifest points at a platform project.

type Options

type Options struct {
	Dir    string
	Name   string
	Source string
	Target string
	Entity string
	Yes    bool
	Force  bool
}

Options controls project scaffolding.

type PlanAction

type PlanAction string

PlanAction is one row in a job deploy plan.

const (
	PlanCreate PlanAction = "create"
	PlanUpdate PlanAction = "update"
	PlanDelete PlanAction = "delete"
	PlanOrphan PlanAction = "orphan"
	PlanRename PlanAction = "rename"
	PlanKeep   PlanAction = "keep"
)

type PlanItem

type PlanItem struct {
	Action    PlanAction
	SourceKey string
	OldKey    string
	Spec      JobSpec
	Warning   string
}

PlanItem is one planned change.

type PlanOptions

type PlanOptions struct {
	Renames map[string]string
	Prune   bool
}

PlanOptions controls rename mapping and prune.

type Result

type Result struct {
	Dir   string
	Name  string
	Files []string
}

Result lists files written by Init.

func Init

func Init(opts Options) (*Result, error)

Init writes a canonical Sling project into dir.

type StampedJob

type StampedJob struct {
	SourceKey string
	Name      string
	File      string
	Schedules []string
	Streams   []string
	Mode      string
	Variables map[string]string
	Retries   *int
	Timezone  string
}

StampedJob is a platform job keyed by source_key.

Jump to

Keyboard shortcuts

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