t3cutil

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionLogActionApplyStart is the start of the t3c-apply run.
	// The status of this should always be success.
	ActionLogActionApplyStart = ActionLogAction("apply-start")

	// ActionLogActionGitInit is creating a git repo in the ATS config directory.
	ActionLogActionGitInit = ActionLogAction("git-init")

	// ActionLogActionGitCommitInitial is the initial commit at the start of the run.
	ActionLogActionGitCommitInitial = ActionLogAction("create-git-commit-initial")

	// ActionLogActionGitCommitInitial is the final commit at the end of the run.
	ActionLogActionGitCommitFinal = ActionLogAction("create-git-commit-final")

	// ActionLogActionUpdateFilesAll is writing and updating ATS config files.
	ActionLogActionUpdateFilesAll = ActionLogAction("update-files-all")

	// ActionLogActionUpdateFilesReval is writing and updating only revalidate ATS config files.
	ActionLogActionUpdateFilesReval = ActionLogAction("update-files-reval")

	// ActionLogActionATSReload is calling service reload on ATS.
	ActionLogActionATSReload = ActionLogAction("ats-reload")

	// ActionLogActionATSReload is calling service restart on ATS.
	ActionLogActionATSRestart = ActionLogAction("ats-restart")

	// ActionLogActionApplyEnd is the end of the t3c-apply run.
	ActionLogActionApplyEnd = ActionLogAction("apply-end")
)
View Source
const (
	ActionLogStatusSuccess = ActionLogStatus("success")
	ActionLogStatusFailure = ActionLogStatus("failure")
)
View Source
const ApplyCachePath = `/var/lib/trafficcontrol-cache-config/config-data.json`
View Source
const MetaDataVersion = "1.0"

MetaDataVersion is the version of the metadata file. This should update the major version with breaking changes, and t3c versions should strive to maintain compatibility at least one major version back, so features like tracking t3c-owned files continue to work through upgrades.

View Source
const SystemInfoParamConfigFile = `global`
View Source
const TrafficOpsProxyParameterName = `tm.rev_proxy.url`

Variables

This section is empty.

Functions

func CombineOwnedFilePaths

func CombineOwnedFilePaths(am *ApplyMetaData, bm *ApplyMetaData) []string

CombineOwnedFilePaths combines the owned file paths of two metadata objects.

This is primarily useful when a config run, such as revalidate, adds owned files, but not all owned files, but we don't want to write metadata incidating we don't own existing files, so this can be used to combine the new files with the previous metadata.

Both am and bm are may be nil, in which case the files from the non-nil object is returned, or an empty array if both are nil.

func CommentsFilter

func CommentsFilter(body []string, lineComment string) []string

CommentsFilter is used to remove comment lines from config files while making comparisons.

func Do

func Do(cmdStr string, args ...string) ([]byte, []byte, int)

This is a convenience wrapper around os/exec. Since t3c only needs to make simple calls and get the stdout, stderr, and code, this provides a simpler and terser interface.

If you need anything more complex, or don't find this simpler, you should probably use os/exec directly.

Each arg must be passed as its own string. Unfortunately, Go doesn't have a way to pass multiple args as a single string, and splitting on spaces would require complex quote parsing.

Note each arg must be passed without quotes. Go calls the app with args as if they were quoted. if you add quotes, they'll be passed to the command literally, as if you called 'mycommand "\"escaped-quotes\""`.

Note if Go fails to run the command, the error from Go will be returned as the stderr and the code -1, which will differ from what would have been returned by a command line.

func DoInput

func DoInput(input []byte, cmdStr string, args ...string) ([]byte, []byte, int)

DoInput is like Do but takes the stdin to pass to the command.

func FilterDSS

func FilterDSS(dsses []tc.DeliveryServiceServer, dsIDs map[int]struct{}, serverIDs map[int]struct{}) []tc.DeliveryServiceServer

func FilterParams

func FilterParams(params []tc.Parameter, configFile string, name string, value string, omitName string) []tc.Parameter

FilterParams filters params and returns only the parameters which match configFile, name, and value. If configFile, name, or value is the empty string, it is not filtered. Returns a slice of parameters.

func GetDataFuncs

func GetDataFuncs() map[string]func(TCCfg, io.Writer) error

func GetServerUpdateStatus

func GetServerUpdateStatus(cfg TCCfg) (*atscfg.ServerUpdateStatus, error)

func InstallDir

func InstallDir() string

initializes InstallDir to executable dir If error, returns "/usr/bin" as default.

func MakeReqHdr

func MakeReqHdr(md ReqMetaData) http.Header

func NewLineFilter

func NewLineFilter(str string) string

NewLineFilter removes carriage returns from config files while making comparisons.

func OwnershipCk

func OwnershipCk(path string, uid int, gid int) bool

OwnershipCk will compare owner and group settings against existing file and owner/group settings provided.

func ParamsToMap

func ParamsToMap(params []tc.Parameter) map[string]string

ParamsToMap converts a []tc.Parameter to a map[paramName]paramValue. If multiple params have the same value, the first one in params will be used an an error will be logged. See ParamArrToMultiMap.

func ParamsToMultiMap

func ParamsToMultiMap(params []tc.Parameter) map[string][]string

ParamArrToMultiMap converts a []tc.Parameter to a map[paramName][]paramValue.

func PermCk

func PermCk(path string, perm int) bool

PermCk will compare file permissions against existing file and octal permission provided.

func ReadFile

func ReadFile(f string) []byte

ReadFile reads a file and returns the file contents.

func SetUpdateStatus

func SetUpdateStatus(cfg TCCfg, serverName tc.CacheName, configApply, revalApply *time.Time) error

SetUpdateStatus sets the queue and reval status of serverName in Traffic Ops.

func SetUpdateStatusCompat

func SetUpdateStatusCompat(cfg TCCfg, serverName tc.CacheName, configApply, revalApply *time.Time, configApplyBool, revalApplyBool *bool) error

SetUpdateStatusCompat sets the queue and reval status of serverName in Traffic Ops. *** Compatability requirement until ATC (v7.0+) is deployed with the timestamp features

func UnencodeFilter

func UnencodeFilter(body []string) []string

UnencodeFilter translates HTML escape sequences while making config file comparisons.

func UserAgentStr

func UserAgentStr(appName string, versionNum string, gitRevision string) string

func ValidateURL

func ValidateURL(u *url.URL) error

func VersionStr

func VersionStr(appName string, versionNum string, gitRevision string) string

VersionStr returns a common version string format for all t3c apps. The appName is the command itself, e.g. t3c-apply. The versionNum is the version number from the build system. It should include the major, minor, git revision, and a monotonically increasing number, e.g. '4.2.1234.abc123'.

func WriteActionLog

func WriteActionLog(action ActionLogAction, status ActionLogStatus, metaData *ApplyMetaData)

WriteActionLog writes the given action and status to both the info log and the given metadata object.

The metaData may be nil, and should be if this is being called after the final git commit, to prevent modifying the file after the commit.

func WriteChkconfig

func WriteChkconfig(cfg TCCfg, output io.Writer) error

WriteChkconfig writes the chkconfig for cfg.CacheHostName to output. Note this is identical to /ort/serverName/chkconfig.

func WriteConfig

func WriteConfig(cfg TCCfg, output io.Writer) error

WriteConfig writes the Traffic Ops data necessary to generate config to output.

func WriteData

func WriteData(cfg TCCfg) error

func WritePackages

func WritePackages(cfg TCCfg, output io.Writer) error

WriteORTServerPackages writes the packages for serverName to output. Note this is identical to /ort/serverName/packages.

func WriteServerUpdateStatus

func WriteServerUpdateStatus(cfg TCCfg, output io.Writer) error

WriteServerUpdateStatus writes the Traffic Ops server update status to output. Note this is identical to the Traffic Ops API's /servers/{{host name}}/update_status endpoint except it omits the '[]' wrapper.

func WriteStatuses

func WriteStatuses(cfg TCCfg, output io.Writer) error

WriteStatuses writes the Traffic Ops statuses to output. Note this is identical to /statuses except it omits the '{response:' wrapper.

func WriteSystemInfo

func WriteSystemInfo(cfg TCCfg, output io.Writer) error

WriteSystemInfo writes the "system info" to output.

This is the same info as the Traffic Ops API's /system/info endpoint, which is actually just all Parameters with the config_file 'global'. Note this is different than the more common "global parameters", which usually refers to all Parameters on the Profile named 'GLOBAL'.

This is identical to the /system/info endpoint, except it does not include a

'{response: {parameters:' wrapper.

Types

type ATSConfigFile

type ATSConfigFile struct {
	Name        string   `json:"name"`
	Path        string   `json:"path"`
	ContentType string   `json:"content_type"`
	LineComment string   `json:"line_comment"`
	Secure      bool     `json:"secure"`
	Text        string   `json:"text"`
	Warnings    []string `json:"warnings"`
}

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 ActionLogAction

type ActionLogAction string

ActionLogAction is an action t3c performs which affects the state of the machine. Things that don't affect the state of the machine are not considered actions.

For example, requesting Traffic Ops is not an 'action', but restarting ATS or modifying a config file is.

Actions also include the t3c-apply run starting and finishing, to help delineate the actions of different runs in the log.

type ActionLogStatus

type ActionLogStatus string

type ApplyFilesFlag

type ApplyFilesFlag string
const (
	ApplyFilesFlagInvalid ApplyFilesFlag = ""
	ApplyFilesFlagAll     ApplyFilesFlag = "all"
	ApplyFilesFlagReval   ApplyFilesFlag = "reval"
)

func StrToApplyFilesFlag

func StrToApplyFilesFlag(str string) ApplyFilesFlag

func (ApplyFilesFlag) String

func (ff ApplyFilesFlag) String() string

type ApplyMetaData

type ApplyMetaData struct {
	// Version is the metadata version of this metadata object or file. See MetaDataVersion.
	Version string `json:"version"`

	// ServerFQDN is the FQDN of this server.
	// The primary purpose of this field is to allow distinguishing
	// metadata files from different servers.
	ServerHostName string `json:"server-hostname"`

	// Time is an RFC3339Nano timestamp of the time t3c-apply ran for this metadata.
	// This should be treated as approximate, as it could be the start time, end time, or
	// any inexact time in-between.
	// However, times of different metadata files should always be monotonically increasing.
	Time string `json:"time"`

	// ReloadedATS is whether this run restarted ATS.
	// Note this is whether ATS was actually restarted, not whether it would have been,
	// e.g. because of --report-only or --service-action.
	ReloadedATS bool `json:"reloaded-ats"`

	// RestartedATS is whether this run restarted ATS.
	// Note this is whether ATS was actually restarted, not whether it would have been,
	// e.g. because of --report-only or --service-action.
	RestartedATS bool `json:"restarted-ats"`

	// UnsetUpdateFlag is whether this t3c-apply run unset the update flag for this server.
	// Note this is whether the flag was actually unset, not whether it would have been e.g.
	// because of --no-unset-update-flag or --report-only.
	UnsetUpdateFlag bool `json:"unset-update-flag"`

	// UnsetRevalFlag is whether this t3c-apply run unset the revalidate flag for this server.
	// Note this is whether the flag was actually unset, not whether it would have been e.g.
	// because of --no-unset-reval-flag or --report-only.
	UnsetRevalFlag bool `json:"unset-reval-flag"`

	// InstalledPackages is which yum packages were installed.
	// Note this packages actually installed, not what would have been e.g.
	// because of --install-packages=false or --report-only.
	InstalledPackages []string `json:"installed-packages"`

	// OwnedFilePaths is the list of files t3c-apply produced in this run.
	//
	// This can be used to know which files in the ATS config directory were produced by t3c,
	// and which were produced by some other means.
	//
	// Note this is all files produced, not necessarily all files written to disk. This
	// will include files generated, but not changed on disk because they had no
	// semantic diff from the existing file.
	//
	// This may be used in the future for t3c-apply to delete files produced by a previous
	// run which no longer exist (for example, Header Rewrites from a Delivery Service
	// no longer assigned to this server).
	//
	// Files are the full path and file name.
	OwnedFilePaths []string `json:"owned-files"`

	// Succeeded is whether this t3c-apply run generally succeeded.
	//
	// Note not all scenarios are black or white success-or-fail.
	// For example, files may be successfully created, but reloading ATS may fail.
	// In these scenarios, t3c-apply will attempt to set Succeeded to false,
	// but also attempt to set other metadata about what was actually performed.
	//
	// But when partial failure occurrs, nothing is guaranteed in the metadata.
	// Operators should consider the logs authoritative over the metadata.
	Succeeded bool `json:"succeeded"`

	// PartialSuccess indicates that some actions were successful, but
	// later actions failed.
	//
	// This is a bad place to be, because it means some things were changed,
	// but not everything that needed to be. This is often not fatal, because,
	// for example, if config files were changed by ATS failed to reload,
	// those config files typically needed placed anyway.
	//
	// But nevertheless, partial success is potentially catastrophic, and operators
	// are strongly encouraged to set alarms and read logs in the event it occurs,
	// to determine what was changed, what failed, and what actions need taken.
	PartialSuccess bool `json:"partial-success"`

	Actions []ApplyMetaDataAction `json:"actions"`
}

ApplyMetaData is metadata about a t3c-apply run. Always use NewApplyMetaData, don't use a literal to construct a new object.

func NewApplyMetaData

func NewApplyMetaData() *ApplyMetaData

NewApplyMetaData creates a new, empty ApplyMetaData object.

func (*ApplyMetaData) Format

func (md *ApplyMetaData) Format() ([]byte, error)

Format prints the ApplyMetaData in a format designed to be written to a file, and structured but pretty-printed to work well with line-based diffs (e.g. in git).

func (*ApplyMetaData) SetTime

func (md *ApplyMetaData) SetTime(tm time.Time)

SetTime sets the Time field in the prescribed format, based on the given time. To set to the current time, call SetTime(time.Now()). The format is UTC RFC3339Nano. See ApplyMetaData.

type ApplyMetaDataAction

type ApplyMetaDataAction struct {
	Action string `json:"action"`
	Status string `json:"status"`
}

type ApplyServiceActionFlag

type ApplyServiceActionFlag string
const (
	ApplyServiceActionFlagNone    ApplyServiceActionFlag = "none"
	ApplyServiceActionFlagReload  ApplyServiceActionFlag = "reload"
	ApplyServiceActionFlagRestart ApplyServiceActionFlag = "restart"
	ApplyServiceActionFlagInvalid ApplyServiceActionFlag = ""
)

func StrToApplyServiceActionFlag

func StrToApplyServiceActionFlag(str string) ApplyServiceActionFlag

func (ApplyServiceActionFlag) String

func (af ApplyServiceActionFlag) String() string

type CheckRefsInputFileAndAdding

type CheckRefsInputFileAndAdding struct {
	File   []byte   `json:"file"`
	Adding []string `json:"adding"`
}

CheckRefsInputFileAndAdding is the input (stdin or file) for t3c-check-refs if --files-adding=input. If not, the input is simply the raw file to check.

type ChkConfigEntry

type ChkConfigEntry struct {
	Name string `json:"name"`
	Val  string `json:"value"`
}

func GetChkconfig

func GetChkconfig(cfg TCCfg) ([]ChkConfigEntry, error)

type ConfigData

type ConfigData struct {
	// Version is the version of the application which created the config data,
	// primarily used for cache invalidation.
	Version string `json:"version"`

	// Servers must be all the servers from Traffic Ops. May include servers not on the current cdn.
	Servers []atscfg.Server `json:"servers,omitempty"`

	// 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 `json:"cache_groups,omitempty"`

	// GlobalParams must be all Parameters in Traffic Ops on the tc.GlobalProfileName Profile. Must not include other parameters.
	GlobalParams []tc.Parameter `json:"global_parameters,omitempty"`

	// ServerProfilesParams must be all Parameters on the Profiles of the current server. Must not include other Parameters.
	ServerProfilesParams map[atscfg.ProfileName][]tc.Parameter `json:"server_profiles_parameters,omitempty"`

	// ServerParams is constructed from Server and ServerParams. Must not include other Parameters.
	// It's ok for other apps using this data to serialize and deserialize this to pass it around,
	// but t3c-request must always use ServerProfilesParams to re-populate this, and do If-Modified-Since requests from that.
	// This must never be used in an If-Modified-Since check, or populated wholesale from a single profile's endpoint.
	ServerParams []tc.Parameter `json:"server_params,omitempty"`

	// CacheKeyConfigParams must be all Parameters with the "cachekey.config" (compat)
	CacheKeyConfigParams []tc.Parameter `json:"cachekey_config_parameters,omitempty"`

	// RemapConfigParams must be all Parameters with the ConfigFile "remap.config"
	RemapConfigParams []tc.Parameter `json:"remap_config_parameters,omitempty"`

	// ParentConfigParams must be all Parameters with the ConfigFile "parent.config.
	ParentConfigParams []tc.Parameter `json:"parent_config_parameters,omitempty"`

	// 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 `json:"delivery_services,omitempty"`

	// 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 []atscfg.DeliveryServiceServer `json:"delivery_service_servers,omitempty"`

	// Server must be the server we're fetching configs from
	Server *atscfg.Server `json:"server,omitempty"`

	// Jobs must be all Jobs on the server's CDN. May include jobs on other CDNs.
	Jobs []atscfg.InvalidationJob `json:"jobs,omitempty"`

	// CDN must be the CDN of the server.
	CDN *tc.CDN `json:"cdn,omitempty"`

	// DeliveryServiceRegexes must be all regexes on all delivery services on this server's cdn.
	DeliveryServiceRegexes []tc.DeliveryServiceRegexes `json:"delivery_service_regexes,omitempty"`

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

	// URLSigKeys must be a map of every delivery service which uses URL Sig, to its keys.
	URLSigKeys map[tc.DeliveryServiceName]tc.URLSigKeys `json:"url_sig_keys,omitempty"`

	// 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{} `json:"server_capabilities,omitempty"`

	// 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{} `json:"delivery_service_required_capabilities,omitempty"`

	// SSLKeys must be all the ssl keys for the server's cdn.
	SSLKeys []tc.CDNSSLKeys `json:"ssl_keys,omitempty"`

	// Topologies must be all the topologies for the server's cdn.
	// May incude topologies of other cdns.
	Topologies []tc.Topology `json:"topologies,omitempty"`

	// TrafficOpsAddresses is the list of IP addresses used to request data. Because of proxies and load balancers,
	// multiple addresses may be used for the multiple requests necessary to fetch all data.
	TrafficOpsAddresses []string `json:"traffic_ops_addresses,omitempty"`
	TrafficOpsURL       string   `json:"traffic_ops_url,omitempty"`

	MetaData ConfigDataMetaData `json:"metadata"`
}

func GetConfigData

func GetConfigData(toClient *toreq.TOClient, disableProxy bool, cacheHostName string, revalOnly bool, oldCfg *ConfigData, version string) (*ConfigData, error)

GetTOData gets all the data from Traffic Ops needed to generate config. Returns the data, the addresses of all Traffic Ops' requested, and any error.

The toClient is the Traffic Ops client, which should already be initialized and connected.

The disableProxy arg is whether to disable using any Traffic Ops proxy configured via the global TrafficOpsProxyParameterName. If the Parameter exists, this will connect to Traffic Ops to get the global parameters, get the Parameter, and then change the toClient to use it.

The cacheHostName is the hostname of the cache to get config generation data for.

The oldCfg is previous config data which was cached. May be nil, if the caller has no previous data. If it exists and is usable, If-Modified-Since requests will be made and the cache re-used where possible.

The version is a unique version of the application, which should change with any compatibility changes. Old config with a different version than the current won't be used (though in the future, smarter compatibility could be added).

The revalOnly arg is whether to only get data necessary to revalidate, versus all data necessary to generate cache config.

type ConfigDataMetaData

type ConfigDataMetaData struct {
	CacheHostName          string                                 `json:"cache_host_name"`
	Servers                ReqMetaData                            `json:"servers"`
	CacheGroups            ReqMetaData                            `json:"cache_groups"`
	GlobalParams           ReqMetaData                            `json:"global_parameters"`
	ServerProfilesParams   map[atscfg.ProfileName]ReqMetaData     `json:"server_profiles_parameters"`
	CacheKeyConfigParams   ReqMetaData                            `json:"cachekey_config_parameters"`
	RemapConfigParams      ReqMetaData                            `json:"remap_config_parameters"`
	ParentConfigParams     ReqMetaData                            `json:"parent_config_parameters"`
	DeliveryServices       ReqMetaData                            `json:"delivery_services"`
	DeliveryServiceServers ReqMetaData                            `json:"delivery_service_servers"`
	Jobs                   ReqMetaData                            `json:"jobs"`
	CDN                    ReqMetaData                            `json:"cdn"`
	DeliveryServiceRegexes ReqMetaData                            `json:"delivery_service_regexes"`
	URISigningKeys         map[tc.DeliveryServiceName]ReqMetaData `json:"uri_signing_keys"`
	URLSigKeys             map[tc.DeliveryServiceName]ReqMetaData `json:"url_sig_keys"`
	ServerCapabilities     ReqMetaData                            `json:"server_capabilities"`
	DSRequiredCapabilities ReqMetaData                            `json:"delivery_service_required_capabilities"`
	SSLKeys                ReqMetaData                            `json:"ssl_keys"`
	Topologies             ReqMetaData                            `json:"topologies"`
}

type Mode

type Mode string

Mode is the t3c run mode - syncds, badass, etc.

const (
	ModeInvalid    Mode = ""
	ModeBadAss     Mode = "badass"
	ModeReport     Mode = "report"
	ModeRevalidate Mode = "revalidate"
	ModeSyncDS     Mode = "syncds"
)

func StrToMode

func StrToMode(str string) Mode

func (Mode) String

func (md Mode) String() string

type Package

type Package struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

func GetPackages

func GetPackages(cfg TCCfg) ([]Package, error)

type ReqMetaData

type ReqMetaData struct {
	LastModified string `json:"last_modified"`
	Date         string `json:"date"`
	ETag         string `json:"etag"`
}

ReqMetaData has response headers for Conditional Requests.

func MakeReqMetaData

func MakeReqMetaData(respHdr http.Header) ReqMetaData

type ServiceNeeds

type ServiceNeeds string

ServiceNeeds represents whether we need to reload or restart Traffic Server, as returned by t3c-check-reload.

Note the default is success, not invalid. With enums, typically invalid should be the default, but in this case, this represents the return of an app which returns nothing on successes (which is typical of POSIX apps), so we want the default empty string to represent that. Hence, the default value of ServiceNeeds is success, not invalid

const (
	ServiceNeedsNothing ServiceNeeds = "" // default is nothing, and print nothing if nothing needs done
	ServiceNeedsRestart ServiceNeeds = "restart"
	ServiceNeedsReload  ServiceNeeds = "reload"
	ServiceNeedsInvalid ServiceNeeds = "invalid"
)

func StrToServiceNeeds

func StrToServiceNeeds(str string) ServiceNeeds

func (ServiceNeeds) String

func (sn ServiceNeeds) String() string

type TCCfg

type TCCfg struct {
	CacheHostName string
	GetData       string
	TOClient      *toreq.TOClient
	TOInsecure    bool
	TOTimeoutMS   time.Duration
	TOPass        string
	TOUser        string
	TOURL         *url.URL
	UserAgent     string

	// TODisableProxy is whether to not use a configured Traffic Ops Proxy.
	// This is only used by WriteConfig, which is the only command that makes enough requests to matter.
	TODisableProxy bool

	// RevalOnly is whether to only fetch config data necessary to revalidate, versus all data necessary to generate config. This is only used by WriteConfig
	RevalOnly bool

	// OldCfg is the previously fetched ConfigData, for 'config' requests. May be nil.
	OldCfg *ConfigData

	// T3CVersion is the version of the t3c app ecosystem
	// This value will be the same for any t3c app.
	T3CVersion string
}

type UseStrategiesFlag

type UseStrategiesFlag string
const (
	UseStrategiesFlagTrue    UseStrategiesFlag = "true"
	UseStrategiesFlagCore    UseStrategiesFlag = "core"
	UseStrategiesFlagFalse   UseStrategiesFlag = "false"
	UseStrategiesFlagInvalid UseStrategiesFlag = ""
)

func StrToUseStrategiesFlag

func StrToUseStrategiesFlag(str string) UseStrategiesFlag

func (UseStrategiesFlag) String

func (fl UseStrategiesFlag) String() string

Directories

Path Synopsis
toreq implements a Traffic Ops client for features in the latest version.
toreq implements a Traffic Ops client for features in the latest version.
toreqold
Package toreqold calls the previous Traffic Ops API major version.
Package toreqold calls the previous Traffic Ops API major version.
torequtil
torequtil has utility functions used by toreq and toreqnew which don't require the Traffic Ops client, and thus can be shared.
torequtil has utility functions used by toreq and toreqnew which don't require the Traffic Ops client, and thus can be shared.

Jump to

Keyboard shortcuts

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