manifest

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(resources []Resource) (string, error)

Encode marshals all of the input Resource objects into a single multi-document YAML string.

Types

type Kind

type Kind string
const (
	KindPipeline Kind = "pipeline"
	KindSecret   Kind = "secret"
)

type Object

type Object struct {
	ResourceData map[string]interface{} `yaml:",inline" json:",inline"`

	Kind Kind `yaml:"kind" json:"kind"`
}

Object is used for intermediary marshalling of types that are not currently defined.

Note that the `ResourceData` struct tag uses `,inline`, which ensures undefined fields are persisted when decoding/encoding.

func (*Object) GetKind

func (r *Object) GetKind() Kind

type Pipeline

type Pipeline struct {
	ResourceData map[string]interface{} `yaml:",inline" json:",inline"`

	Kind         Kind              `yaml:"kind" json:"kind"`
	Type         string            `yaml:"type,omitempty" json:"type,omitempty"`
	Name         string            `yaml:"name,omitempty" json:"name,omitempty"`
	NodeSelector map[string]string `yaml:"node_selector,omitempty" json:"node_selector,omitempty"`
	Tolerations  []Toleration      `yaml:"tolerations,omitempty" json:"tolerations,omitempty"`
}

Pipeline represents a Drone `pipeline` object.

Note that the `ResourceData` struct tag uses `,inline`, which ensures undefined fields are persisted when decoding/encoding.

func (*Pipeline) GetKind

func (p *Pipeline) GetKind() Kind

type Resource

type Resource interface {
	GetKind() Kind
}

func Decode

func Decode(data string) ([]Resource, error)

Decode parses all YAML documents in the input string, unmarshals to the appropriate type, and outputs a slice of Resource objects.

type Secret

type Secret struct {
	ResourceData map[string]interface{} `yaml:",inline" json:",inline"`

	Kind Kind   `yaml:"kind" json:"kind"`
	Type string `yaml:"type,omitempty" json:"type,omitempty"`
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
}

Secret represents a Drone `secret` object.

Note that the `ResourceData` struct tag uses `,inline`, which ensures undefined fields are persisted when decoding/encoding.

func (*Secret) GetKind

func (p *Secret) GetKind() Kind

type Toleration

type Toleration struct {
	Key, Operator, Value, Effect string
}

Jump to

Keyboard shortcuts

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