bundle

package
v0.1.2-beta1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 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

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" mapstructure:"modifies"`
	// 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" mapstructure:"stateless"`
	// Description describes the action as a user-readable string
	Description string `json:"description,omitempty" mapstructure:"description"`
}

Action describes a custom (non-core) action.

type BaseImage

type BaseImage struct {
	ImageType string         `json:"imageType" mapstructure:"imageType"`
	Image     string         `json:"image" mapstructure:"image"`
	Digest    string         `json:"digest,omitempty" mapstructure:"digest"`
	Size      uint64         `json:"size,omitempty" mapstructure:"size"`
	Platform  *ImagePlatform `json:"platform,omitempty" mapstructure:"platform"`
	MediaType string         `json:"mediaType,omitempty" mapstructure:"mediaType"`
}

BaseImage contains fields shared across image types

type Bundle

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

	// 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" mapstructure:"custom"`
}

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    `mapstructure:",squash"`
	Description string `json:"description,omitempty" mapstructure:"description"`
	Required    bool   `json:"required,omitempty" mapstructure:"required"`
}

Credential represents the definition of a CNAB credential

type Image

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

Image describes a container image in the bundle

type ImagePlatform

type ImagePlatform struct {
	Architecture string `json:"architecture,omitempty" mapstructure:"architecture"`
	OS           string `json:"os,omitempty" mapstructure:"os"`
}

ImagePlatform indicates what type of platform an image is built for

type InvocationImage

type InvocationImage struct {
	BaseImage `mapstructure:",squash"`
}

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

func (InvocationImage) Validate

func (img InvocationImage) Validate() error

Validate the image contents.

type Location

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

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" mapstructure:"path"`
	Field     string `json:"field" mapstructure:"field"`
	MediaType string `json:"mediaType" mapstructure:"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" mapstructure:"name"`
	// Email is an optional email address to contact the named maintainer
	Email string `json:"email,omitempty" mapstructure:"email"`
	// Url is an optional URL to an address for the named maintainer
	URL string `json:"url,omitempty" mapstructure:"url"`
}

Maintainer describes a code maintainer of a bundle

type OutputDefinition

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

type OutputsDefinition

type OutputsDefinition struct {
	Fields map[string]OutputDefinition `json:"fields" mapstructure:"fields"`
}

type ParameterDefinition

type ParameterDefinition struct {
	Definition  string    `json:"definition" mapstructure:"definition"`
	ApplyTo     []string  `json:"applyTo,omitempty" mapstructure:"applyTo,omitempty"`
	Description string    `json:"description,omitempty" mapstructure:"description"`
	Destination *Location `json:"destination,omitemtpty" mapstructure:"destination"`
}

ParameterDefinition defines a single parameter for a CNAB bundle

type ParametersDefinition

type ParametersDefinition struct {
	Fields   map[string]ParameterDefinition `json:"fields" mapstructure:"fields"`
	Required []string                       `json:"required,omitempty" mapstructure:"required,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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