Documentation ¶
Index ¶
- Variables
- func AppliesTo(s Scoped, action string) bool
- func GetDefaultSchemaVersion() schema.Version
- func ValuesOrDefaults(vals map[string]interface{}, b *Bundle, action string) (map[string]interface{}, error)
- type Action
- type BaseImage
- type Bundle
- func (b Bundle) GetAction(action string) (Action, error)
- func (b Bundle) IsOutputSensitive(outputName string) (bool, error)
- func (b Bundle) Marshal() ([]byte, error)
- func (b Bundle) Validate() error
- func (b Bundle) WriteFile(dest string, mode os.FileMode) error
- func (b Bundle) WriteTo(w io.Writer) (int64, error)
- type Credential
- type Image
- type InvocationImage
- type Location
- type LocationRef
- type Maintainer
- type Output
- type Parameter
- type Scoped
Constants ¶
This section is empty.
Variables ¶
var CNABSpecVersion string = "cnab-core-1.2.0"
CNABSpecVersion represents the CNAB Spec version of the Bundle that this library implements This value is prefixed with e.g. `cnab-core-` so isn't itself valid semver.
Functions ¶
func AppliesTo ¶ added in v0.17.0
AppliesTo returns a boolean value specifying whether or not the scoped item applies to the provided action.
func GetDefaultSchemaVersion ¶
GetDefaultSchemaVersion returns the default semver CNAB schema version of the Bundle that this library implements
func ValuesOrDefaults ¶
func ValuesOrDefaults(vals map[string]interface{}, b *Bundle, action string) (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, assuming the parameter applies to the provided action.
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
type Bundle ¶
type Bundle struct { SchemaVersion schema.Version `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 ¶
ParseReader reads CNAB metadata from a JSON string
func (Bundle) GetAction ¶ added in v0.22.0
GetAction returns the definition for the specified action or an error if undefined. Assumes that all core actions such as install, upgrade, uninstall, are defined. Since the upgrade action is optional, and the bundle.json does not know if the action is supported using the metadata in bundle.json, calling upgrade at runtime may result in an error. You won't know until you try.
func (Bundle) IsOutputSensitive ¶
IsOutputSensitive is a convenience function that determines if an output's value is sensitive.
type Credential ¶
type Credential struct { Location `yaml:",inline"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` ApplyTo []string `json:"applyTo,omitempty" yaml:"applyTo,omitempty"` }
Credential represents the definition of a CNAB credential
func (*Credential) AppliesTo ¶ added in v0.17.0
func (c *Credential) AppliesTo(action string) bool
AppliesTo returns a boolean value specifying whether or not the Credential applies to the provided action
func (*Credential) GetApplyTo ¶ added in v0.17.0
func (c *Credential) GetApplyTo() []string
GetApplyTo returns the list of actions that the Credential applies to.
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
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 ¶
AppliesTo returns a boolean value specifying whether or not the Output applies to the provided action
func (Output) GetApplyTo ¶ added in v0.17.0
GetApplyTo returns the list of actions that the Output applies to.
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" yaml:"destination"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` }
Parameter defines a single parameter for a CNAB bundle
func (*Parameter) AppliesTo ¶
AppliesTo returns a boolean value specifying whether or not the Parameter applies to the provided action
func (*Parameter) GetApplyTo ¶ added in v0.17.0
GetApplyTo returns the list of actions that the Parameter applies to.