Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRegistered ¶
IsRegistered returns true if the given version has been registered through Register
Types ¶
type Config ¶
type Config interface {
// GetVersion returns the current project version.
GetVersion() Version
// GetDomain returns the project domain.
GetDomain() string
// SetDomain sets the project domain.
SetDomain(domain string) error
// GetRepository returns the project repository.
GetRepository() string
// SetRepository sets the project repository.
SetRepository(repository string) error
// GetProjectName returns the project name.
// This method was introduced in project version 3.
GetProjectName() string
// SetProjectName sets the project name.
// This method was introduced in project version 3.
SetProjectName(name string) error
// GetPluginChain returns the plugin chain.
// This method was introduced in project version 3.
GetPluginChain() []string
// SetPluginChain sets the plugin chain.
// This method was introduced in project version 3.
SetPluginChain(pluginChain []string) error
// IsMultiGroup checks if multi-group is enabled.
IsMultiGroup() bool
// SetMultiGroup enables multi-group.
SetMultiGroup() error
// ClearMultiGroup disables multi-group.
ClearMultiGroup() error
// ResourcesLength returns the number of tracked resources.
ResourcesLength() int
// HasResource checks if the provided GVK is stored in the Config.
HasResource(gvk resource.GVK) bool
// GetResource returns the stored resource matching the provided GVK.
GetResource(gvk resource.GVK) (resource.Resource, error)
// GetResources returns all the stored resources.
GetResources() ([]resource.Resource, error)
// AddResource adds the provided resource if it was not present, no-op if it was already present.
AddResource(res resource.Resource) error
// UpdateResource adds the provided resource if it was not present, modifies it if it was already present.
UpdateResource(res resource.Resource) error
// HasGroup checks if the provided group is the same as any of the tracked resources.
HasGroup(group string) bool
// ListCRDVersions returns a list of the CRD versions in use by the tracked resources.
ListCRDVersions() []string
// ListWebhookVersions returns a list of the webhook versions in use by the tracked resources.
ListWebhookVersions() []string
// DecodePluginConfig decodes a plugin config stored in Config into configObj, which must be a pointer.
// This method is intended to be used for custom configuration objects, which were introduced in project version 3.
DecodePluginConfig(key string, configObj interface{}) error
// EncodePluginConfig encodes a config object into Config by overwriting the existing object stored under key.
// This method is intended to be used for custom configuration objects, which were introduced in project version 3.
EncodePluginConfig(key string, configObj interface{}) error
// Marshal returns the YAML representation of the Config.
MarshalYAML() ([]byte, error)
// Unmarshal loads the Config fields from its YAML representation.
UnmarshalYAML([]byte) error
}
Config defines the interface that project configuration types must follow.
type MarshalError ¶
type MarshalError struct {
Err error
}
MarshalError is returned by Config.Marshal when something went wrong while marshalling to YAML
func (MarshalError) Unwrap ¶
func (e MarshalError) Unwrap() error
Unwrap implements Wrapper interface
type PluginKeyNotFoundError ¶
type PluginKeyNotFoundError struct {
Key string
}
PluginKeyNotFoundError is returned by Config.DecodePluginConfig when the provided key cannot be found
func (PluginKeyNotFoundError) Error ¶
func (e PluginKeyNotFoundError) Error() string
Error implements error interface
type ResourceNotFoundError ¶
ResourceNotFoundError is returned by Config.GetResource when the provided GVK cannot be found
func (ResourceNotFoundError) Error ¶
func (e ResourceNotFoundError) Error() string
Error implements error interface
type UnmarshalError ¶
type UnmarshalError struct {
Err error
}
UnmarshalError is returned by Config.Unmarshal when something went wrong while unmarshalling from YAML
func (UnmarshalError) Error ¶
func (e UnmarshalError) Error() string
Error implements error interface
func (UnmarshalError) Unwrap ¶
func (e UnmarshalError) Unwrap() error
Unwrap implements Wrapper interface
type UnsupportedFieldError ¶
UnsupportedFieldError is returned when a project configuration version does not support one of the fields as interface must be common for all the versions
func (UnsupportedFieldError) Error ¶
func (e UnsupportedFieldError) Error() string
Error implements error interface
type UnsupportedVersionError ¶
type UnsupportedVersionError struct {
Version Version
}
UnsupportedVersionError is returned by New when a project configuration version is not supported.
func (UnsupportedVersionError) Error ¶
func (e UnsupportedVersionError) Error() string
Error implements error interface
type Version ¶
type Version struct {
// Number denotes the current version of a plugin. Two different numbers between versions
// indicate that they are incompatible.
Number int
// Stage indicates stability.
Stage stage.Stage
}
Version is a project version containing a non-zero positive integer and a stage value that represents stability.
func (Version) MarshalJSON ¶
MarshalJSON implements json.Marshaller
func (*Version) Parse ¶
Parse parses version inline, assuming it adheres to format: [1-9][0-9]*(-(alpha|beta))?
func (*Version) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller