manifest

package
v0.18.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 17 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCoreAction

func IsCoreAction(value Action) bool

IsCoreAction determines if the value is a core action from the CNAB spec.

Types

type Action

type Action string
const (
	ActionInstall   Action = "install"
	ActionUpgrade   Action = "upgrade"
	ActionUninstall Action = "uninstall"
)

func GetCoreActions

func GetCoreActions() []Action

type BundleOutput

type BundleOutput struct {
	Name                string `yaml:"name"`
	Path                string `yaml:"path"`
	EnvironmentVariable string `yaml:"env"`
}

type CredentialDefinition

type CredentialDefinition struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description,omitempty"`
	Required    bool   `yaml:"required,omitempty"`

	Location `yaml:",inline"`
}

CredentialDefinition represents the structure or fields of a credential parameter

func (*CredentialDefinition) UnmarshalYAML

func (cd *CredentialDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error

type CustomActionDefinition

type CustomActionDefinition struct {
	Description       string `yaml:"description,omitempty"`
	ModifiesResources bool   `yaml:"modifies,omitempty"`
	Stateless         bool   `yaml:"stateless,omitempty"`
}

type Dependency

type Dependency struct {
	Tag              string   `yaml:"tag"`
	Versions         []string `yaml:"versions"`
	AllowPrereleases bool     `yaml:"prereleases"`

	Parameters map[string]string `yaml:"parameters,omitempty"`
}

func (*Dependency) Validate

func (d *Dependency) Validate() error

type Location

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

TODO: use cnab-go's bundle.Location instead, once yaml tags have been added Location represents a Parameter or Credential location in an InvocationImage

func (Location) IsEmpty

func (l Location) IsEmpty() bool

type Manifest

type Manifest struct {
	// ManifestPath is the location from which the manifest was loaded, such as the path on the filesystem or a url.
	ManifestPath string `yaml:"-"`

	Name        string `yaml:"name,omitempty"`
	Description string `yaml:"description,omitempty"`
	Version     string `yaml:"version,omitempty"`

	// Image is the name of the invocation image in the format REGISTRY/NAME:TAG
	Image string `yaml:"invocationImage,omitempty"`

	// BundleTag is the name of the bundle in the format REGISTRY/NAME:TAG
	BundleTag string `yaml:"tag"`

	// Dockerfile is the relative path to the Dockerfile template for the invocation image
	Dockerfile string `yaml:"dockerfile,omitempty"`

	Mixins []MixinDeclaration `yaml:"mixins,omitempty"`

	Install   Steps `yaml:"install"`
	Uninstall Steps `yaml:"uninstall"`
	Upgrade   Steps `yaml:"upgrade"`

	CustomActions           map[string]Steps                  `yaml:"-"`
	CustomActionDefinitions map[string]CustomActionDefinition `yaml:"customActions,omitempty"`

	Parameters   []ParameterDefinition  `yaml:"parameters,omitempty"`
	Credentials  []CredentialDefinition `yaml:"credentials,omitempty"`
	Dependencies map[string]Dependency  `yaml:"dependencies,omitempty"`
	Outputs      []OutputDefinition     `yaml:"outputs,omitempty"`

	// ImageMap is a map of images referenced in the bundle. If an image relocation mapping is later provided, that
	// will be mounted at as a file at runtime to /cnab/app/relocation-mapping.json.
	ImageMap map[string]MappedImage `yaml:"images,omitempty"`
}

func LoadManifestFrom

func LoadManifestFrom(cxt *context.Context, file string) (*Manifest, error)

func ReadManifest

func ReadManifest(cxt *context.Context, path string) (*Manifest, error)

ReadManifest determines if specified path is a URL or a filepath. After reading the data in the path it returns a Manifest and any errors

func UnmarshalManifest

func UnmarshalManifest(manifestData []byte) (*Manifest, error)

func (*Manifest) SetDefaults

func (m *Manifest) SetDefaults()

func (*Manifest) Validate

func (m *Manifest) Validate() error

type MappedImage

type MappedImage struct {
	Description string            `yaml:"description"`
	ImageType   string            `yaml:"imageType"`
	Repository  string            `yaml:"repository"`
	Digest      string            `yaml:"digest,omitempty"`
	Size        uint64            `yaml:"size,omitempty"`
	MediaType   string            `yaml:"mediaType,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	Tag         string            `yaml:"tag,omitempty"`
}

type MixinDeclaration

type MixinDeclaration struct {
	Name   string
	Config interface{}
}

func (MixinDeclaration) MarshalYAML

func (m MixinDeclaration) MarshalYAML() (interface{}, error)

MarshalYAML allows mixin declarations to either be a normal list of strings mixins: - exec - helm or allow some entries to have config data defined

  • az: extensions:
  • iot

func (*MixinDeclaration) UnmarshalYAML

func (m *MixinDeclaration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML allows mixin declarations to either be a normal list of strings mixins: - exec - helm or allow some entries to have config data defined

  • az: extensions:
  • iot

type OutputDefinition

type OutputDefinition struct {
	Name      string   `yaml:"name"`
	ApplyTo   []string `yaml:"applyTo,omitempty"`
	Sensitive bool     `yaml:"sensitive"`

	definition.Schema `yaml:",inline"`
}

OutputDefinition defines a single output for a CNAB

func (*OutputDefinition) Validate

func (od *OutputDefinition) Validate() error

type ParameterDefinition

type ParameterDefinition struct {
	Name      string `yaml:"name"`
	Sensitive bool   `yaml:"sensitive"`

	// These fields represent a subset of bundle.Parameter as defined in deislabs/cnab-go,
	// minus the 'Description' field (definition.Schema's will be used) and `Definition` field
	ApplyTo     []string `yaml:"applyTo,omitempty"`
	Destination Location `yaml:",inline,omitempty"`

	definition.Schema `yaml:",inline"`
}

ParameterDefinition defines a single parameter for a CNAB bundle

func (*ParameterDefinition) DeepCopy

func (pd *ParameterDefinition) DeepCopy() *ParameterDefinition

DeepCopy copies a ParameterDefinition and returns the copy

func (*ParameterDefinition) Validate

func (pd *ParameterDefinition) Validate() error

type RuntimeManifest

type RuntimeManifest struct {
	*context.Context
	*Manifest

	Action Action
	// contains filtered or unexported fields
}

func NewRuntimeManifest

func NewRuntimeManifest(cxt *context.Context, action Action, manifest *Manifest) RuntimeManifest

func (*RuntimeManifest) ApplyStepOutputs

func (m *RuntimeManifest) ApplyStepOutputs(step *Step, assignments map[string]string) error

func (*RuntimeManifest) GetSensitiveValues

func (m *RuntimeManifest) GetSensitiveValues() []string

func (*RuntimeManifest) GetSteps

func (m *RuntimeManifest) GetSteps() Steps

func (*RuntimeManifest) Prepare

func (m *RuntimeManifest) Prepare() error

Prepare prepares the runtime environment prior to step execution

func (*RuntimeManifest) ResolveImages

func (m *RuntimeManifest) ResolveImages(bun *bundle.Bundle, reloMap relocation.ImageRelocationMap) error

ResolveImages updates the RuntimeManifest to properly reflect the image map passed to the bundle via the mounted bundle.json and relocation mapping

func (*RuntimeManifest) ResolveStep

func (m *RuntimeManifest) ResolveStep(step *Step) error

ResolveStep will walk through the Step's data and resolve any placeholder data using the definitions in the manifest, like parameters or credentials.

func (*RuntimeManifest) Validate

func (m *RuntimeManifest) Validate() error

type Step

type Step struct {
	Data map[string]interface{} `yaml:",inline"`
}

func (*Step) GetDescription

func (s *Step) GetDescription() (string, error)

GetDescription returns a description of the step. Every step must have this property.

func (*Step) GetMixinName

func (s *Step) GetMixinName() string

func (*Step) Validate

func (s *Step) Validate(m *Manifest) error

type StepOutput

type StepOutput struct {
	Name string                 `yaml:"name"`
	Data map[string]interface{} `yaml:",inline"`
	// contains filtered or unexported fields
}

type Steps

type Steps []*Step

func (Steps) Validate

func (s Steps) Validate(m *Manifest) error

Jump to

Keyboard shortcuts

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