Documentation ¶
Overview ¶
toreq implements a Traffic Ops client for features in the latest version.
This should only be used if an endpoint or field needed for config gen is in the latest.
Users should always check the returned bool, and if it's false, call the vendored toreq client and set the proper defaults for the new feature(s).
All TOClient functions should check for 404 or 503 and return a bool false if so.
Index ¶
- Constants
- func GetCDNByName(toClient *toclient.Session, name tc.CDNName, opts *toclient.RequestOptions) (tc.CDN, toclientlib.ReqInf, error)
- func GetDeliveryServiceURLSigKeys(toClient *toclient.Session, dsName string, opts *toclient.RequestOptions) (tc.URLSigKeys, toclientlib.ReqInf, error)
- func GetParametersByConfigFile(toClient *toclient.Session, configFile string, opts *toclient.RequestOptions) ([]tc.Parameter, toclientlib.ReqInf, error)
- func GetParametersByName(toClient *toclient.Session, name string, opts *toclient.RequestOptions) ([]tc.Parameter, toclientlib.ReqInf, error)
- func GetProfileByName(toClient *toclient.Session, name string, opts *toclient.RequestOptions) (tc.Profile, toclientlib.ReqInf, error)
- func IsLatestSupported(toClient *toclient.Session) (bool, net.Addr, error)
- func ReqOpts(hdr http.Header) *toclient.RequestOptions
- type TOClient
- func (cl *TOClient) FellBack() bool
- func (cl *TOClient) GetCDN(cdnName tc.CDNName, reqHdr http.Header) (tc.CDN, toclientlib.ReqInf, error)
- func (cl *TOClient) GetCDNDeliveryServices(cdnID int, reqHdr http.Header) ([]atscfg.DeliveryService, toclientlib.ReqInf, error)
- func (cl *TOClient) GetCDNSSLKeys(cdnName tc.CDNName, reqHdr http.Header) ([]tc.CDNSSLKeys, toclientlib.ReqInf, error)
- func (cl *TOClient) GetCDNs(reqHdr http.Header) ([]tc.CDN, toclientlib.ReqInf, error)
- func (cl *TOClient) GetCacheGroups(reqHdr http.Header) ([]tc.CacheGroupNullable, toclientlib.ReqInf, error)
- func (cl *TOClient) GetConfigFileParameters(configFile string, reqHdr http.Header) ([]tc.Parameter, toclientlib.ReqInf, error)
- func (cl *TOClient) GetDeliveryServiceRegexes(reqHdr http.Header) ([]tc.DeliveryServiceRegexes, toclientlib.ReqInf, error)
- func (cl *TOClient) GetDeliveryServiceRequiredCapabilitiesByID(dsIDs []int, reqHdr http.Header) (map[int]map[atscfg.ServerCapability]struct{}, toclientlib.ReqInf, error)
- func (cl *TOClient) GetDeliveryServiceServers(dsIDs []int, serverIDs []int, reqHdr http.Header) ([]tc.DeliveryServiceServer, toclientlib.ReqInf, error)
- func (cl *TOClient) GetGlobalParameters(reqHdr http.Header) ([]tc.Parameter, toclientlib.ReqInf, error)
- func (cl *TOClient) GetJobs(reqHdr http.Header) ([]tc.InvalidationJob, toclientlib.ReqInf, error)
- func (cl *TOClient) GetParametersByName(paramName string, reqHdr http.Header) ([]tc.Parameter, toclientlib.ReqInf, error)
- func (cl *TOClient) GetProfileByName(profileName string, reqHdr http.Header) (tc.Profile, toclientlib.ReqInf, error)
- func (cl *TOClient) GetServerByHostName(serverHostName string, reqHdr http.Header) (*atscfg.Server, toclientlib.ReqInf, error)
- func (cl *TOClient) GetServerCapabilitiesByID(serverIDs []int, reqHdr http.Header) (map[int]map[atscfg.ServerCapability]struct{}, toclientlib.ReqInf, error)
- func (cl *TOClient) GetServerProfileParameters(profileName string, reqHdr http.Header) ([]tc.Parameter, toclientlib.ReqInf, error)
- func (cl *TOClient) GetServerUpdateStatus(cacheHostName tc.CacheName, reqHdr http.Header) (tc.ServerUpdateStatus, toclientlib.ReqInf, error)
- func (cl *TOClient) GetServers(reqHdr http.Header) ([]atscfg.Server, toclientlib.ReqInf, error)
- func (cl *TOClient) GetStatuses(reqHdr http.Header) ([]tc.Status, toclientlib.ReqInf, error)
- func (cl *TOClient) GetTopologies(reqHdr http.Header) ([]tc.Topology, toclientlib.ReqInf, error)
- func (cl *TOClient) GetURISigningKeys(dsName string, reqHdr http.Header) ([]byte, toclientlib.ReqInf, error)
- func (cl *TOClient) GetURLSigKeys(dsName string, reqHdr http.Header) (tc.URLSigKeys, toclientlib.ReqInf, error)
- func (cl *TOClient) SetServerUpdateStatus(cacheHostName tc.CacheName, updateStatus *bool, revalStatus *bool) (toclientlib.ReqInf, error)
- func (cl *TOClient) SetURL(newURL string)
- func (cl *TOClient) URL() string
Constants ¶
const DeliveryServiceServersAlwaysGetAll = true
DeliveryServiceServersAlwaysGetAll indicates whether to always get all delivery service servers from Traffic Ops, and cache all in a file (but still return to the caller only the objects they requested). This exists and is currently true, because with an ORT run, it's typically more efficient to get them all in a single request, and re-use that cache; than for every config file to get and cache its own unique set. If your use case is more efficient to only get the needed objects, for example if you're frequently requesting one file, set this false to get and cache the specific needed delivery services and servers.
Variables ¶
This section is empty.
Functions ¶
func GetCDNByName ¶
func GetCDNByName(toClient *toclient.Session, name tc.CDNName, opts *toclient.RequestOptions) (tc.CDN, toclientlib.ReqInf, error)
func GetDeliveryServiceURLSigKeys ¶
func GetDeliveryServiceURLSigKeys(toClient *toclient.Session, dsName string, opts *toclient.RequestOptions) (tc.URLSigKeys, toclientlib.ReqInf, error)
GetDeliveryServiceURLSigKeys gets the URL Sig keys from Traffic Ops for the given delivery service. It is a helper function that calls traffic_ops/v4-client.Session.GetDeliveryServiceURLSignatureKeys to avoid confusion around the protocol named URL Sig.
func GetParametersByConfigFile ¶
func GetParametersByConfigFile(toClient *toclient.Session, configFile string, opts *toclient.RequestOptions) ([]tc.Parameter, toclientlib.ReqInf, error)
GetParametersByConfigFile returns the parameters with the given config file from Traffic Ops. It is a helper function equivalent to calling GetParameters with RequestOptions with the Values (query string) with the key configFile set to the config file. If opts.Values[configFile] exists, it is overwritten with name.
func GetParametersByName ¶
func GetParametersByName(toClient *toclient.Session, name string, opts *toclient.RequestOptions) ([]tc.Parameter, toclientlib.ReqInf, error)
GetParametersByName returns the parameters with the given name from Traffic Ops. It is a helper function equivalent to calling GetParameters with RequestOptions with the Values (query string) with the key name set to the name. If opts.Values[name] exists, it is overwritten with name.
func GetProfileByName ¶
func GetProfileByName(toClient *toclient.Session, name string, opts *toclient.RequestOptions) (tc.Profile, toclientlib.ReqInf, error)
GetProfileByName returns the profile with the given name from Traffic Ops. It is a helper function equivalent to calling GetProfiles with RequestOptions with the Values (query string) with the key name set to the Profile name. If opts.Values[name] exists, it is overwritten with name.
Types ¶
type TOClient ¶
type TOClient struct { NumRetries int // contains filtered or unexported fields }
func New ¶
func New(url *url.URL, user string, pass string, insecure bool, timeout time.Duration, userAgent string) (*TOClient, error)
New logs into Traffic Ops, returning the TOClient which contains the logged-in client.
func (*TOClient) FellBack ¶
FellBack() returns whether the client fell back to the previous major version, because Traffic Ops didn't support the latest.
func (*TOClient) GetCDNDeliveryServices ¶
func (cl *TOClient) GetCDNDeliveryServices(cdnID int, reqHdr http.Header) ([]atscfg.DeliveryService, toclientlib.ReqInf, error)
GetCDNDeliveryServices returns the data, the Traffic Ops address, and any error.
func (*TOClient) GetCDNSSLKeys ¶
func (*TOClient) GetCacheGroups ¶
func (*TOClient) GetConfigFileParameters ¶
func (*TOClient) GetDeliveryServiceRegexes ¶
func (*TOClient) GetDeliveryServiceRequiredCapabilitiesByID ¶
func (*TOClient) GetDeliveryServiceServers ¶
func (*TOClient) GetGlobalParameters ¶
func (*TOClient) GetParametersByName ¶
func (*TOClient) GetProfileByName ¶
func (*TOClient) GetServerByHostName ¶
func (*TOClient) GetServerCapabilitiesByID ¶
func (*TOClient) GetServerProfileParameters ¶
func (*TOClient) GetServerUpdateStatus ¶
func (cl *TOClient) GetServerUpdateStatus(cacheHostName tc.CacheName, reqHdr http.Header) (tc.ServerUpdateStatus, toclientlib.ReqInf, error)
GetServerUpdateStatus returns the data, the Traffic Ops address, and any error.
func (*TOClient) GetServers ¶
func (*TOClient) GetStatuses ¶
func (*TOClient) GetTopologies ¶
GetTopologies returns the data, the Traffic Ops address, and any error.
func (*TOClient) GetURISigningKeys ¶
func (*TOClient) GetURLSigKeys ¶
func (*TOClient) SetServerUpdateStatus ¶
func (cl *TOClient) SetServerUpdateStatus(cacheHostName tc.CacheName, updateStatus *bool, revalStatus *bool) (toclientlib.ReqInf, error)
SetServerUpdateStatus sets the server's update and reval statuses in Traffic Ops.
Directories ¶
Path | Synopsis |
---|---|
Package toreqold calls the previous Traffic Ops API major version.
|
Package toreqold calls the previous Traffic Ops API major version. |
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. |