bundle

package
v0.7.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValuesOrDefaults

func ValuesOrDefaults(vals map[string]interface{}, b *Bundle) (map[string]interface{}, error)

ValuesOrDefaults returns parameter values or the default parameter values. An error is returned when the parameter value does not pass the schema validation or a required parameter is missing.

Types

type Action

type Action struct {
	// Modifies indicates whether this action modifies the release.
	//
	// If it is possible that an action modify a release, this must be set to true.
	Modifies bool `json:"modifies,omitempty" yaml:"modifies,omitempty"`
	// Stateless indicates that the action is purely informational, that credentials are not required, and that the runtime should not keep track of its invocation
	Stateless bool `json:"stateless,omitempty" yaml:"stateless,omitempty"`
	// Description describes the action as a user-readable string
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

Action describes a custom (non-core) action.

type BaseImage

type BaseImage struct {
	ImageType string            `json:"imageType" yaml:"imageType"`
	Image     string            `json:"image" yaml:"image"`
	Digest    string            `json:"contentDigest,omitempty" yaml:"contentDigest,omitempty"`
	Size      uint64            `json:"size,omitempty" yaml:"size,omitempty"`
	Labels    map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	MediaType string            `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
}

BaseImage contains fields shared across image types

func (*BaseImage) DeepCopy

func (i *BaseImage) DeepCopy() *BaseImage

type Bundle

type Bundle struct {
	SchemaVersion      string                 `json:"schemaVersion" yaml:"schemaVersion"`
	Name               string                 `json:"name" yaml:"name"`
	Version            string                 `json:"version" yaml:"version"`
	Description        string                 `json:"description" yaml:"description"`
	Keywords           []string               `json:"keywords,omitempty" yaml:"keywords,omitempty"`
	Maintainers        []Maintainer           `json:"maintainers,omitempty" yaml:"maintainers,omitempty"`
	InvocationImages   []InvocationImage      `json:"invocationImages" yaml:"invocationImages"`
	Images             map[string]Image       `json:"images,omitempty" yaml:"images,omitempty"`
	Actions            map[string]Action      `json:"actions,omitempty" yaml:"actions,omitempty"`
	Parameters         map[string]Parameter   `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Credentials        map[string]Credential  `json:"credentials,omitempty" yaml:"credentials,omitempty"`
	Outputs            map[string]Output      `json:"outputs,omitempty" yaml:"outputs,omitempty"`
	Definitions        definition.Definitions `json:"definitions,omitempty" yaml:"definitions,omitempty"`
	License            string                 `json:"license,omitempty" yaml:"license,omitempty"`
	RequiredExtensions []string               `json:"requiredExtensions,omitempty" yaml:"requiredExtensions,omitempty"`

	// Custom extension metadata is a named collection of auxiliary data whose
	// meaning is defined outside of the CNAB specification.
	Custom map[string]interface{} `json:"custom,omitempty" yaml:"custom,omitempty"`
}

Bundle is a CNAB metadata document

func ParseReader

func ParseReader(r io.Reader) (Bundle, error)

ParseReader reads CNAB metadata from a JSON string

func Unmarshal

func Unmarshal(data []byte) (*Bundle, error)

Unmarshal unmarshals a Bundle that was not signed.

func (Bundle) Validate

func (b Bundle) Validate() error

Validate the bundle contents.

func (Bundle) WriteFile

func (b Bundle) WriteFile(dest string, mode os.FileMode) error

WriteFile serializes the bundle and writes it to a file as JSON.

func (Bundle) WriteTo

func (b Bundle) WriteTo(w io.Writer) (int64, error)

WriteTo writes unsigned JSON to an io.Writer using the standard formatting.

type Credential

type Credential struct {
	Location    `yaml:",inline"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool   `json:"required,omitempty" yaml:"required,omitempty"`
}

Credential represents the definition of a CNAB credential

type Image

type Image struct {
	BaseImage   `yaml:",inline"`
	Description string `json:"description" yaml:"description"` //TODO: change? see where it's being used? change to description?
}

Image describes a container image in the bundle

func (*Image) DeepCopy

func (i *Image) DeepCopy() *Image

type InvocationImage

type InvocationImage struct {
	BaseImage `yaml:",inline"`
}

InvocationImage contains the image type and location for the installation of a bundle

func (*InvocationImage) DeepCopy

func (img *InvocationImage) DeepCopy() *InvocationImage

func (InvocationImage) Validate

func (img InvocationImage) Validate() error

Validate the image contents.

type Location

type Location struct {
	Path                string `json:"path,omitempty" yaml:"path,omitempty"`
	EnvironmentVariable string `json:"env,omitempty" yaml:"env,omitempty"`
}

Location provides the location where a value should be written in the invocation image.

A location may be either a file (by path) or an environment variable.

type LocationRef

type LocationRef struct {
	Path      string `json:"path" yaml:"path"`
	Field     string `json:"field" yaml:"field"`
	MediaType string `json:"mediaType" yaml:"mediaType"`
}

LocationRef specifies a location within the invocation package

type Maintainer

type Maintainer struct {
	// Name is a user name or organization name
	Name string `json:"name" yaml:"name"`
	// Email is an optional email address to contact the named maintainer
	Email string `json:"email,omitempty" yaml:"email,omitempty"`
	// Url is an optional URL to an address for the named maintainer
	URL string `json:"url,omitempty" yaml:"url,omitempty"`
}

Maintainer describes a code maintainer of a bundle

type Output

type Output struct {
	Definition  string   `json:"definition" yaml:"definition"`
	ApplyTo     []string `json:"applyTo,omitempty" yaml:"applyTo,omitempty"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
	Path        string   `json:"path" yaml:"path"`
}

func (*Output) AppliesTo

func (output *Output) AppliesTo(action string) bool

AppliesTo returns a boolean value specifying whether or not the Output applies to the provided action

type Parameter

type Parameter struct {
	Definition  string    `json:"definition" yaml:"definition"`
	ApplyTo     []string  `json:"applyTo,omitempty" yaml:"applyTo,omitempty"`
	Description string    `json:"description,omitempty" yaml:"description,omitempty"`
	Destination *Location `json:"destination,omitemtpty" yaml:"destination,omitempty"`
	Required    bool      `json:"required,omitempty" yaml:"required,omitempty"`
}

Parameter defines a single parameter for a CNAB bundle

func (*Parameter) AppliesTo

func (parameter *Parameter) AppliesTo(action string) bool

AppliesTo returns a boolean value specifying whether or not the Parameter applies to the provided action

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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