package
5.1.6+incompatible
Repository: https://github.com/apache/trafficcontrol.git
Documentation: pkg.go.dev
# README
TO Client Library Golang
Getting Started
- Obtain the latest version of the library
go get github.com/apache/trafficcontrol/traffic_ops/client
- Get a basic TO session started and fetch a list of CDNs
package main
import (
"fmt"
"os"
"time"
"github.com/apache/trafficcontrol/lib/go-tc"
toclient "github.com/apache/trafficcontrol/traffic_ops/client"
)
const TOURL = "http://localhost"
const TOUser = "user"
const TOPassword = "password"
const AllowInsecureConnections = true
const UserAgent = "MySampleApp"
const UseClientCache = false
const TrafficOpsRequestTimeout = time.Second * time.Duration(10)
func main() {
session, remoteaddr, err := toclient.LoginWithAgent(
TOURL,
TOUser,
TOPassword,
AllowInsecureConnections,
UserAgent,
UseClientCache,
TrafficOpsRequestTimeout)
if err != nil {
fmt.Printf("An error occurred while logging in:\n\t%v\n", err)
os.Exit(1)
}
fmt.Println("Connected to: " + remoteaddr.String())
var cdns []v13.CDN
cdns, _, err = session.GetCDNs()
if err != nil {
fmt.Printf("An error occurred while getting cdns:\n\t%v\n", err)
os.Exit(1)
}
for _, cdn := range cdns {
fmt.Println(cdn.Name)
}
}
# Functions
Login to traffic_ops, the response should set the cookie for this session automatically.
No description provided by the author
Logout of traffic_ops.
NewNoAuthSession returns a new Session without logging in this can be used for querying unauthenticated endpoints without requiring a login.
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UpdateStatusClear is the value received by and posted to the Traffic Ops cache update endpoint, indicating no updates are pending for a cache.
UpdateStatusPending is the value received by and posted to the Traffic Ops cache update endpoint, indicating an update is pending for a cache.
# Structs
CacheEntry ...
HTTPError is returned on Update Session failure.
No description provided by the author
No description provided by the author
Session ...
No description provided by the author
# Type aliases
No description provided by the author
No description provided by the author