config

package
v0.0.0-...-7db3de3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config manages configuration parameters. It manages the configuration for the Windows Agent so that only a single config file needs to exist.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config manages configuration parameters. It is a wrapper around a dictionary that reads and updates the config file.

func New

func New(ctx context.Context, cachePath string) (m *Config)

New creates and initializes a new Config object.

func (*Config) LandscapeAgentUID

func (c *Config) LandscapeAgentUID() (string, error)

LandscapeAgentUID returns the UID assigned to this agent by the Landscape server. An empty string is returned if no UID has been assigned.

func (*Config) LandscapeClientConfig

func (c *Config) LandscapeClientConfig() (string, Source, error)

LandscapeClientConfig returns the value of the landscape server URL and the method it was acquired with (if any).

func (*Config) SetLandscapeAgentUID

func (c *Config) SetLandscapeAgentUID(uid string) error

SetLandscapeAgentUID overrides the Landscape agent UID.

func (*Config) SetLandscapeNotifier

func (c *Config) SetLandscapeNotifier(notify LandscapeNotifier)

SetLandscapeNotifier sets the function to be called when the Landscape configuration changes.

func (*Config) SetStoreSubscription

func (c *Config) SetStoreSubscription(ctx context.Context, proToken string) (err error)

SetStoreSubscription overwrites the value of the store-provided Ubuntu Pro token.

func (*Config) SetUbuntuProNotifier

func (c *Config) SetUbuntuProNotifier(notify UbuntuProNotifier)

SetUbuntuProNotifier sets the function to be called when the Ubuntu Pro subscription changes.

func (*Config) SetUserLandscapeConfig

func (c *Config) SetUserLandscapeConfig(ctx context.Context, landscapeConfig string) error

SetUserLandscapeConfig overwrites the value of the user-provided Landscape configuration.

func (*Config) SetUserSubscription

func (c *Config) SetUserSubscription(ctx context.Context, proToken string) (err error)

SetUserSubscription overwrites the value of the user-provided Ubuntu Pro token.

func (*Config) Subscription

func (c *Config) Subscription() (token string, source Source, err error)

Subscription returns the ProToken and the method it was acquired with (if any).

func (*Config) UpdateRegistryData

func (c *Config) UpdateRegistryData(ctx context.Context, data RegistryData, db *database.DistroDB) (err error)

UpdateRegistryData takes in data from the registry and applies it as necessary.

type LandscapeNotifier

type LandscapeNotifier func(ctx context.Context, config string, uid string)

LandscapeNotifier is a function that is called when the Landscape configuration changes.

type RegistryData

type RegistryData struct {
	UbuntuProToken, LandscapeConfig string
}

RegistryData contains the data that the Ubuntu Pro registry key can provide.

type Source

type Source int

Source indicates the method a configuration parameter was acquired.

const (
	// SourceNone -> no data.
	SourceNone Source = iota

	// SourceUser -> the data was introduced by the user.
	SourceUser

	// SourceMicrosoftStore -> the data was acquired via the Microsoft Store.
	SourceMicrosoftStore

	// SourceRegistry -> the data was obtained from the registry.
	SourceRegistry
)

config Source types.

type UbuntuProNotifier

type UbuntuProNotifier func(ctx context.Context, token string)

UbuntuProNotifier is a function that is called when the Ubuntu Pro subscription changes.

Jump to

Keyboard shortcuts

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