converter

package
v0.0.0-...-0bf8355 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CNABVersion is the currently supported CNAB runtime version
	CNABVersion = "v1.0.0-WD"

	// OCIIndexSchemaVersion is the currently supported OCI index schema's version
	OCIIndexSchemaVersion = 2
)
View Source
const (
	// CNABRuntimeVersionAnnotation is the top level annotation specifying the CNAB runtime version
	CNABRuntimeVersionAnnotation = "io.cnab.runtime_version"
	// CNABKeywordsAnnotation is the top level annotation specifying a list of keywords
	CNABKeywordsAnnotation = "io.cnab.keywords"
	// ArtifactTypeAnnotation is the top level annotation specifying the type of the artifact in the registry
	ArtifactTypeAnnotation = "org.opencontainers.artifactType"
	// ArtifactTypeValue is the value of ArtifactTypeAnnotion for CNAB bundles
	ArtifactTypeValue = "application/vnd.cnab.manifest.v1"
)
View Source
const (
	// CNABDescriptorTypeAnnotation is a descriptor-level annotation specifying the type of reference image (currently invocation or component)
	CNABDescriptorTypeAnnotation = "io.cnab.manifest.type"
	// CNABDescriptorTypeInvocation is the CNABDescriptorTypeAnnotation value for invocation images
	CNABDescriptorTypeInvocation cnabDescriptorTypeValue = "invocation"
	// CNABDescriptorTypeComponent is the CNABDescriptorTypeAnnotation value for component images
	CNABDescriptorTypeComponent cnabDescriptorTypeValue = "component"
	// CNABDescriptorTypeConfig is the CNABDescriptorTypeAnnotation value for bundle configuration
	CNABDescriptorTypeConfig cnabDescriptorTypeValue = "config"

	// CNABDescriptorComponentNameAnnotation is a decriptor-level annotation specifying the component name
	CNABDescriptorComponentNameAnnotation = "io.cnab.component.name"
)
View Source
const (
	// CNABConfigMediaType is the config media type of the CNAB config image manifest
	CNABConfigMediaType = "application/vnd.cnab.config.v1+json"
)

Variables

This section is empty.

Functions

func ConvertBundleToOCIIndex

func ConvertBundleToOCIIndex(b *bundle.Bundle, targetRef reference.Named, bundleConfigManifestRef ocischemav1.Descriptor) (*ocischemav1.Index, error)

ConvertBundleToOCIIndex converts a CNAB bundle into an OCI Index representation

func ConvertOCIIndexToBundle

func ConvertOCIIndexToBundle(ix *ocischemav1.Index, config *BundleConfig, originRepo reference.Named) (*bundle.Bundle, error)

ConvertOCIIndexToBundle converts an OCI index to a CNAB bundle representation

func GetBundleConfigManifestDescriptor

func GetBundleConfigManifestDescriptor(ix *ocischemav1.Index) (ocischemav1.Descriptor, error)

GetBundleConfigManifestDescriptor returns the CNAB runtime config manifest descriptor from a OCI index

Types

type BundleConfig

type BundleConfig struct {
	SchemaVersion string                       `json:"schemaVersion" mapstructure:"schemaVersion"`
	Actions       map[string]bundle.Action     `json:"actions,omitempty" mapstructure:"actions,omitempty"`
	Definitions   definition.Definitions       `json:"definitions" mapstructure:"definitions"`
	Parameters    *bundle.ParametersDefinition `json:"parameters" mapstructure:"parameters"`
	Credentials   map[string]bundle.Credential `json:"credentials" mapstructure:"credentials"`
	Custom        map[string]interface{}       `json:"custom,omitempty" mapstructure:"custom"`
}

BundleConfig describes a cnab bundle runtime config

func CreateBundleConfig

func CreateBundleConfig(b *bundle.Bundle) *BundleConfig

CreateBundleConfig creates a bundle config from a CNAB

func (*BundleConfig) PrepareForPush

func (c *BundleConfig) PrepareForPush() (*PreparedBundleConfig, error)

PrepareForPush serializes a bundle config, generates its image manifest, and its manifest descriptor

type PreparedBundleConfig

type PreparedBundleConfig struct {
	ConfigBlob           []byte
	ConfigBlobDescriptor ocischemav1.Descriptor
	Manifest             []byte
	ManifestDescriptor   ocischemav1.Descriptor
	Fallback             *PreparedBundleConfig
}

PreparedBundleConfig contains the config blob, image manifest (and fallback), and descriptors for a CNAB config

Jump to

Keyboard shortcuts

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