configset_json

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 9 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 JSON unmarshaling and marshaling logic.

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 {
	// Rev is the revision number.
	Rev uint64 `json:"rev,omitempty"`
	// Id is the configuration ID.
	Id string `json:"id"`
	// Config is the configuration object.
	Config *Config `json:"config,omitempty"`
}

ControllerConfig implements the JSON unmarshaling logic.

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) GetRev added in v0.26.0

func (c *ControllerConfig) GetRev() uint64

GetRev 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