config

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadDeploymentConfig

func ReadDeploymentConfig(reader io.Reader, os string, arch string) (string, error)

func ValidateDeploymentConfig

func ValidateDeploymentConfig(expandedDeploymentConfig string) error

func WriteInfo

func WriteInfo(info *BundleInfo, filePath string)

Types

type BundleConfig

type BundleConfig struct {
	HashDataConfig
	LocalDirectory  string   `json:"LocalDirectory"`
	TargetPlatforms []string `json:"TargetPlatforms,omitempty"`
	Tags            []string `json:"Tags,omitempty"`
}

func FilterBundlesByPlatform

func FilterBundlesByPlatform(bundles []BundleConfig, os string, arch string) []BundleConfig

type BundleInfo

type BundleInfo struct {
	Timestamp        string `json:"Timestamp"`
	UniqueBundleName string `json:"UniqueBundleName"`

	BundleFiles FileInfoMap `json:"BundleFiles"` // Within BundleInfo, keys are filepaths with forward slashes.
}

func ReadInfo

func ReadInfo(filePath string) *BundleInfo

func ReadInfoFromByteSlice

func ReadInfoFromByteSlice(data []byte) *BundleInfo

func ReadInfoFromReader

func ReadInfoFromReader(reader *strings.Reader) *BundleInfo

func (*BundleInfo) GetFileHashes

func (info *BundleInfo) GetFileHashes() FileInfoMap

GetFileHashes returns a FileInfoMap for the info's BundleFiles using filepath.Separator in the place of forward slashes.

type Command

type Command struct {
	Name                       string             `json:"Name"`
	WorkingDirectoryBundleName string             `json:"WorkingDirectoryBundleName,omitempty"`
	Arguments                  []string           `json:"Arguments,omitempty"`
	Env                        map[string]*string `json:"Env,omitempty"`
	TargetPlatforms            []string           `json:"TargetPlatforms,omitempty"`
}

func FilterCommandsByPlatform

func FilterCommandsByPlatform(commands []Command, os string, arch string) []Command

type DeploymentConfig

type DeploymentConfig struct {
	Timestamp      string                 `json:"Timestamp,omitempty"`
	LauncherUpdate []LauncherUpdateConfig `json:"LauncherUpdate,omitempty"`
	Bundles        []BundleConfig         `json:"Bundles,omitempty"`
	Execution      ExecutionConfig        `json:"Execution,omitempty"`
}

func ParseDeploymentConfig

func ParseDeploymentConfig(reader io.Reader, os string, arch string) (deploymentConfig *DeploymentConfig)

func (*DeploymentConfig) GetLauncherUpdateConfig

func (dc *DeploymentConfig) GetLauncherUpdateConfig() *LauncherUpdateConfig

func (*DeploymentConfig) HasLauncherUpdateConfig

func (dc *DeploymentConfig) HasLauncherUpdateConfig() bool

type ExecutionConfig

type ExecutionConfig struct {
	Commands               []Command `json:"Commands,omitempty"`
	LingerTimeMilliseconds int       `json:"LingerTimeMilliseconds,omitempty"`
}

type FileInfo

type FileInfo struct {
	SHA256 string `json:"SHA256"`
	Size   int64  `json:"Size"`
}

type FileInfoMap

type FileInfoMap map[string]*FileInfo

func MakeDiffFileInfoMap

func MakeDiffFileInfoMap(have FileInfoMap, want FileInfoMap) FileInfoMap

Returns a FileInfoMap which describes the changes from have to want. In the returned FileInfoMap, a key which maps to a *FileInfo with its SHA256-field being non-empty indicates that the file described by the key-string requires an update or is new. A key which maps to a *FileInfo with an empty SHA256-field indicates that the file described by the key-string should be removed.

func NewFileInfoMap

func NewFileInfoMap() FileInfoMap

func (FileInfoMap) DeleteFileCount

func (fm FileInfoMap) DeleteFileCount() uint64

func (FileInfoMap) FilePaths

func (bundleFiles FileInfoMap) FilePaths() []string

func (FileInfoMap) FirstPathElement

func (infoMap FileInfoMap) FirstPathElement(sep rune) (firstElement string)

func (FileInfoMap) ForOS

func (bundleFiles FileInfoMap) ForOS() FileInfoMap

ForOS returns a copy of the FileInfoMap where all keys' forward slashes are replaced by the separator character of the underling operating system.

func (FileInfoMap) HasChanges

func (fm FileInfoMap) HasChanges() bool

func (FileInfoMap) HasUpdates

func (fm FileInfoMap) HasUpdates() bool

func (FileInfoMap) Join

func (fm FileInfoMap) Join(other FileInfoMap)

func (FileInfoMap) MustGetOnly

func (fm FileInfoMap) MustGetOnly() (key string, fileInfo *FileInfo)

func (FileInfoMap) OmitEntriesWithMissingSha

func (bundleFiles FileInfoMap) OmitEntriesWithMissingSha() FileInfoMap

func (FileInfoMap) Prepend

func (bundleFiles FileInfoMap) Prepend(pathElement string, sep rune) FileInfoMap

func (FileInfoMap) StripFirstPathElement

func (infoMap FileInfoMap) StripFirstPathElement(sep rune) FileInfoMap

func (FileInfoMap) UpdateByteCount

func (fm FileInfoMap) UpdateByteCount() uint64

func (FileInfoMap) UpdateFileCount

func (fm FileInfoMap) UpdateFileCount() uint64

func (FileInfoMap) WithForwardSlashes

func (bundleFiles FileInfoMap) WithForwardSlashes() FileInfoMap

WithForwardSlashes returns a copy of the FileInfoMap where all occurrences of os.PathSeparator in the keys are replaced with forward slashes if os.PathSeparator is not already the forward slash.

type HashDataConfig

type HashDataConfig struct {
	BundleInfoURL     string `json:"BundleInfoURL"`
	BaseURL           string `json:"BaseURL,omitempty"`
	IsUpdateMandatory bool   `json:"IsUpdateMandatory,omitempty"`
}

type LauncherConfig

type LauncherConfig struct {
	DeploymentConfigURL            string         `json:"DeploymentConfigURL"`
	VendorName                     string         `json:"VendorName"`
	ProductName                    string         `json:"ProductName"`
	BrandingName                   string         `json:"BrandingName"`
	BrandingNameShort              string         `json:"BrandingNameShort"`
	ReverseDnsProductId            string         `json:"ReverseDnsProductId"`
	ProductVersion                 VersionData    `json:"ProductVersion"`
	BinaryName                     string         `json:"BinaryName"`
	StatusMessages                 StatusMessages `json:"StatusMessages"`
	IgnoreLauncherBundleInfoHashes []string       `json:"IgnoreLauncherBundleInfoHashes"`
}

func ReadLauncherConfigFromReader

func ReadLauncherConfigFromReader(reader io.Reader) (launcherConfig *LauncherConfig)

type LauncherUpdateConfig

type LauncherUpdateConfig struct {
	HashDataConfig
	TargetPlatforms []string `json:"TargetPlatforms,omitempty"`
}

func FilterLauncherUpdatesByPlatform

func FilterLauncherUpdatesByPlatform(launcherUpdates []LauncherUpdateConfig, os string, arch string) []LauncherUpdateConfig

type Platform added in v1.4.0

type Platform struct {
	OS, Arch string
}

func (*Platform) Equals added in v1.4.0

func (p *Platform) Equals(os, arch string) bool

func (*Platform) String added in v1.4.0

func (p *Platform) String() string

type StatusMessages

type StatusMessages struct {
	AcquireLock                   string `json:"AcquireLock"`
	GetDeploymentConfig           string `json:"GetDeploymentConfig"`
	DetermineLocalLauncherVersion string `json:"DetermineLocalLauncherVersion"`
	RetrieveRemoteLauncherVersion string `json:"RetrieveRemoteLauncherVersion"`
	SelfUpdate                    string `json:"SelfUpdate"`
	DetermineLocalBundleVersions  string `json:"DetermineLocalBundleVersions"`
	RetrieveRemoteBundleVersions  string `json:"RetrieveRemoteBundleVersions"`
	AwaitApplicationsTerminated   string `json:"AwaitApplicationsTerminated"`
	DownloadBundleUpdates         string `json:"DownloadBundleUpdates"`
	LaunchApplication             string `json:"LaunchApplication"`
}

type VersionData

type VersionData struct {
	Major int `json:"Major"`
	Minor int `json:"Minor"`
	Patch int `json:"Patch"`
	Build int `json:"Build"`
}

Jump to

Keyboard shortcuts

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