configset_json

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalYAML

func MarshalYAML(cs configset.ConfigSet) ([]byte, error)

MarshalYAML marshals a config set to yaml.

func UnmarshalYAML

func UnmarshalYAML(
	ctx context.Context,
	b bus.Bus,
	data []byte,
	ocs configset.ConfigSet,
	overwriteExisting bool,
) ([]string, error)

UnmarshalYAML unmarshals a yaml to a config set, optionally overwriting existing.

Returns all added configs.

Types

type Config

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

Config implements the JSON unmarshaling and marshaling logic for a configset Config.

func NewConfig added in v0.8.7

func NewConfig(c config.Config) *Config

NewConfig constructs a new Config for JSON marshaling.

func NewConfigWithJSON added in v0.8.7

func NewConfigWithJSON(data string) *Config

NewConfigWithJSON returns a Config object for JSON parsing.

func (*Config) GetConfig

func (c *Config) GetConfig() config.Config

GetConfig returns the underlying config after Resolve.

func (*Config) MarshalJSON

func (c *Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals a controller config JSON blob.

func (*Config) Resolve

func (c *Config) Resolve(ctx context.Context, configID string, b bus.Bus) error

Resolve constructs the underlying config from the pending parse data.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a controller config JSON blob pushing the data into the pending parse buffer.

type ConfigSet

type ConfigSet map[string]*ControllerConfig

ConfigSet implements the JSON unmarshaling logic for a configset.

func NewConfigSet

func NewConfigSet(c configset.ConfigSet) ConfigSet

NewConfigSet constructs a new ConfigSet.

func (ConfigSet) Resolve

func (c ConfigSet) Resolve(ctx context.Context, b bus.Bus) (configset.ConfigSet, error)

Resolve just resolves a configset to a configset.ConfigSet.

type ControllerConfig

type ControllerConfig struct {
	// Revision is the revision number.
	Revision uint64 `json:"revision,omitempty"`
	// Id is the configuration ID.
	Id string `json:"id"`
	// Config is the configuration object.
	Config *Config `json:"config"`
}

ControllerConfig implements the JSON unmarshaling logic for a configset ControllerConfig.

func NewControllerConfig

func NewControllerConfig(c configset.ControllerConfig) *ControllerConfig

NewControllerConfig builds a new controller config.

func UnmarshalControllerConfigYAML added in v0.15.0

func UnmarshalControllerConfigYAML(data []byte) (*ControllerConfig, error)

UnmarshalControllerConfigYAML unmarshals a yaml to a ControllerConfig.

func (*ControllerConfig) GetRevision

func (c *ControllerConfig) GetRevision() uint64

GetRevision returns the revision.

func (*ControllerConfig) Resolve

Resolve resolves the config into a configset.ControllerConfig

Jump to

Keyboard shortcuts

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