Documentation ¶
Index ¶
- Constants
- Variables
- func DependencyReader(bun *bundle.Bundle) (interface{}, error)
- func DockerExtensionReader(bun *bundle.Bundle) (interface{}, error)
- type Dependencies
- type Dependency
- type DependencyLock
- type DependencySolver
- type DependencyVersion
- type Docker
- type ProcessedExtensions
- type RequiredExtension
Constants ¶
const ( // DependenciesKey represents the full key for the Dependencies Extension DependenciesKey = "io.cnab.dependencies" // DependenciesSchema represents the schema for the Dependencies Extension DependenciesSchema = "https://cnab.io/specs/v1/dependencies.schema.json" )
const ( // DockerExtensionKey represents the full key for the Docker Extension DockerExtensionKey = "io.cnab.docker" // DockerExtensionSchema represents the schema for the Docker Extension DockerExtensionSchema = "schema/io-cnab-docker.schema.json" )
Variables ¶
var DependenciesExtension = RequiredExtension{ Shorthand: "dependencies", Key: DependenciesKey, Schema: DependenciesSchema, Reader: DependencyReader, }
DependenciesExtension represents the required extension to enable dependencies
var DockerExtension = RequiredExtension{ Shorthand: "docker", Key: DockerExtensionKey, Schema: DockerExtensionSchema, Reader: DockerExtensionReader, }
DockerExtension represents a required extension enabling access to the host Docker daemon
var SupportedExtensions = []RequiredExtension{ DependenciesExtension, DockerExtension, }
SupportedExtensions represent a listing of the current required extensions that Porter supports
Functions ¶
func DependencyReader ¶
DependencyReader is a Reader for the DependenciesExtension, which reads from the applicable section in the provided bundle and returns a the raw data in the form of an interface
func DockerExtensionReader ¶
DockerExtensionReader is a Reader for the DockerExtension, which reads from the applicable section in the provided bundle and returns a the raw data in the form of an interface
Types ¶
type Dependencies ¶
type Dependencies struct { // Requires is a list of bundles required by this bundle Requires map[string]Dependency `json:"requires,omitempty" mapstructure:"requires"` }
Dependencies describes the set of custom extension metadata associated with the dependencies spec https://github.com/cnabio/cnab-spec/blob/master/500-CNAB-dependencies.md
func ReadDependencies ¶
func ReadDependencies(bun *bundle.Bundle) (*Dependencies, error)
ReadDependencies is a convenience method for returning a bonafide Dependencies reference after reading from the applicable section from the provided bundle
type Dependency ¶
type Dependency struct { // Bundle is the location of the bundle in a registry, for example REGISTRY/NAME:TAG Bundle string `json:"bundle" mapstructure:"bundle"` // Version is a set of allowed versions Version *DependencyVersion `json:"version,omitempty" mapstructure:"version"` }
Dependency describes a dependency on another bundle
type DependencyLock ¶
type DependencySolver ¶
type DependencySolver struct { }
func (*DependencySolver) ResolveDependencies ¶
func (s *DependencySolver) ResolveDependencies(bun *bundle.Bundle) ([]DependencyLock, error)
func (*DependencySolver) ResolveVersion ¶
func (s *DependencySolver) ResolveVersion(alias string, dep Dependency) (reference.NamedTagged, error)
ResolveVersion returns the bundle name, its version and any error.
type DependencyVersion ¶
type DependencyVersion struct { // Ranges of semantic versions, with or without the leading v prefix, allowed by the dependency Ranges []string `json:"ranges,omitempty" mapstructure:"ranges"` // AllowPrereleases specifies if prerelease versions can satisfy the dependency AllowPrereleases bool `json:"prereleases" mapstructure:"prereleases"` }
DependencyVersion is a set of allowed versions for a dependency
type Docker ¶
type Docker struct { // Privileged represents whether or not the Docker container should run as --privileged Privileged bool `json:"privileged,omitempty"` }
Docker describes the set of custom extension metadata associated with the Docker extension
type ProcessedExtensions ¶
type ProcessedExtensions map[string]interface{}
ProcessedExtensions represents a map of the extension name to the processed extension configuration
func ProcessRequiredExtensions ¶
func ProcessRequiredExtensions(b *bundle.Bundle) (ProcessedExtensions, error)
ProcessRequiredExtensions checks all required extensions in the provided bundle and makes sure Porter supports them.
If an unsupported required extension is found, an error is returned.
For each supported required extension, the configuration for that extension is read and returned in the form of a map of the extension name to the extension configuration
func (ProcessedExtensions) GetDockerExtension ¶
func (e ProcessedExtensions) GetDockerExtension() (dockerExt Docker, dockerRequired bool, err error)
GetDockerExtension checks if the docker extension is present and returns its extension configuration.
type RequiredExtension ¶
type RequiredExtension struct { Shorthand string Key string Schema string Reader func(b *bundle.Bundle) (interface{}, error) }
RequiredExtension represents a required extension that is known and supported by Porter
func GetSupportedExtension ¶
func GetSupportedExtension(e string) (*RequiredExtension, error)
GetSupportedExtension returns a supported extension according to the provided name, or an error