app

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnvironmentDirName is the directory name for environments.
	EnvironmentDirName = "environments"

	// LibDirName is the directory name for libraries.
	LibDirName = "lib"
)
View Source
const (
	// DefaultAPIVersion is the default ks API version to use if not specified.
	DefaultAPIVersion = "0.3.0"
	// Kind is the schema resource type.
	Kind = "ksonnet.io/app"
	// DefaultVersion is the default version of the app schema.
	DefaultVersion = "0.0.1"
)

Variables

View Source
var (
	// DefaultFilePermissions are the default permissions for a file.
	DefaultFilePermissions = os.FileMode(0644)
	// DefaultFolderPermissions are the default permissions for a folder.
	DefaultFolderPermissions = os.FileMode(0755)
)
View Source
var (
	// ErrRegistryNameInvalid is the error where a registry name is invalid.
	ErrRegistryNameInvalid = fmt.Errorf("Registry name is invalid")
	// ErrRegistryExists is the error when trying to create a registry that already exists.
	ErrRegistryExists = fmt.Errorf("Registry with name already exists")
	// ErrEnvironmentNameInvalid is the error where an environment name is invalid.
	ErrEnvironmentNameInvalid = fmt.Errorf("Environment name is invalid")
	// ErrEnvironmentExists is the error when trying to create an environment that already exists.
	ErrEnvironmentExists = fmt.Errorf("Environment with name already exists")
	// ErrEnvironmentNotExists is the error when trying to update an environment that doesn't exist.
	ErrEnvironmentNotExists = fmt.Errorf("Environment with name doesn't exist")
)

Functions

func CheckOverrideUpgrade added in v0.13.0

func CheckOverrideUpgrade(fs afero.Fs, root string) bool

CheckOverrideUpgrade returns true if the specified override version should be upgraded.

func FindRoot added in v0.13.0

func FindRoot(fs afero.Fs, cwd string) (string, error)

FindRoot finds a ksonnet app.yaml in the current directory or its ancestors.

func NewBaseApp added in v0.13.0

func NewBaseApp(fs afero.Fs, root string, httpClient *http.Client, opts ...Opt) *baseApp

NewBaseApp constructs a baseApp, a container of dependencies and configuration describing a ksonnet project.

func NewHTTPClient added in v0.13.0

func NewHTTPClient(tlsSkipVerify bool) *http.Client

NewHTTPClient loads an HTTP client based on common configuration for certificates, tls verification, timeouts, etc.

func StubUpdateLibData

func StubUpdateLibData(fs afero.Fs, k8sSpecFlag, libPath string) (string, error)

StubUpdateLibData always returns no error.

Types

type App

type App interface {
	// AddEnvironment adds an environment.
	AddEnvironment(spec *EnvironmentConfig, k8sSpecFlag string, isOverride bool) error
	// AddRegistry adds a registry.
	AddRegistry(spec *RegistryConfig, isOverride bool) error
	// CurrentEnvironment returns the current environment name or an empty string.
	CurrentEnvironment() string
	// Environment finds an environment by name.
	Environment(name string) (*EnvironmentConfig, error)
	// Environments returns all environments.
	Environments() (EnvironmentConfigs, error)
	// EnvironmentParams returns params for an environment.
	EnvironmentParams(name string) (string, error)
	// Fs is the app's afero Fs.
	Fs() afero.Fs
	// HTTPClient is the app's http client
	HTTPClient() *http.Client
	// IsEnvOverride returns whether the specified environment has overriding configuration
	IsEnvOverride(name string) bool
	// IsRegistryOverride returns whether the specified registry has overriding configuration
	IsRegistryOverride(name string) bool
	// LibPath returns the path of the lib for an environment.
	LibPath(envName string) (string, error)
	// Libraries returns all environments.
	Libraries() (LibraryConfigs, error)
	// Registries returns all registries.
	Registries() (RegistryConfigs, error)
	// RemoveEnvironment removes an environment from the main configuration or an override.
	RemoveEnvironment(name string, override bool) error
	// RenameEnvironment renames an environment in the main configuration or an override.
	RenameEnvironment(from, to string, override bool) error
	// Root returns the root path of the application.
	Root() string
	// SetCurrentEnvironment sets the current environment.
	SetCurrentEnvironment(name string) error
	// UpdateTargets sets the targets for an environment.
	UpdateTargets(envName string, targets []string, isOverride bool) error
	// UpdateLib adds, updates or removes a library reference.
	// env is optional - if provided the reference is scoped under the environment,
	// otherwise it is globally scoped.
	// If spec if nil, the library reference will be removed.
	// Returns the previous reference for the named library, if one existed.
	UpdateLib(name string, env string, spec *LibraryConfig) (*LibraryConfig, error)
	// UpdateRegistry updates a registry.
	UpdateRegistry(spec *RegistryConfig) error
	// Upgrade upgrades an application (app.yaml) to the current version.
	Upgrade(bool) error
	// VendorPath returns the root of the vendor path.
	VendorPath() string
}

App is a ksonnet application.

func Load

func Load(fs afero.Fs, httpClient *http.Client, appRoot string) (App, error)

Load loads the application configuration.

type ContributorSpec

type ContributorSpec = ContributorSpec030

ContributorSpec is a specification for the project contributors.

type ContributorSpec010 added in v0.13.0

type ContributorSpec010 struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

ContributorSpec010 is a specification for the project contributors.

type ContributorSpec020 added in v0.13.0

type ContributorSpec020 struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

ContributorSpec020 is a specification for the project contributors.

type ContributorSpec030 added in v0.13.0

type ContributorSpec030 struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

ContributorSpec030 is a specification for the project contributors.

type ContributorSpecs

type ContributorSpecs = ContributorSpecs030

ContributorSpecs is a list of 0 or more contributors.

type ContributorSpecs010 added in v0.13.0

type ContributorSpecs010 []*ContributorSpec010

ContributorSpecs010 is a list of 0 or more contributors.

type ContributorSpecs020 added in v0.13.0

type ContributorSpecs020 []*ContributorSpec020

ContributorSpecs020 is a list of 0 or more contributors.

type ContributorSpecs030 added in v0.13.0

type ContributorSpecs030 []*ContributorSpec030

ContributorSpecs030 is a list of 0 or more contributors.

type Encoder added in v0.11.0

type Encoder interface {
	// Encode writes an item to a stream. Implementations may return errors
	// if the data to be encoded is invalid.
	Encode(i interface{}, w io.Writer) error
}

Encoder writes items to a serialized form.

type EnvironmentConfig added in v0.12.0

type EnvironmentConfig = EnvironmentConfig030

EnvironmentConfig contains the specification for ksonnet environments.

type EnvironmentConfig010 added in v0.13.0

type EnvironmentConfig010 struct {
	// Name is the user defined name of an environment
	Name string `json:"-"`
	// KubernetesVersion is the kubernetes version the targeted cluster is
	// running on.
	KubernetesVersion string `json:"k8sVersion"`
	// Path is the relative project path containing metadata for this
	// environment.
	Path string `json:"path"`
	// Destination stores the cluster address that this environment points to.
	Destination *EnvironmentDestinationSpec010 `json:"destination"`
	// Targets contain the relative component paths that this environment
	// wishes to deploy on it's destination.
	Targets []string `json:"targets,omitempty"`
	// contains filtered or unexported fields
}

EnvironmentConfig010 contains the specification for ksonnet environments.

type EnvironmentConfig020 added in v0.13.0

type EnvironmentConfig020 struct {
	// Name is the user defined name of an environment
	Name string `json:"-"`
	// KubernetesVersion is the kubernetes version the targeted cluster is
	// running on.
	KubernetesVersion string `json:"k8sVersion"`
	// Path is the relative project path containing metadata for this
	// environment.
	Path string `json:"path"`
	// Destination stores the cluster address that this environment points to.
	Destination *EnvironmentDestinationSpec020 `json:"destination"`
	// Targets contain the relative component paths that this environment
	// wishes to deploy on it's destination.
	Targets []string `json:"targets,omitempty"`
	// Libraries specifies versioned libraries specifically used by this environment.
	Libraries LibraryConfigs020 `json:"libraries,omitempty"`
	// contains filtered or unexported fields
}

EnvironmentConfig020 contains the specification for ksonnet environments.

func (*EnvironmentConfig020) IsOverride added in v0.13.0

func (e *EnvironmentConfig020) IsOverride() bool

IsOverride is true if this EnvironmentConfig is an override.

func (*EnvironmentConfig020) MakePath added in v0.13.0

func (e *EnvironmentConfig020) MakePath(rootPath string) string

MakePath return the absolute path to the environment directory.

type EnvironmentConfig030 added in v0.13.0

type EnvironmentConfig030 struct {
	// Name is the user defined name of an environment
	Name string `json:"-"`
	// KubernetesVersion is the kubernetes version the targeted cluster is
	// running on.
	KubernetesVersion string `json:"k8sVersion"`
	// Path is the relative project path containing metadata for this
	// environment.
	Path string `json:"path"`
	// Destination stores the cluster address that this environment points to.
	Destination *EnvironmentDestinationSpec030 `json:"destination"`
	// Targets contain the relative component paths that this environment
	// wishes to deploy on it's destination.
	Targets []string `json:"targets,omitempty"`
	// Libraries specifies versioned libraries specifically used by this environment.
	Libraries LibraryConfigs030 `json:"libraries,omitempty"`
}

EnvironmentConfig030 contains the specification for ksonnet environments.

func (*EnvironmentConfig030) MakePath added in v0.13.0

func (e *EnvironmentConfig030) MakePath(rootPath string) string

MakePath return the absolute path to the environment directory.

type EnvironmentConfigs added in v0.12.0

type EnvironmentConfigs = EnvironmentConfigs030

EnvironmentConfigs contains one or more EnvironmentConfig.

type EnvironmentConfigs010 added in v0.13.0

type EnvironmentConfigs010 map[string]*EnvironmentConfig010

EnvironmentConfigs010 contains one or more EnvironmentConfig.

func (*EnvironmentConfigs010) UnmarshalJSON added in v0.13.0

func (e *EnvironmentConfigs010) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of EnvironmentConfig objects according to they key name in the environments map.

type EnvironmentConfigs020 added in v0.13.0

type EnvironmentConfigs020 map[string]*EnvironmentConfig020

EnvironmentConfigs020 contains one or more EnvironmentConfig.

func (*EnvironmentConfigs020) UnmarshalJSON added in v0.13.0

func (e *EnvironmentConfigs020) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of EnvironmentConfig objects according to they key name in the environments map.

type EnvironmentConfigs030 added in v0.13.0

type EnvironmentConfigs030 map[string]*EnvironmentConfig030

EnvironmentConfigs030 contains one or more EnvironmentConfig.

func (*EnvironmentConfigs030) UnmarshalJSON added in v0.13.0

func (e *EnvironmentConfigs030) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of EnvironmentConfig objects according to they key name in the environments map.

type EnvironmentDestinationSpec

type EnvironmentDestinationSpec = EnvironmentDestinationSpec030

EnvironmentDestinationSpec contains the specification for the cluster address that the environment points to.

type EnvironmentDestinationSpec010 added in v0.13.0

type EnvironmentDestinationSpec010 struct {
	// Server is the Kubernetes server that the cluster is running on.
	Server string `json:"server"`
	// Namespace is the namespace of the Kubernetes server that targets should
	// be deployed to. This is "default", if not specified.
	Namespace string `json:"namespace"`
}

EnvironmentDestinationSpec010 contains the specification for the cluster address that the environment points to.

type EnvironmentDestinationSpec020 added in v0.13.0

type EnvironmentDestinationSpec020 struct {
	// Server is the Kubernetes server that the cluster is running on.
	Server string `json:"server"`
	// Namespace is the namespace of the Kubernetes server that targets should
	// be deployed to. This is "default", if not specified.
	Namespace string `json:"namespace"`
}

EnvironmentDestinationSpec020 contains the specification for the cluster address that the environment points to.

type EnvironmentDestinationSpec030 added in v0.13.0

type EnvironmentDestinationSpec030 struct {
	// Server is the Kubernetes server that the cluster is running on.
	Server string `json:"server"`
	// Namespace is the namespace of the Kubernetes server that targets should
	// be deployed to. This is "default", if not specified.
	Namespace string `json:"namespace"`
}

EnvironmentDestinationSpec030 contains the specification for the cluster address that the environment points to.

type GitVersionSpec010 added in v0.13.0

type GitVersionSpec010 struct {
	RefSpec   string `json:"refSpec"`
	CommitSHA string `json:"commitSha"`
}

GitVersionSpec010 is the specification for a Registry's Git Version.

type GitVersionSpec020 added in v0.13.0

type GitVersionSpec020 struct {
	RefSpec   string `json:"refSpec"`
	CommitSHA string `json:"commitSha"`
}

GitVersionSpec020 is the specification for a Registry's Git Version.

type GitVersionSpec030 added in v0.13.0

type GitVersionSpec030 struct {
	RefSpec   string `json:"refSpec"`
	CommitSHA string `json:"commitSha"`
}

GitVersionSpec030 is the specification for a Registry's Git Version.

type KSLibUpdater added in v0.13.0

type KSLibUpdater interface {
	// Generates a ksonnet-lib matching the specified k8s version.
	// Returns the generated version.
	UpdateKSLib(k8sSpecFlag string, libPath string) (string, error)
}

KSLibUpdater generates / updates ksonnet-lib matching a specific k8s version.

type LibraryConfig added in v0.12.0

type LibraryConfig = LibraryConfig030

LibraryConfig is the specification for a library part.

type LibraryConfig010 added in v0.13.0

type LibraryConfig010 struct {
	Name       string             `json:"name"`
	Registry   string             `json:"registry"`
	GitVersion *GitVersionSpec010 `json:"gitVersion,omitempty"`
}

LibraryConfig010 is the specification for a library part.

type LibraryConfig020 added in v0.13.0

type LibraryConfig020 struct {
	Name     string `json:"name"`
	Registry string `json:"registry"`
	Version  string `json:"version"`
}

LibraryConfig020 is the specification for a library part.

func (LibraryConfig020) String added in v0.13.0

func (l LibraryConfig020) String() string

type LibraryConfig030 added in v0.13.0

type LibraryConfig030 struct {
	Name     string `json:"name"`
	Registry string `json:"registry"`
	Version  string `json:"version"`
}

LibraryConfig030 is the specification for a library part.

func (LibraryConfig030) String added in v0.13.0

func (l LibraryConfig030) String() string

type LibraryConfigs added in v0.12.0

type LibraryConfigs = LibraryConfigs030

LibraryConfigs is a mapping of a library configurations by name.

type LibraryConfigs010 added in v0.13.0

type LibraryConfigs010 map[string]*LibraryConfig010

LibraryConfigs010 is a mapping of a library configurations by name.

func (*LibraryConfigs010) MarshalJSON added in v0.13.0

func (l *LibraryConfigs010) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Unmarshaler interface. We implement some compatibility conversions.

func (*LibraryConfigs010) UnmarshalJSON added in v0.13.0

func (l *LibraryConfigs010) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. We implement some compatibility conversions.

type LibraryConfigs020 added in v0.13.0

type LibraryConfigs020 map[string]*LibraryConfig020

LibraryConfigs020 is a mapping of a library configurations by name.

func (*LibraryConfigs020) UnmarshalJSON added in v0.13.0

func (l *LibraryConfigs020) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. We implement some compatibility conversions.

type LibraryConfigs030 added in v0.13.0

type LibraryConfigs030 map[string]*LibraryConfig030

LibraryConfigs030 is a mapping of a library configurations by name.

func (*LibraryConfigs030) MarshalJSON added in v0.13.0

func (l *LibraryConfigs030) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. We implement some compatibility conversions.

func (*LibraryConfigs030) UnmarshalJSON added in v0.13.0

func (l *LibraryConfigs030) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. We implement some compatibility conversions.

type Migrator added in v0.13.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator describes a sequence of migrations for any backward supported schemas to reach the currently supported schema version

func NewMigrator added in v0.13.0

func NewMigrator(fs afero.Fs, root string) Migrator

NewMigrator constructs a migrator with the provided dependencies

func (Migrator) Load added in v0.13.0

func (m Migrator) Load(fromVersion semver.Version, force bool) (interface{}, error)

Load loads a schema, performing any necessary migrations to bring it to the most current version.

type Opt added in v0.13.0

type Opt func(*baseApp)

Opt is a constructor option for baseApp

func OptLibUpdater added in v0.13.0

func OptLibUpdater(libUpdater KSLibUpdater) Opt

OptLibUpdater returns an option for setting a KSLibUpdater on an App010

type Override

type Override = Override030

Override defines overrides to ksonnet project configurations.

type Override020 added in v0.13.0

type Override020 struct {
	Kind         string                `json:"kind"`
	APIVersion   string                `json:"apiVersion"`
	Environments EnvironmentConfigs020 `json:"environments,omitempty"`
	Registries   RegistryConfigs020    `json:"registries,omitempty"`
}

Override020 defines overrides to ksonnet project configurations.

func (*Override020) UnmarshalJSON added in v0.13.0

func (o *Override020) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Override030 added in v0.13.0

type Override030 struct {
	Kind         string                `json:"kind"`
	APIVersion   string                `json:"apiVersion"`
	Environments EnvironmentConfigs030 `json:"environments,omitempty"`
	Registries   RegistryConfigs030    `json:"registries,omitempty"`
}

Override030 defines overrides to ksonnet project configurations.

func (*Override030) IsDefined added in v0.13.0

func (o *Override030) IsDefined() bool

IsDefined returns true if the override has environments or registries defined.

func (*Override030) UnmarshalJSON added in v0.13.0

func (o *Override030) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Override030) Validate added in v0.13.0

func (o *Override030) Validate() error

Validate validates an Override.

type RegistryConfig added in v0.12.0

type RegistryConfig = RegistryConfig030

RegistryConfig defines the spec for a registry. A registry is a collection of library parts.

type RegistryConfig010 added in v0.13.0

type RegistryConfig010 struct {
	// Name is the user defined name of a registry.
	Name string `json:"-"`
	// Protocol is the registry protocol for this registry. Currently supported
	// values are `github`, `fs`, `helm`.
	Protocol string `json:"protocol"`
	// URI is the location of the registry.
	URI string `json:"uri"`
	// contains filtered or unexported fields
}

RegistryConfig010 defines the spec for a registry. A registry is a collection of library parts.

type RegistryConfig020 added in v0.13.0

type RegistryConfig020 struct {
	// Name is the user defined name of a registry.
	Name string `json:"-"`
	// Protocol is the registry protocol for this registry. Currently supported
	// values are `github`, `fs`, `helm`.
	Protocol string `json:"protocol"`
	// URI is the location of the registry.
	URI string `json:"uri"`
	// contains filtered or unexported fields
}

RegistryConfig020 defines the spec for a registry. A registry is a collection of library parts.

func (*RegistryConfig020) IsOverride added in v0.13.0

func (r *RegistryConfig020) IsOverride() bool

IsOverride is true if this RegistryConfig is an override.

type RegistryConfig030 added in v0.13.0

type RegistryConfig030 struct {
	// Name is the user defined name of a registry.
	Name string `json:"-"`
	// Protocol is the registry protocol for this registry. Currently supported
	// values are `github`, `fs`, `helm`.
	Protocol string `json:"protocol"`
	// URI is the location of the registry.
	URI string `json:"uri"`
}

RegistryConfig030 defines the spec for a registry. A registry is a collection of library parts.

type RegistryConfigs added in v0.12.0

type RegistryConfigs = RegistryConfigs030

RegistryConfigs is a map of the registry name to a RegistryConfig.

type RegistryConfigs010 added in v0.13.0

type RegistryConfigs010 map[string]*RegistryConfig010

RegistryConfigs010 is a map of the registry name to a RegistryConfig.

func (*RegistryConfigs010) UnmarshalJSON added in v0.13.0

func (r *RegistryConfigs010) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of RegistryConfig objects according to they key name in the registries map.

type RegistryConfigs020 added in v0.13.0

type RegistryConfigs020 map[string]*RegistryConfig020

RegistryConfigs020 is a map of the registry name to a RegistryConfig.

func (*RegistryConfigs020) UnmarshalJSON added in v0.13.0

func (r *RegistryConfigs020) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of RegistryConfig objects according to they key name in the registries map.

type RegistryConfigs030 added in v0.13.0

type RegistryConfigs030 map[string]*RegistryConfig030

RegistryConfigs030 is a map of the registry name to a RegistryConfig.

func (*RegistryConfigs030) UnmarshalJSON added in v0.13.0

func (r *RegistryConfigs030) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Our goal is to populate the Name field of RegistryConfig objects according to they key name in the registries map.

type RepositorySpec

type RepositorySpec = RepositorySpec030

RepositorySpec defines the spec for the upstream repository of this project.

type RepositorySpec010 added in v0.13.0

type RepositorySpec010 struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

RepositorySpec010 defines the spec for the upstream repository of this project.

type RepositorySpec020 added in v0.13.0

type RepositorySpec020 struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

RepositorySpec020 defines the spec for the upstream repository of this project.

type RepositorySpec030 added in v0.13.0

type RepositorySpec030 struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

RepositorySpec030 defines the spec for the upstream repository of this project.

type Spec

type Spec = Spec030

Spec defines all the ksonnet project metadata. This includes details such as the project name, authors, environments, and registries.

type Spec010 added in v0.13.0

type Spec010 struct {
	APIVersion   string                `json:"apiVersion,omitempty"`
	Kind         string                `json:"kind,omitempty"`
	Name         string                `json:"name,omitempty"`
	Version      string                `json:"version,omitempty"`
	Description  string                `json:"description,omitempty"`
	Authors      []string              `json:"authors,omitempty"`
	Contributors ContributorSpecs010   `json:"contributors,omitempty"`
	Repository   *RepositorySpec010    `json:"repository,omitempty"`
	Bugs         string                `json:"bugs,omitempty"`
	Keywords     []string              `json:"keywords,omitempty"`
	Registries   RegistryConfigs010    `json:"registries,omitempty"`
	Environments EnvironmentConfigs010 `json:"environments,omitempty"`
	Libraries    LibraryConfigs010     `json:"libraries,omitempty"`
	License      string                `json:"license,omitempty"`
}

Spec010 defines all the ksonnet project metadata. This includes details such as the project name, authors, environments, and registries.

func (*Spec010) AddRegistryConfig added in v0.13.0

func (s *Spec010) AddRegistryConfig(cfg *RegistryConfig010) error

AddRegistryConfig adds the RegistryConfig to the app spec.

func (*Spec010) Marshal added in v0.13.0

func (s *Spec010) Marshal() ([]byte, error)

Marshal converts a app.Spec into bytes for file writing.

func (*Spec010) RegistryConfig added in v0.13.0

func (s *Spec010) RegistryConfig(name string) (*RegistryConfig010, bool)

RegistryConfig returns a populated RegistryConfig given a registry name.

func (*Spec010) UnmarshalJSON added in v0.13.0

func (s *Spec010) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Spec020 added in v0.13.0

type Spec020 struct {
	APIVersion   string                `json:"apiVersion,omitempty"`
	Kind         string                `json:"kind,omitempty"`
	Name         string                `json:"name,omitempty"`
	Version      string                `json:"version,omitempty"`
	Description  string                `json:"description,omitempty"`
	Authors      []string              `json:"authors,omitempty"`
	Contributors ContributorSpecs020   `json:"contributors,omitempty"`
	Repository   *RepositorySpec020    `json:"repository,omitempty"`
	Bugs         string                `json:"bugs,omitempty"`
	Keywords     []string              `json:"keywords,omitempty"`
	Registries   RegistryConfigs020    `json:"registries,omitempty"`
	Environments EnvironmentConfigs020 `json:"environments,omitempty"`
	Libraries    LibraryConfigs020     `json:"libraries,omitempty"`
	License      string                `json:"license,omitempty"`
}

Spec020 defines all the ksonnet project metadata. This includes details such as the project name, authors, environments, and registries.

func (*Spec020) AddRegistryConfig added in v0.13.0

func (s *Spec020) AddRegistryConfig(cfg *RegistryConfig020) error

AddRegistryConfig adds the RegistryConfig to the app spec.

func (*Spec020) Marshal added in v0.13.0

func (s *Spec020) Marshal() ([]byte, error)

Marshal converts a app.Spec into bytes for file writing.

func (*Spec020) RegistryConfig added in v0.13.0

func (s *Spec020) RegistryConfig(name string) (*RegistryConfig020, bool)

RegistryConfig returns a populated RegistryConfig given a registry name.

func (*Spec020) UnmarshalJSON added in v0.13.0

func (s *Spec020) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Spec030 added in v0.13.0

type Spec030 struct {
	APIVersion   string                `json:"apiVersion,omitempty"`
	Kind         string                `json:"kind,omitempty"`
	Name         string                `json:"name,omitempty"`
	Version      string                `json:"version,omitempty"`
	Description  string                `json:"description,omitempty"`
	Authors      []string              `json:"authors,omitempty"`
	Contributors ContributorSpecs030   `json:"contributors,omitempty"`
	Repository   *RepositorySpec030    `json:"repository,omitempty"`
	Bugs         string                `json:"bugs,omitempty"`
	Keywords     []string              `json:"keywords,omitempty"`
	Registries   RegistryConfigs030    `json:"registries,omitempty"`
	Environments EnvironmentConfigs030 `json:"environments,omitempty"`
	Libraries    LibraryConfigs030     `json:"libraries,omitempty"`
	License      string                `json:"license,omitempty"`
}

Spec030 defines all the ksonnet project metadata. This includes details such as the project name, authors, environments, and registries.

func (*Spec030) AddEnvironmentConfig added in v0.13.0

func (s *Spec030) AddEnvironmentConfig(env *EnvironmentConfig030) error

AddEnvironmentConfig adds an EnvironmentConfig to the list of EnvironmentConfigs. This is equivalent to registering the environment for a ksonnet app.

func (*Spec030) AddRegistryConfig added in v0.13.0

func (s *Spec030) AddRegistryConfig(cfg *RegistryConfig030) error

AddRegistryConfig adds the RegistryConfig to the app spec.

func (*Spec030) DeleteEnvironmentConfig added in v0.13.0

func (s *Spec030) DeleteEnvironmentConfig(name string) error

DeleteEnvironmentConfig removes the environment specification from the app spec.

func (*Spec030) GetEnvironmentConfig added in v0.13.0

func (s *Spec030) GetEnvironmentConfig(name string) (*EnvironmentConfig030, bool)

GetEnvironmentConfig returns the environment specification for the environment. TODO: Consider returning copies instead of originals

func (*Spec030) GetEnvironmentConfigs added in v0.13.0

func (s *Spec030) GetEnvironmentConfigs() EnvironmentConfigs

GetEnvironmentConfigs returns all environment specifications. TODO: Consider returning copies instead of originals

func (*Spec030) Marshal added in v0.13.0

func (s *Spec030) Marshal() ([]byte, error)

Marshal converts a app.Spec into bytes for file writing.

func (*Spec030) RegistryConfig added in v0.13.0

func (s *Spec030) RegistryConfig(name string) (*RegistryConfig030, bool)

RegistryConfig returns a populated RegistryConfig given a registry name.

func (*Spec030) UnmarshalJSON added in v0.13.0

func (s *Spec030) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Spec030) UpdateEnvironmentConfig added in v0.13.0

func (s *Spec030) UpdateEnvironmentConfig(name string, env *EnvironmentConfig030) error

UpdateEnvironmentConfig updates the environment with the provided name to the specified spec.

type YAMLEncoder added in v0.11.0

type YAMLEncoder struct{}

YAMLEncoder write items to a serialized form in YAML format.

func (*YAMLEncoder) Encode added in v0.11.0

func (e *YAMLEncoder) Encode(i interface{}, w io.Writer) error

Encode encodes data in yaml format.

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

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