Documentation
¶
Index ¶
- Constants
- Variables
- func ContainsDoguWithName(dogus []*Dogu, name string) bool
- func GetContentOfFile(path string) (string, error)
- func GetNamespace(fullDoguName string) string
- func GetSimpleDoguName(fullDoguName string) string
- func PrintDogus(dogus []*Dogu, ns bool)
- func ReadDoguFromFile(filePath string) (*Dogu, DoguApiVersion, error)
- func ReadDoguFromString(content string) (*Dogu, DoguApiVersion, error)
- func ReadDogusFromFile(filePath string) ([]*Dogu, DoguApiVersion, error)
- func ReadDogusFromString(content string) ([]*Dogu, DoguApiVersion, error)
- func WriteDoguToFile(filePath string, dogu *Dogu) error
- func WriteDoguToFileWithFormat(filePath string, dogu *Dogu, formatProvider DoguFormatProvider) error
- func WriteDoguToString(dogu *Dogu) (string, error)
- func WriteDogusToFile(filePath string, dogus []*Dogu) error
- func WriteDogusToFileWithFormat(filePath string, dogus []*Dogu, formatProvider DoguFormatProvider) error
- func WriteDogusToString(dogus []*Dogu) (string, error)
- type ByDoguVersion
- type ByVersion
- type ConfigurationField
- type Credentials
- type Dependency
- type Dogu
- func (d *Dogu) CreateV1Copy() DoguV1
- func (d *Dogu) DependsOn(name string) bool
- func (d *Dogu) GetAllDependenciesOfType(dependencyType string) []Dependency
- func (d *Dogu) GetDependenciesOfType(dependencyType string) []Dependency
- func (d *Dogu) GetEnvironmentVariables() []EnvironmentVariable
- func (d *Dogu) GetEnvironmentVariablesAsStringArray() []string
- func (d *Dogu) GetExposedCommand(commandName string) *ExposedCommand
- func (d *Dogu) GetFullName() string
- func (d *Dogu) GetImageName() string
- func (d *Dogu) GetNamespace() string
- func (d *Dogu) GetOptionalDependenciesOfType(dependencyType string) []Dependency
- func (d *Dogu) GetRegistryServerURI() string
- func (d *Dogu) GetSimpleName() string
- func (d *Dogu) GetVersion() (Version, error)
- func (d *Dogu) HasExposedCommand(commandName string) bool
- func (d *Dogu) IsEqualTo(otherDogu *Dogu) (bool, error)
- func (d *Dogu) IsNewerThan(otherDogu *Dogu) (bool, error)
- type DoguApiVersion
- type DoguFormatHandler
- type DoguFormatProvider
- type DoguJsonV1FormatProvider
- func (d *DoguJsonV1FormatProvider) GetVersion() DoguApiVersion
- func (d *DoguJsonV1FormatProvider) ReadDoguFromString(content string) (*Dogu, error)
- func (d *DoguJsonV1FormatProvider) ReadDogusFromString(content string) ([]*Dogu, error)
- func (d *DoguJsonV1FormatProvider) WriteDoguToString(doguV2 *Dogu) (string, error)
- func (d *DoguJsonV1FormatProvider) WriteDogusToString(doguV2List []*Dogu) (string, error)
- type DoguJsonV2FormatProvider
- func (d *DoguJsonV2FormatProvider) GetVersion() DoguApiVersion
- func (d *DoguJsonV2FormatProvider) ReadDoguFromString(content string) (*Dogu, error)
- func (d *DoguJsonV2FormatProvider) ReadDogusFromString(content string) ([]*Dogu, error)
- func (d *DoguJsonV2FormatProvider) WriteDoguToString(dogu *Dogu) (string, error)
- func (d *DoguJsonV2FormatProvider) WriteDogusToString(dogu []*Dogu) (string, error)
- type DoguV1deprecated
- type EnvironmentVariable
- type ExposedCommand
- type ExposedPort
- type HealthCheck
- type Properties
- type ProxySettings
- type Registry
- type Remote
- type ServiceAccount
- type ValidationDescriptor
- type Version
- type VersionComparator
- type Volume
Constants ¶
const ( ExposedCommandServiceAccountCreate = "service-account-create" ExposedCommandServiceAccountRemove = "service-account-remove" ExposedCommandBackupConsumer = "backup-consumer" ExposedCommandPreBackup = "pre-backup" ExposedCommandPostBackup = "post-backup" ExposedCommandPostUpgrade = "post-upgrade" ExposedCommandPreUpgrade = "pre-upgrade" ExposedCommandUpgradeNotification = "upgrade-notification" )
Names for ExposedCommands correspond with actual dogu descriptor instance values. Do not change because these come with side effects.
const ( DependencyTypeDogu = "dogu" DependencyTypeClient = "client" DependencyTypePackage = "package" )
Contains the different kind of types supported by dogu dependencies
Variables ¶
var GetLogger = func() logrus.FieldLogger { return logrus.StandardLogger() }
GetLogger is an alias function to provide a different logger for the core.
Functions ¶
func ContainsDoguWithName ¶
ContainsDoguWithName checks if a dogu is contained in a slice by comparing the full name (including namespace)
func GetContentOfFile ¶
GetContentOfFile all content of the file at the given path and returns it as string
func GetNamespace ¶
GetNamespace returns a dogu's namespace.
func GetSimpleDoguName ¶
GetSimpleDoguName returns the dogu name without its namespace.
func PrintDogus ¶
PrintDogus prints out dogu name, version, display name and description in a table
func ReadDoguFromFile ¶
func ReadDoguFromFile(filePath string) (*Dogu, DoguApiVersion, error)
ReadDoguFromFile reads a single dogu from a file and returns it along with a dogu API version.
func ReadDoguFromString ¶
func ReadDoguFromString(content string) (*Dogu, DoguApiVersion, error)
ReadDoguFromString reads a dogu from a string and returns it along with a dogu API version.
func ReadDogusFromFile ¶
func ReadDogusFromFile(filePath string) ([]*Dogu, DoguApiVersion, error)
ReadDogusFromFile reads all dogus from a given file and returns them along with a their dogu API version.
func ReadDogusFromString ¶
func ReadDogusFromString(content string) ([]*Dogu, DoguApiVersion, error)
ReadDogusFromString reads multiple dogus from a string and returns them along with a dogu API version.
func WriteDoguToFile ¶
WriteDoguToFile writes the dogu to the given file. Uses the default format (first registered).
func WriteDoguToFileWithFormat ¶
func WriteDoguToFileWithFormat(filePath string, dogu *Dogu, formatProvider DoguFormatProvider) error
WriteDoguToFileWithFormat writes the dogu to the given file using a specified format.
func WriteDoguToString ¶
WriteDoguToString writes the dogu and return the string representation of the specified format.
func WriteDogusToFile ¶
WriteDogusToFile writes all dogus to the given file. Uses the default format (first registered).
func WriteDogusToFileWithFormat ¶
func WriteDogusToFileWithFormat(filePath string, dogus []*Dogu, formatProvider DoguFormatProvider) error
WriteDogusToFileWithFormat writes all dogus to the given file using a specified format.
func WriteDogusToString ¶
WriteDogusToString writes all dogus and return the string representation of the specified format.
Types ¶
type ByDoguVersion ¶
type ByDoguVersion []*Dogu
ByDoguVersion implements sort.Interface for []Dogu to Dogus by their versions
func (ByDoguVersion) Len ¶
func (doguVersions ByDoguVersion) Len() int
Len is the number of elements in the collection.
func (ByDoguVersion) Less ¶
func (doguVersions ByDoguVersion) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (ByDoguVersion) Swap ¶
func (doguVersions ByDoguVersion) Swap(i, j int)
Swap swaps the elements with indexes i and j.
type ByVersion ¶
type ByVersion []Version
ByVersion implements sort.Interface for []Version to sort versions
type ConfigurationField ¶
type ConfigurationField struct {
// Name contains the name of the key. It must not be empty. It must not contain leading or trailing slashes "/", but
// it may contain directory keys delimited with slashes within the name.
Name string
// Description should mention the context and purpose of the config field in human readable format.
Description string
// Optional allows to have this config field unset.
Optional bool
// Encrypted marks this config field to contain a sensitive value that will be encrypted with the dogu's private key.
Encrypted bool
// Global marks this config field to contain a value that is available for all dogus.
Global bool
// Default defines a default value that may be evaluated if no value was configured, or the vallue is empty or even invalid.
Default string
// Validation configures a Validator that will be used to validate this config field.
Validation ValidationDescriptor
}
ConfigurationField describes a field of the dogu configuration which is stored in the registry.
type Credentials ¶
Credentials for a remote system
type Dependency ¶
type Dependency struct {
Type string `json:"type"`
Name string `json:"name"`
Version string `json:"version"`
}
Dependency contains the dependencies of the application and all their necessary information.
type Dogu ¶
type Dogu struct {
Name string
Version string
DisplayName string
Description string
Category string
Tags []string
Logo string
URL string
Image string
ExposedPorts []ExposedPort
ExposedCommands []ExposedCommand
Volumes []Volume
HealthCheck HealthCheck // deprecated use HealthChecks
HealthChecks []HealthCheck
ServiceAccounts []ServiceAccount
Privileged bool
Configuration []ConfigurationField
Properties Properties
EnvironmentVariables []EnvironmentVariable
Dependencies []Dependency
OptionalDependencies []Dependency
}
Dogu defines an application for the CES. A dogu defines the image and meta information for the resulting container.
func SortDogusByDependency ¶
SortDogusByDependency takes an unsorted slice of Dogu structs and returns a slice of Dogus ordered by the importance of their dependencies descending, that is: the most needed dogu will be the first element.
func SortDogusByInvertedDependency ¶
SortDogusByInvertedDependency takes an unsorted slice of Dogu structs and returns a new slice of Dogus ordered by the importance of their dependencies ascending, that is: the most independent dogu will be the first element.
func SortDogusByName ¶
SortDogusByName takes an unsorted slice of Dogus and returns an copy of the slice ordered by the full name of the dogu
func (*Dogu) CreateV1Copy ¶
CreateV1Copy converts this dogu object into a deep-copied DoguV1 object (for legacy reasons).
func (*Dogu) GetAllDependenciesOfType ¶
func (d *Dogu) GetAllDependenciesOfType(dependencyType string) []Dependency
GetAllDependenciesOfType returns all dependencies in accordance to the given dependency type.
func (*Dogu) GetDependenciesOfType ¶
func (d *Dogu) GetDependenciesOfType(dependencyType string) []Dependency
GetDependenciesOfType returns all dependencies in accordance to the given dependency type.
func (*Dogu) GetEnvironmentVariables ¶
func (d *Dogu) GetEnvironmentVariables() []EnvironmentVariable
GetEnvironmentVariables returns environment variables formatted as array of key value objects
func (*Dogu) GetEnvironmentVariablesAsStringArray ¶
GetEnvironmentVariablesAsStringArray returns environment variables formatted as string array
func (*Dogu) GetExposedCommand ¶
func (d *Dogu) GetExposedCommand(commandName string) *ExposedCommand
GetExposedCommand returns a ExposedCommand for a given command name if it exists. Otherwise it returns nil. To test if a dogu has a command with a given command name use the HasExposedCommand method:
if dogu.HasExposedCommand(commandName) { doSomething() }
func (*Dogu) GetFullName ¶
GetFullName returns the name of the dogu including its namespace
func (*Dogu) GetImageName ¶
GetImageName returns the name of the docker image
func (*Dogu) GetNamespace ¶
GetNamespace returns the namespace of the dogu without the name
func (*Dogu) GetOptionalDependenciesOfType ¶
func (d *Dogu) GetOptionalDependenciesOfType(dependencyType string) []Dependency
GetOptionalDependenciesOfType returns all optional dependencies in accordance to the given dependency type.
func (*Dogu) GetRegistryServerURI ¶
GetRegistryServerURI returns the name of the docker registry which is used by this dogu
func (*Dogu) GetSimpleName ¶
GetSimpleName returns the name of the dogu without the namespace
func (*Dogu) GetVersion ¶
GetVersion parses the dogu version and returns a struct which can be used to compare versions
func (*Dogu) HasExposedCommand ¶
HasExposedCommand checks if the dogu is a provider of a given command name. Example see constants like ExposedCommandServiceAccountCreate
type DoguApiVersion ¶
type DoguApiVersion int
DoguApiVersion contains the Dog API version as integer starting with 1 (which is deprecated).
const ( DoguApiVersionUnknown DoguApiVersion = 0 DoguApiV1 DoguApiVersion = 1 DoguApiV2 DoguApiVersion = 2 )
type DoguFormatHandler ¶
type DoguFormatHandler struct {
Providers []DoguFormatProvider
}
DoguFormatHandler is responsible for reading and writing dogus in different formats.
func (*DoguFormatHandler) GetFormatProviders ¶
func (d *DoguFormatHandler) GetFormatProviders() []DoguFormatProvider
GetFormatProviders returns the list or registered format providers.
func (*DoguFormatHandler) RegisterFormatProvider ¶
func (d *DoguFormatHandler) RegisterFormatProvider(provider DoguFormatProvider)
RegisterFormatProvider adds a new dogu format provider to the format manager.
type DoguFormatProvider ¶
type DoguFormatProvider interface {
// ReadDoguFromString reads a dogu from the given filePath and returns an instance of a dogu.
ReadDoguFromString(content string) (*Dogu, error)
// ReadDogusFromString reads multiple dogus from the given filePath and returns a slice of dogu instances.
ReadDogusFromString(content string) ([]*Dogu, error)
// WriteDoguToString converts the given dogu to string representation and returns it.
WriteDoguToString(dogu *Dogu) (string, error)
// WriteDogusToString converts the given dogus to string representation and returns it.
WriteDogusToString(dogu []*Dogu) (string, error)
// GetVersion returns the api version which is used for this format provider.
GetVersion() DoguApiVersion
}
type DoguJsonV1FormatProvider ¶
type DoguJsonV1FormatProvider struct{}
DoguJsonV1FormatProvider provides methods to format Dogu results compatible to v1 API.
func (*DoguJsonV1FormatProvider) GetVersion ¶
func (d *DoguJsonV1FormatProvider) GetVersion() DoguApiVersion
GetVersion returns DoguApiV1 for this implementation.
func (*DoguJsonV1FormatProvider) ReadDoguFromString ¶
func (d *DoguJsonV1FormatProvider) ReadDoguFromString(content string) (*Dogu, error)
ReadDoguFromString reads a dogu from a string and returns the API v1 representation.
func (*DoguJsonV1FormatProvider) ReadDogusFromString ¶
func (d *DoguJsonV1FormatProvider) ReadDogusFromString(content string) ([]*Dogu, error)
ReadDogusFromString reads multiple dogus from a string and returns the API v1 representation.
func (*DoguJsonV1FormatProvider) WriteDoguToString ¶
func (d *DoguJsonV1FormatProvider) WriteDoguToString(doguV2 *Dogu) (string, error)
WriteDoguToString receives a single dogu and returns the API v1 representation.
func (*DoguJsonV1FormatProvider) WriteDogusToString ¶
func (d *DoguJsonV1FormatProvider) WriteDogusToString(doguV2List []*Dogu) (string, error)
WriteDogusToString receives a list of dogus and returns the API v1 representation.
type DoguJsonV2FormatProvider ¶
type DoguJsonV2FormatProvider struct{}
DoguJsonV2FormatProvider provides methods to format Dogu results compatible to v2 API.
func (*DoguJsonV2FormatProvider) GetVersion ¶
func (d *DoguJsonV2FormatProvider) GetVersion() DoguApiVersion
GetVersion returns DoguApiV2 for this implementation.
func (*DoguJsonV2FormatProvider) ReadDoguFromString ¶
func (d *DoguJsonV2FormatProvider) ReadDoguFromString(content string) (*Dogu, error)
ReadDoguFromString reads a dogu from a string and returns the API v2 representation.
func (*DoguJsonV2FormatProvider) ReadDogusFromString ¶
func (d *DoguJsonV2FormatProvider) ReadDogusFromString(content string) ([]*Dogu, error)
ReadDogusFromString reads multiple dogus from a string and returns the API v2 representation.
func (*DoguJsonV2FormatProvider) WriteDoguToString ¶
func (d *DoguJsonV2FormatProvider) WriteDoguToString(dogu *Dogu) (string, error)
WriteDoguToString receives a single dogu and returns the API v2 representation.
func (*DoguJsonV2FormatProvider) WriteDogusToString ¶
func (d *DoguJsonV2FormatProvider) WriteDogusToString(dogu []*Dogu) (string, error)
WriteDogusToString receives a list of dogus and returns the API v2 representation.
type DoguV1
deprecated
type DoguV1 struct {
Name string
Version string
DisplayName string
Description string
Category string
Tags []string
Logo string
URL string
Image string
ExposedPorts []ExposedPort
ExposedCommands []ExposedCommand
Volumes []Volume
HealthCheck HealthCheck // deprecated use HealthChecks
HealthChecks []HealthCheck
ServiceAccounts []ServiceAccount
Privileged bool
Configuration []ConfigurationField
Properties Properties
EnvironmentVariables []EnvironmentVariable
Dependencies []string
OptionalDependencies []string
}
DoguV1 defines an application for the CES. A dogu defines the image and meta information for the resulting container.
Deprecated: This schema is deprecated as it does not contain advanced expressions for dependencies. Please use core.DoguV2 instead.
func (*DoguV1) CreateV2Copy ¶
CreateV2Copy creates a deep DoguV2 copy from an existing DoguV1 object.
type EnvironmentVariable ¶
EnvironmentVariable struct represents custom parameters that can change the behaviour of a dogu build process
func (EnvironmentVariable) String ¶
func (env EnvironmentVariable) String() string
String returns a string representation of this EnvironmentVariable
type ExposedCommand ¶
ExposedCommand struct represents a command which can be executed inside the dogu
type ExposedPort ¶
type ExposedPort struct {
// Type contains the protocol type over which the container communicates (f. i. 'tcp').
Type string
// Container contains the mapped port on side of the container.
Container int
// Host contains the mapped port on side of the host.
Host int
}
ExposedPort struct is used to define ports which are exported to the host
func (*ExposedPort) GetType ¶
func (ep *ExposedPort) GetType() string
GetType returns type of expose port, the default is tcp
type HealthCheck ¶
type HealthCheck struct {
Type string // health check type tcp or state
State string // expected state for state health check, default is ready
Port int // port for tcp state check
Path string // path for http check
Parameters map[string]string // key value pairs for check specific parameters
}
HealthCheck struct will be used to do readyness and health checks for the final container
type Properties ¶
Properties describes generic properties of the dogu.
type ProxySettings ¶
type ProxySettings struct {
Enabled bool
Server string `json:",omitempty"`
Port int `json:",omitempty"`
Username string `json:",omitempty"`
Password string `json:",omitempty"`
}
ProxySettings contains the settings for http proxy
func (ProxySettings) CreateURL ¶
func (proxy ProxySettings) CreateURL() string
CreateURL creates a proxy http url
type Registry ¶
type Registry struct {
Type string `validate:"eq=etcd"`
Endpoints []string `validate:"required,min=1"`
}
Registry contains Cloudogu EcoSystem registration details.
type Remote ¶
type Remote struct {
Endpoint string `validate:"url"`
AuthenticationEndpoint string `validate:"omitempty,url"`
URLSchema string `json:"urlSchema,omitempty" validate:"omitempty,oneof=default index"`
CacheDir string `validate:"required"`
ProxySettings ProxySettings
AnonymousAccess bool `json:",omitempty"`
Insecure bool `json:",omitempty"`
}
Remote contains dogu registry configuration details.
type ServiceAccount ¶
ServiceAccount struct can be used to get access to a other dogu.
type ValidationDescriptor ¶
type ValidationDescriptor struct {
// Type contains the name of the config value validator.
Type string
// Values may contain values that aid the selected validator. It is up to the selected validator whether this field is mandatory, optional, or unused.
Values []string
}
ValidationDescriptor describes how to determine if a config value is valid.
type Version ¶
Version struct can be used to extract single parts of a version number or to compare version with each other. The version struct can with four or less digits, plus an extra version which is divided by a hyphen. For example: 4.0.7.11-3 => 4 Major, 0 Minor, 7 Patch, 11 Nano, 3 Extra
func ParseVersion ¶
ParseVersion parses a raw version string and returns a Version struct
func (*Version) IsEqualTo ¶
IsEqualTo returns true if this version is equal to the given version parameter, otherwise false.
func (*Version) IsNewerOrEqualThan ¶
IsNewerOrEqualThan returns true if this version is newer than the given version parameter
func (*Version) IsNewerThan ¶
IsNewerThan returns true if this version is newer than the given version parameter
func (*Version) IsOlderOrEqualThan ¶
IsOlderOrEqualThan returns true if this version is older or equal than the given version parameter
func (*Version) IsOlderThan ¶
IsOlderThan returns true if this version is older than the given version parameter
type VersionComparator ¶
type VersionComparator struct {
// contains filtered or unexported fields
}
VersionComparator is responsible to compare versions and to check defined constraints.
func ParseVersionComparator ¶
func ParseVersionComparator(raw string) (VersionComparator, error)
ParseVersionComparator creates a new version comparator by parsing a raw version string.
type Volume ¶
Volume is the volume struct of a dogu and will be used to define docker volumes
func (*Volume) UnmarshalJSON ¶
UnmarshalJSON sets the default value for NeedsBackup. We are preventing an infinite loop by using a local Alias type to call json.Unmarshal again