config

package
v5.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "atstccfg"
View Source
const ExitCodeBadRequest = 100
View Source
const ExitCodeErrGeneric = 1
View Source
const ExitCodeNotFound = 104
View Source
const ExitCodeSuccess = 0
View Source
const UserAgent = AppName + "/" + Version
View Source
const Version = "0.2"

Variables

View Source
var ErrBadRequest = errors.New("bad request")
View Source
var ErrNotFound = errors.New("not found")

Functions

func ValidateURL

func ValidateURL(u *url.URL) error

Types

type ATSConfigFile

type ATSConfigFile struct {
	Name        string
	Path        string
	Text        string
	ContentType string
	LineComment string
}

type ATSConfigFiles

type ATSConfigFiles []ATSConfigFile

ATSConfigFiles implements sort.Interface and sorts by the Location and then FileNameOnDisk, i.e. the full file path.

func (ATSConfigFiles) Len

func (fs ATSConfigFiles) Len() int

func (ATSConfigFiles) Less

func (fs ATSConfigFiles) Less(i, j int) bool

func (ATSConfigFiles) Swap

func (fs ATSConfigFiles) Swap(i, j int)

type Cfg

type Cfg struct {
	CacheHostName   string
	DisableProxy    bool
	GetData         string
	ListPlugins     bool
	LogLocationErr  string
	LogLocationInfo string
	LogLocationWarn string
	NumRetries      int
	RevalOnly       bool
	SetQueueStatus  string
	SetRevalStatus  string
	TOInsecure      bool
	TOPass          string
	TOTimeout       time.Duration
	TOURL           *url.URL
	TOUser          string
	Dir             string
}

func GetCfg

func GetCfg() (Cfg, error)

GetCfg gets the application configuration, from arguments and environment variables.

func (Cfg) DebugLog

func (cfg Cfg) DebugLog() log.LogLocation

func (Cfg) ErrorLog

func (cfg Cfg) ErrorLog() log.LogLocation

func (Cfg) EventLog

func (cfg Cfg) EventLog() log.LogLocation

func (Cfg) InfoLog

func (cfg Cfg) InfoLog() log.LogLocation

func (Cfg) WarningLog

func (cfg Cfg) WarningLog() log.LogLocation

type TCCfg

type TCCfg struct {
	Cfg
	TOClient    *toreq.TOClient
	TOClientNew *toreqnew.TOClient
}

type TOData

type TOData struct {
	// Servers must be all the servers from Traffic Ops. May include servers not on the current cdn.
	Servers []atscfg.Server

	// CacheGroups must be all cachegroups in Traffic Ops with Servers on the current server's cdn. May also include CacheGroups without servers on the current cdn.
	CacheGroups []tc.CacheGroupNullable

	// GlobalParams must be all Parameters in Traffic Ops on the tc.GlobalProfileName Profile. Must not include other parameters.
	GlobalParams []tc.Parameter

	// ServerParams must be all Parameters on the Profile of the current server. Must not include other Parameters.
	ServerParams []tc.Parameter

	// CacheKeyParams must be all Parameters with the ConfigFile atscfg.CacheKeyParameterConfigFile.
	CacheKeyParams []tc.Parameter

	// ParentConfigParams must be all Parameters with the ConfigFile "parent.config.
	ParentConfigParams []tc.Parameter

	// DeliveryServices must include all Delivery Services on the current server's cdn, including those not assigned to the server. Must not include delivery services on other cdns.
	DeliveryServices []atscfg.DeliveryService

	// DeliveryServiceServers must include all delivery service servers in Traffic Ops for all delivery services on the current cdn, including those not assigned to the current server.
	DeliveryServiceServers []tc.DeliveryServiceServer

	// Server must be the server we're fetching configs from
	Server *atscfg.Server

	// Jobs must be all Jobs on the server's CDN. May include jobs on other CDNs.
	Jobs []tc.Job

	// CDN must be the CDN of the server.
	CDN *tc.CDN

	// DeliveryServiceRegexes must be all regexes on all delivery services on this server's cdn.
	DeliveryServiceRegexes []tc.DeliveryServiceRegexes

	// Profile must be the Profile of the server being requested.
	Profile tc.Profile

	// URISigningKeys must be a map of every delivery service which is URI Signed, to its keys.
	URISigningKeys map[tc.DeliveryServiceName][]byte

	// URLSigKeys must be a map of every delivery service which uses URL Sig, to its keys.
	URLSigKeys map[tc.DeliveryServiceName]tc.URLSigKeys

	// ServerCapabilities must be a map of all server IDs on this server's CDN, to a set of their capabilities. May also include servers from other cdns.
	ServerCapabilities map[int]map[atscfg.ServerCapability]struct{}

	// DSRequiredCapabilities must be a map of all delivery service IDs on this server's CDN, to a set of their required capabilities. Delivery Services with no required capabilities may not have an entry in the map.
	DSRequiredCapabilities map[int]map[atscfg.ServerCapability]struct{}

	// SSLKeys must be all the ssl keys for the server's cdn.
	SSLKeys []tc.CDNSSLKeys

	// Topologies must be all the topologies for the server's cdn.
	// May incude topologies of other cdns.
	Topologies []tc.Topology
}

TOData is the Traffic Ops data needed to generate configs. See each field for details on the data required.

  • If a field says 'must', the creation of TOData is guaranteed to do so, and users of the struct may rely on that.
  • If it says 'may', the creation may or may not do so, and therefore users of the struct must filter if they require the potential fields to be omitted to generate correctly.

Jump to

Keyboard shortcuts

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