tc

package
v6.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 25 Imported by: 0

Documentation

Overview

Package tc provides structures, constants, and functions that are used throughout the components of Apache Traffic Control.

In general, the symbols defined here should be used by more than one component of Traffic Control - otherwise it can just appear in the only component that needs it. Most often this means that the symbols herein defined are referring to objects and/or concepts exposed through the Traffic Ops API, and usually serve to define payloads of HTTP requests and responses.

Enumerated Types

Enumerated types - which should typically go in enum.go - should be treated as enumerables, and MUST NOT be cast as anything else (integer, strings, etc.). Enums MUST NOT be compared to strings or integers via casting. Enumerable data SHOULD be stored as the enumeration, not as a string or number. The *only* reason they are internally represented as strings, is to make them implicitly serialize to human-readable JSON. They should not be treated as strings. Casting or storing strings or numbers defeats the purpose of enum safety and conveniences.

An example of an enumerated string type 'Foo' and an enumerated integral (or arbitrary) type 'Bar' are shown below:

type Foo string
const (
    FooA Foo = "A"
    FooB Foo = "B"
)

type Bar int
const (
    BarTest Bar = iota
    BarQuest
)

Note the way each member of the "enum" is prefixed with the type name, to help avoid collisions. Also note how, for string enumerations, the type must be repeated with each assignment, whereas for an arbitrary enumeration, you can make use of the special 'iota' language constant to start with some arbitrary value and then just make names on subsequent lines to implicitly increment from there, while maintaining proper type.

Enumerables that need to be serialized and deserialized in JSON should use strings to make them easiest to understand and work with (serialization will work out-of-the-box that way). One way to implement type safety for enumerated types that require serialization support is to implement the encoding/json.Unmarshaler interface and return an error for unsupported values. However, note that this causes the unmarshaling to halt immediately, which is fast but if there are other errors in the JSON document that would be encountered later, they will not be reported. Therefore, types used in structures that the Traffic Ops API unmarshals should generally instead use an "invalid" value that indicates the problem but allows parsing to continue. The way this is normally done is with a 'FromString' method like so:

type Foo string
const (
    FooA Foo = "A"
    FooB Foo = "B"
    FooInvalid = ""
)

func FooFromString(foo string) Foo {
    switch foo {
    case FooA:
        fallthrough
    case FooB:
        return Foo(foo)
    }
    return FooInvalid
}

However, this requires postprocessing after deserialization, so one might instead implement encoding/json.Unmarshaler:

import "errors"

type Foo string
const (
    FooA Foo = "A"
    FooB Foo = "B"
    FooInvalid = ""
)

func (f *Foo) UnmarshalJSON(data []byte) error {
    if string(data) == "null" {
        return errors.New("'null' is not a valid 'Foo'")
    }
    s := strings.Trim(string(data), "\"")
    switch s {
    case FooA:
        fallthrough
    case FooB:
        *f = Foo(s)
        return
    }
    // This is an invalid *value* not a parse error, so we don't return
    // an error and instead just make it clear that the value was
    // invalid.
    *f = FooInvalid
    return nil
}

Though in this case the original, raw, string value of the 'Foo' is lost. Be aware of the limitations of these two designs during implementation.

When storing enumumerable data in memory, it SHOULD be converted to and stored as an enum via the corresponding `FromString` function, checked whether the conversion failed and Invalid values handled, and valid data stored as the enum. This guarantees stored data is valid, and catches invalid input as soon as possible.

Conversion functions, whether they be a 'FromString' function or an UnmarshalJSON method, should not be case-insensitive.

When adding new enum types, enums should be internally stored as strings, so they implicitly serialize as human-readable JSON, unless the performance or memory of integers is necessary (it almost certainly isn't). Enums should always have the "invalid" value as the empty string (or 0), so default-initialized enums are invalid.

Enums should always have a String() method, that way they implement fmt.Stringer and can be easily represented in a human-readable way.

When to Use Custom Types

A type should be defined whenever there is a need to represent a data *structure* (in a 'struct'), or whenever the type has some enforced semantics. For example, enumerated types have the attached semantic that there is a list of valid values, and generally there are methods and/or functions associated with those types that act on that limitation. On the otherhand, if there is a type 'Foo' that has some property 'Bar' that contains arbitrary textual data with no other semantics or limitations, then 'string' is the appropriate type; there is no need to make a type 'FooBar' to express the relationship between a Foo and its Bar - that's the job of the Go language itself.

Similarly, try to avoid duplication. For example, Parameters can be assigned to Profiles or (in legacy code that may have been removed by the time this is being read) Cache Groups. It was not necessary to create a type CacheGroupParameter that contains all of the same data as a regular Parameter simply because of this relationship.

Versioning Structures

Structures used by the Traffic Ops API may change over time as the API itself changes. Typically, each new major API version will cause some breaking change to some structure in this package. This means that a new structure will need to be created to avoid breaking old clients that are deprecated but still supported. The naming convention for a new version of a structure that represents a Foo object in the new version - say, 2.0 - is to call it FooV20. Then, a more general type alias should be made for the API major version for use in client methods (so that they can be silently upgraded for non-breaking changes) - in this case: FooV2. A deprecation notice should then be added to the legacy type (which is hopefully but not necessarily named FooV1/FooV11 etc.) indicating the new structure. For example:

// FooV11 represents a Foo in TO APIv1.1.
//
// Deprecated: TO APIv1.1 is deprecated; upgrade to FooV2.
type FooV11 struct {
    Bar string `json:"bar"`
}
// FooV1 represents a Foo in the latest minor version of TO APIv1.
//
// Deprecated: TO APIv1 is deprecated; upgrade to FooV2.
type FooV1 = FooV11

// FooV20 represents a Foo in TO APIv2.0.
type FooV20 struct {
    Bar string `json:"bar"`
}
// FooV2 represents a Foo in the latest minor version of TO APIv2.
type FooV2 = FooV20

Note that there is no type alias simply named "Foo" - that is exactly how it should be.

Legacy types may not include version information - newer versions should add it as described above. Legacy types may also include the word "Nullable" somewhere - strip this out! That word included in a type name is only to differentiate between older structures that were not "nullable" and the newer ones. Newly added types should only have one structure that is as "nullable" or "non-nullable" as it needs to be, so there is no need to specify.

Index

Examples

Constants

View Source
const (
	// Key-signing key.
	DNSSECKSKType = "ksk"
	// Zone-signing key.
	DNSSECZSKType = "zsk"
)

Types of keys used in DNSSEC and stored in Traffic Vault.

View Source
const (
	DNSSECKeyStatusNew     = "new"
	DNSSECKeyStatusExpired = "expired"
	DNSSECStatusExisting   = "existing"
)

The various allowable statuses for DNSSEC keys being inserted into or retrieved from Traffic Vault.

View Source
const (
	// The state as parsed from a raw string did not represent a valid RequestStatus.
	RequestStatusInvalid = RequestStatus("invalid")
	// The DSR is a draft that is not ready for review.
	RequestStatusDraft = RequestStatus("draft")
	// The DSR has been submitted for review.
	RequestStatusSubmitted = RequestStatus("submitted")
	// The DSR was rejected by a reviewer.
	RequestStatusRejected = RequestStatus("rejected")
	// The DSR has been approved by a reviewer and is pending fullfillment.
	RequestStatusPending = RequestStatus("pending")
	// The DSR has been approved and fully implemented.
	RequestStatusComplete = RequestStatus("complete")
)

The various Statuses a Delivery Service Request (DSR) may have.

View Source
const (
	// The original Delivery Service is being modified to match the requested
	// one.
	DSRChangeTypeUpdate = DSRChangeType("update")
	// The requested Delivery Service is being created.
	DSRChangeTypeCreate = DSRChangeType("create")
	// The requested Delivery Service is being deleted.
	DSRChangeTypeDelete = DSRChangeType("delete")
)

These are the valid values for Delivery Service Request Change Types.

View Source
const (
	SelfSignedCertAuthType           = "Self Signed"
	CertificateAuthorityCertAuthType = "Certificate Authority"
	LetsEncryptAuthType              = "Lets Encrypt"
)

Authentication methods used for signing Delivery Service SSL certificates.

View Source
const (
	// Deprecated: TLS version 1.0 is known to be insecure.
	TLSVersion10 = "1.0"
	// Deprecated: TLS version 1.1 is known to be insecure.
	TLSVersion11 = "1.1"
	TLSVersion12 = "1.2"
	TLSVersion13 = "1.3"
)

These are the TLS Versions known by Apache Traffic Control to exist.

View Source
const (
	// CacheTypeEdge represents an edge-tier cache server.
	CacheTypeEdge = CacheType("EDGE")
	// CacheTypeMid represents a mid-tier cache server.
	CacheTypeMid = CacheType("MID")
	// CacheTypeInvalid represents an CacheType. Note this is the default
	// construction for a CacheType.
	CacheTypeInvalid = CacheType("")
)

The allowable values for a CacheType.

View Source
const (
	CacheGroupEdgeTypeName   = EdgeTypePrefix + "_LOC"
	CacheGroupMidTypeName    = MidTypePrefix + "_LOC"
	CacheGroupOriginTypeName = OriginTypeName + "_LOC"
)

These are the Names of the Types that must be used by various kinds of Cache Groups to ensure proper behavior.

Note that there is, in general, no guarantee that a Type with any of these names exist in Traffic Ops at any given time.

Note also that there is no enforcement in Traffic Control that a particular Type of Cache Group contains only or any of a particular Type or Types of server(s).

View Source
const (
	QueryStringIgnoreUseInCacheKeyAndPassUp    = 0
	QueryStringIgnoreIgnoreInCacheKeyAndPassUp = 1
	QueryStringIgnoreDropAtEdge                = 2
)

The allowed values for a Delivery Service's Query String Handling.

These are prefixed "QueryStringIgnore" even though the values don't always indicate ignoring, because the database column is named "qstring_ignore".

View Source
const (
	RangeRequestHandlingDontCache         = 0
	RangeRequestHandlingBackgroundFetch   = 1
	RangeRequestHandlingCacheRangeRequest = 2
	RangeRequestHandlingSlice             = 3
)

The allowed values for a Delivery Service's Range Request Handling.

View Source
const (
	// DSTypeCategoryHTTP represents an HTTP-routed Delivery Service.
	DSTypeCategoryHTTP = DSTypeCategory("http")
	// DSTypeCategoryDNS represents a DNS-routed Delivery Service.
	DSTypeCategoryDNS = DSTypeCategory("dns")
	// DSTypeCategoryInvalid represents an invalid Delivery Service routing
	// type. Note this is the default construction for a DSTypeCategory.
	DSTypeCategoryInvalid = DSTypeCategory("")
)
View Source
const (
	SigningAlgorithmURLSig     = "url_sig"
	SigningAlgorithmURISigning = "uri_signing"
)

These are the allowable values for the Signing Algorithm property of a Delivery Service.

View Source
const (
	// Indicates content will only be served using the unsecured HTTP Protocol.
	DSProtocolHTTP = 0
	// Indicates content will only be served using the secured HTTPS Protocol.
	DSProtocolHTTPS = 1
	// Indicates content will only be served over both HTTP and HTTPS.
	DSProtocolHTTPAndHTTPS = 2
	// Indicates content will only be served using the secured HTTPS Protocol,
	// and that unsecured HTTP requests will be directed to use HTTPS instead.
	DSProtocolHTTPToHTTPS = 3
)

These are the allowable values for the Protocol property of a Delivery Service.

View Source
const (
	// CacheStatusAdminDown represents a cache server which has been
	// administratively marked as "down", but which should still appear in the
	// CDN.
	CacheStatusAdminDown = CacheStatus("ADMIN_DOWN")
	// CacheStatusOnline represents a cache server which should always be
	// considered online/available/healthy, irrespective of monitoring.
	// Non-cache servers also typically use this Status instead of REPORTED.
	CacheStatusOnline = CacheStatus("ONLINE")
	// CacheStatusOffline represents a cache server which should always be
	// considered offline/unavailable/unhealthy, irrespective of monitoring.
	CacheStatusOffline = CacheStatus("OFFLINE")
	// CacheStatusReported represents a cache server which is polled for health
	// by Traffic Monitor. The vast majority of cache servers should have this
	// Status.
	CacheStatusReported = CacheStatus("REPORTED")
	// CacheStatusInvalid represents an unrecognized Status value. Note that
	// this is not actually "invalid", because Statuses may have any unique
	// name, not just those captured as CacheStatus values in this package.
	CacheStatusInvalid = CacheStatus("")
)

These are the allowable values of a CacheStatus.

Note that there is no guarantee that a Status by any of these Names exists in Traffic Ops at any given time, nor that such a Status - should it exist - have any given Description or ID.

View Source
const (
	// ProtocolHTTP represents the HTTP/1.1 protocol as specified in RFC2616.
	ProtocolHTTP = Protocol("http")
	// ProtocolHTTPS represents the HTTP/1.1 protocol over a TCP connection secured by TLS.
	ProtocolHTTPS = Protocol("https")
	// ProtocolHTTPtoHTTPS represents a redirection of unsecured HTTP requests to HTTPS.
	ProtocolHTTPtoHTTPS = Protocol("http to https")
	// ProtocolHTTPandHTTPS represents the use of both HTTP and HTTPS.
	ProtocolHTTPandHTTPS = Protocol("http and https")
	// ProtocolInvalid represents an invalid Protocol.
	ProtocolInvalid = Protocol("")
)

The allowable values of a Protocol.

Deprecated: These do not accurately model the Protocol of a Delivery Service, use DSProtocolHTTP, DSProtocolHTTPS, DSProtocolHTTPToHTTPS, and DSProtocolHTTPAndHTTPS instead.

View Source
const (
	LocalizationMethodCZ      = LocalizationMethod("CZ")
	LocalizationMethodDeepCZ  = LocalizationMethod("DEEP_CZ")
	LocalizationMethodGeo     = LocalizationMethod("GEO")
	LocalizationMethodInvalid = LocalizationMethod("INVALID")
)

These are the allowable values of a LocalizationMethod.

View Source
const (
	DeepCachingTypeNever   = DeepCachingType("") // default value
	DeepCachingTypeAlways  = DeepCachingType("ALWAYS")
	DeepCachingTypeInvalid = DeepCachingType("INVALID")
)

These are the allowable values of a DeepCachingType. Note that unlike most "enumerated" constants exported by this package, the default construction yields a valid value.

View Source
const (
	FederationResolverType4       = FederationResolverType("RESOLVE4")
	FederationResolverType6       = FederationResolverType("RESOLVE6")
	FederationResolverTypeInvalid = FederationResolverType("")
)

These are the allowable values of a FederationResolverType.

Note that, in general, there is no guarantee that a Type by any of these Names exists in Traffic Ops at any given time, nor that any such Types - should they exist - will have any particular UseInTable value, nor that the Types assigned to Federation Resolver Mappings will be representable by these values.

View Source
const (
	StatNameKBPS      = "kbps"
	StatNameMaxKBPS   = "maxKbps"
	StatNameBandwidth = "bandwidth"
)

These are the names of statistics that can be used in thresholds for server health.

View Source
const AlgorithmConsistentHash = "consistent_hash"

AlgorithmConsistentHash is the name of the Multi-Site Origin hashing algorithm that performs consistent hashing on a set of parents.

View Source
const CachegroupCoordinateNamePrefix = "from_cachegroup_"

CachegroupCoordinateNamePrefix is a string that all cache group coordinate names are prefixed with.

View Source
const DBError = ErrorConstant("database access error")

DBError is an error message for database errors.

Deprecated: Since internal errors are not returned to users, there's no reason not to include more detail in an error message than this.

View Source
const DSTypeLiveNationalSuffix = "_LIVE_NATNL"

DSTypeLiveNationalSuffix is the suffix that Delivery Services which are both "live" and "national" MUST have at the end of the Name(s) of the Type(s) they use in order to be treated properly by ATC.

Deprecated: Use DSType.IsLive and DSType.IsNational instead.

View Source
const DSTypeLiveSuffix = "_LIVE"

DSTypeLiveSuffix is the suffix that Delivery Services which are "live" - but not "national" (maybe?) - MUST have at the end of the Name(s) of the Type(s) they use in order to be treated properly by ATC.

Deprecated: Use DSType.IsLive and DSType.IsNational instead.

View Source
const DefaultHealthThresholdComparator = "<"

DefaultHealthThresholdComparator is the comparator used for health thresholds when one is not explicitly provided in the Value of a Parameter used to define a Threshold.

View Source
const DefaultMaxRequestHeaderBytes = 0

DefaultMaxRequestHeaderBytes is the Max Header Bytes given to Delivery Services upon creation through the Traffic Ops API if Max Request Header Bytes is not specified in the request body.

View Source
const DefaultRoutingName = "cdn"

DefaultRoutingName is the Routing Name given to Delivery Services upon creation through the Traffic Ops API if a Routing Name is not specified in the request body.

View Source
const EdgeTypePrefix = "EDGE"

EdgeTypePrefix is a prefix which MUST appear on the Names of Types used by edge-tier cache servers in order for them to be recognized as edge-tier cache servers by ATC.

View Source
const EmptyAddressCannotBeAServiceAddressError = ErrorConstant("an empty IP or IPv6 address cannot be marked as a service address")

EmptyAddressCannotBeAServiceAddressError is the client-facing error returned from the Traffic Ops API's /servers endpoint when the client is attempting to update or create a server that has an IP address marked as the "service address" which was not provided in the request (although the other address family address may have been provided).

Deprecated: This error's wording is only used in a deprecated version of the API.

View Source
const GlobalConfigFileName = ConfigFileName("global")

GlobalConfigFileName is ConfigFile value which can cause a Parameter to be handled specially by Traffic Control components under certain circumstances.

Note that there is no guarantee that a Parameter with this ConfigFile value exists in Traffic Ops at any given time, nor that any particular number of such Parameters is allowed or forbidden, nor that any such existing Parameters will have or not have any particular Name or Secure or Value value, nor that should such a Parameter exist that its value will match or not match any given pattern, nor that it will or will not be assigned to any particular Profile or Profiles or Cache Groups.

View Source
const GlobalProfileName = "GLOBAL"

GlobalProfileName is the Name of a Profile that is treated specially in some respects by some components of ATC.

Note that there is, in general, no guarantee that a Profile with this Name exists in Traffic Ops at any given time, nor that it will have or not have any particular set of assigned Parameters, nor that any set of Parameters that do happen to be assigned to it should it exist will have or not have particular ConfigFile or Secure or Value values, nor that any such Parameters should they exist would have Values that match any given pattern, nor that it has any particular Profile Type, nor that it is or is not assigned to any Delivery Service or server or server(s), nor that those servers be or not be of any particular Type should they exist. Traffic Ops promises much, but guarantees little.

View Source
const JobRequestTimeFormat = `2006-01-02 15:04:05`

JobRequestTimeFormat is a Go reference time format, for use with time.Format, of the format used by the Perl version of the /jobs and /user/current/jobs endpoints.

Deprecated: Since job inputs no longer strictly require this format, an RFC 3339 format or a timestamp in milliseconds should be used instead.

View Source
const JobTimeFormat = `2006-01-02 15:04:05-07`

JobTimeFormat is a Go reference time format, for use with time.Format.

Deprecated: this format is the same as TimeLayout - which should be used instead.

View Source
const MaxRangeSliceBlockSize = 33554432

MaxRangeSliceBlockSize is the maximum allowed value for a Delivery Service's Range Slice Block Size, in bytes. This is 32MiB.

View Source
const MaxTTL = math.MaxInt64 / 3600000000000

MaxTTL is the maximum value of TTL representable as a time.Duration object, which is used internally by InvalidationJobInput objects to store the TTL.

View Source
const MidTypePrefix = "MID"

MidTypePrefix is a prefix which MUST appear on the Names of Types used by mid-tier cache servers in order for them to be recognized as mid-tier cache servers by ATC.

View Source
const MinRangeSliceBlockSize = 262144

MinRangeSliceBlockSize is the minimum allowed value for a Delivery Service's Range Slice Block Size, in bytes. This is 256KiB.

View Source
const MonitorProfilePrefix = "RASCAL"

MonitorProfilePrefix is a prefix which MUST appear on the Names of Profiles used by Traffic Monitor instances as servers in Traffic Ops, or they may not be treated properly.

"Rascal" is a legacy name for Traffic Monitor.

Deprecated: This should not be a requirement for TM instances to be treated properly, and new code should not check this.

View Source
const MonitorTypeName = "RASCAL"

MonitorTypeName is the Name of the Type which must be assigned to a server for it to be treated as a Traffic Monitor instance by ATC.

"Rascal" is a legacy name for Traffic Monitor.

Note that there is, in general, no guarantee that a Type with this name exists in Traffic Ops at any given time.

View Source
const NeedsAtLeastOneIPError = ErrorConstant("both IP and IP6 addresses are empty")

NeedsAtLeastOneIPError is the client-facing error returned from the Traffic Ops API's /servers endpoint when the client is attempting to update or create a server without an IPv4 or IPv6 address.

Deprecated: This error's wording is only used in a deprecated version of the API.

View Source
const NeedsAtLeastOneServiceAddressError = ErrorConstant("at least one address must be marked as a service address")

NeedsAtLeastOneServiceAddressError is the client-facing error returned from the Traffic Ops API's /servers endpoint when the client is attempting to update or create a server without an IP address marked as its "service address".

Deprecated: This error's wording is only used in a deprecated version of the API.

View Source
const NilTenantError = ErrorConstant("tenancy is enabled but request tenantID is nil")

NilTenantError can used when a Tenantable object finds that TentantID in the request is nil.

View Source
const OriginLocationType = "ORG_LOC"

OriginLocationType is the Name of a Cache Group which represents an "Origin Location".

There is no enforcement in Traffic Control anywhere that ensures than an ORG_LOC-Type Cache Group will only actually contain Origin servers.

Deprecated: Prefer CacheGroupOriginTypeName for consistency.

View Source
const OriginTypeName = "ORG"

OriginTypeName is the Name of the Type which must be assigned to a server for it to be treated as an Origin server by ATC.

Note that there is, in general, no guarantee that a Type with this name exists in Traffic Ops at any given time.

View Source
const RouterTypeName = "CCR"

RouterTypeName is the Name of the Type which must be assigned to a server for it to be treated as a Traffic Router instance by ATC.

"CCR" is an acronym for a legacy name for Traffic Router.

Note that there is, in general, no guarantee that a Type with this name exists in Traffic Ops at any given time.

View Source
const TenantDSUserNotAuthError = ErrorConstant("user not authorized for requested delivery service tenant")

TenantDSUserNotAuthError is used when a user does not have access to a requested resource tenant for a delivery service.

View Source
const TenantUserNotAuthError = ErrorConstant("user not authorized for requested tenant")

TenantUserNotAuthError is used when a user does not have access to a requested resource tenant.

View Source
const ThresholdPrefix = "health.threshold."

ThresholdPrefix is the prefix of all Names of Parameters used to define monitoring thresholds.

View Source
const TimeLayout = "2006-01-02 15:04:05-07"

TimeLayout is the format used in lastUpdated fields in Traffic Ops.

Deprecated: New code should use RFC3339 (with optional nanosecond precision).

View Source
const UseRevalPendingParameterName = ParameterName("use_reval_pending")

UseRevalPendingParameterName is the name of a Parameter which tells whether or not Traffic Ops should use pending content invalidation jobs separately from traditionally "queued updates".

Note that there is no guarantee that a Parameter with this name exists in Traffic Ops at any given time, nor that it will have or not have any particular ConfigFile or Secure or Value value, nor that should such a Parameter exist that its value will match or not match any given pattern, nor that it will or will not be assigned to any particular Profile or Profiles or Cache Groups.

Deprecated: UseRevalPending was a feature flag introduced for ATC version 2, and newer code should just assume that pending revalidations are going to be fetched by t3c.

Variables

View Source
var EmailTemplate = template.Must(template.New("Email Template").Parse(`<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<title>Delivery Service Request for {{.Customer}}</title>
<style>
aside {
	padding: 0 1em;
	color: #6A737D;
	border-left: .25em solid #DFE2E5;
}
body {
	font-family: sans;
	background-color: white;
}
pre {
	padding: 5px;
	background-color: lightgray;
}
</style>
</head>
<body>
<h1>Delivery Service Request for {{.Customer}}</h1>
<p>{{.ServiceDesc}}</p>
<section>
	<details>
		<summary><h2>Service Description</h2></summary>
		<h3>Content Type</h3>
		<p>{{.ContentType}}</p>
		<h3>Delivery Protocol</h3>
		<p>{{.DeliveryProtocol.String}}</p>
		<h3>Routing Type</h3>
		<p>{{.RoutingType.String}}</p>
	</details>
</section>
<section>
	<details>
		<summary><h2>Traffic &amp; Library Estimates</h2></summary>
		<h3>Peak Bandwidth Estimate</h3>
		<p>{{.PeakBPSEstimate}}Bps</p>
		<h3>Peak Transactions per Second Estimate</h3>
		<p>{{.PeakTPSEstimate}}Tps</p>
		<h3>Max Library Size Estimate</h3>
		<p>{{.MaxLibrarySizeEstimate}}GB</p>
	</details>
</section>
<section>
	<details>
		<summary><h2>Origin Security</h2></summary>
		<h3>Origin Server URL</h3>
		<p><a href="{{.OriginURL}}">{{.OriginURL}}</a></p>
		<h3>Origin Dynamic Remap</h3>
		<p>{{.HasOriginDynamicRemap}}</p>
		<h3>Origin Test File</h3>
		<p>{{.OriginTestFile}}</p>
		<h3>ACL/Whitelist to Access Origin</h3>
		<p>{{.HasOriginACLWhitelist}}</p>
		{{if .OriginHeaders}}<h3>Header(s) to Access Origin</h3>
		<ul>{{range .OriginHeaders}}
			<li>{{.}}</li>{{end}}
		</ul>{{end}}
		<h3>Other Origin Security</h3>
		<p>{{if .OtherOriginSecurity}}{{.OtherOriginSecurity}}{{else}}None{{end}}</p>
	</details>
</section>
<section>
	<details>
		<summary><h2>Core Features</h2></summary>
		<h3>Query String Handling</h3>
		<p>{{.QueryStringHandling}}</p>
		<h3>Range Request Handling</h3>
		<p>{{.RangeRequestHandling}}</p>
		<h3>Signed URLs / URL Tokenization</h3>
		<p>{{.HasSignedURLs}}</p>
		<h3>Negative Caching Customization</h3>
		<p>{{.HasNegativeCachingCustomization}}</p>
		{{if or .HasNegativeCachingCustomization .NegativeCachingCustomizationNote }}<aside>
			<p>{{.NegativeCachingCustomizationNote}}</p>
		</aside>{{else if .HasNegativeCachingCustomization}}<aside>
			<p><b>No instructions given!</b></p>
		</aside>{{end}}
		{{if .ServiceAliases}}<h3>Service Aliases</h3>
		<ul>{{range .ServiceAliases}}
			<li>{{.}}</li>{{end}}
		</ul>{{end}}
	</details>
</section>
{{if or .RateLimitingGBPS .RateLimitingTPS .OverflowService}}<section>
	<details>
		<summary><h2>Service Limits</h2></summary>
		{{if .RateLimitingGBPS}}<h3>Bandwidth Limit</h3>
		<p>{{.RateLimitingGBPS}}GBps</p>{{end}}
		{{if .RateLimitingTPS}}<h3>Transactions per Second Limit</h3>
		<p>{{.RateLimitingTPS}}Tps</p>{{end}}
		{{if .OverflowService}}<h3>Overflow Service</h3>
		<p>{{.OverflowService}}</p>{{end}}
	</details>
</section>{{end}}
{{if or .HeaderRewriteEdge .HeaderRewriteMid .HeaderRewriteRedirectRouter}}<section>
	<details>
		<summary><h2>Header Customization</h2></summary>
		{{if .HeaderRewriteEdge}}<h3>Header Rewrite - Edge Tier</h3>
		<pre>{{.HeaderRewriteEdge}}</pre>{{end}}
		{{if .HeaderRewriteMid}}<h3>Header Rewrite - Mid Tier</h3>
		<pre>{{.HeaderRewriteMid}}</pre>{{end}}
		{{if .HeaderRewriteRedirectRouter}}<h3>Header Rewrite - Router</h3>
		<pre>{{.HeaderRewriteRedirectRouter}}</pre>{{end}}
	</details>
</section>{{end}}
{{if .Notes}}<section>
	<details>
		<summary><h2>Additional Notes</h2></summary>
		<p>{{.Notes}}</p>
	</details>
</section>{{end}}
</body>
</html>
`))

EmailTemplate is an html/template.Template for formatting DeliveryServiceRequestRequests into text/html email bodies. Its direct use is discouraged, instead use DeliveryServiceRequestRequest.Format.

Deprecated: Delivery Services Requests have been deprecated in favor of Delivery Service Requests, and will be removed from the Traffic Ops API at some point in the future.

View Source
var RequestStatuses = []RequestStatus{

	"draft",
	"submitted",
	"rejected",
	"pending",
	"complete",
}

RequestStatuses -- user-visible string associated with each of the above.

View Source
var StatusKey = "status"

StatusKey holds the text of the status key of a Request Context.

View Source
var TrafficStatsDurationPattern = regexp.MustCompile(`^\d+[mhdw]$`)

TrafficStatsDurationPattern reflects all the possible durations that can be requested via the /deliveryservice_stats endpoint.

View Source
var ValidJobRegexPrefix = regexp.MustCompile(`^\?/.*$`)

ValidJobRegexPrefix matches the only valid prefixes for a relative-path Content Invalidation Job regular expression.

Functions

func CDNExistsByName

func CDNExistsByName(name string, tx *sql.Tx) (bool, error)

CDNExistsByName returns whether a cdn with the given name exists, and any error. TODO move to helper package.

func CRStatesMarshall

func CRStatesMarshall(states CRStates) ([]byte, error)

CRStatesMarshall serializes the given CRStates into bytes.

func DurationLiteralToSeconds

func DurationLiteralToSeconds(d string) (int64, error)

DurationLiteralToSeconds returns the number of seconds to which an InfluxQL duration literal is equivalent. For invalid objects, it returns -1 - otherwise it will always, of course be > 0.

func GetHandleErrorsFunc deprecated

func GetHandleErrorsFunc(w http.ResponseWriter, r *http.Request) func(status int, errs ...error)

GetHandleErrorsFunc is used to provide an error-handling function. The error handler provides a response to an HTTP request made to the Traffic Ops API and accepts a response code and a set of errors to display as alerts.

Deprecated: Traffic Ops API handlers should use github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.HandleErr instead.

func GetRenewalKid

func GetRenewalKid(set jwk.Set) *string

func GetTypeData

func GetTypeData(tx *sql.Tx, id int) (string, string, bool, error)

GetTypeData returns the type's name and use_in_table, true/false if the query returned data, and any error.

TODO: Move this to the DB helpers package.

func LegacyMonitorConfigValid deprecated

func LegacyMonitorConfigValid(cfg *LegacyTrafficMonitorConfigMap) error

LegacyMonitorConfigValid checks the validity of the passed LegacyTrafficMonitorConfigMap, returning an error if it is invalid.

Deprecated: LegacyTrafficMonitorConfigMap is deprecated, new code should use TrafficMonitorConfigMap instead.

func MessagesToString

func MessagesToString(msgs []influx.Message) string

MessagesToString converts a set of messages from an InfluxDB node into a single, print-able string.

func ParamExists

func ParamExists(id int64, tx *sql.Tx) (bool, error)

ParamExists returns whether a parameter with the given id exists, and any error. TODO move to helper package.

func ParamsExist

func ParamsExist(ids []int64, tx *sql.Tx) (bool, error)

ParamsExist returns whether parameters exist for all the given ids, and any error. TODO move to helper package.

func ProfileExistsByID

func ProfileExistsByID(id int64, tx *sql.Tx) (bool, error)

ProfileExistsByID returns whether a profile with the given id exists, and any error. TODO move to helper package.

func ProfileExistsByName

func ProfileExistsByName(name string, tx *sql.Tx) (bool, error)

ProfileExistsByName returns whether a profile with the given name exists, and any error. TODO move to helper package.

func ProfilesExistByIDs

func ProfilesExistByIDs(ids []int64, tx *sql.Tx) (bool, error)

ProfilesExistByIDs returns whether profiles exist for all the given ids, and any error. TODO move to helper package.

func ValidateJobUniqueness

func ValidateJobUniqueness(tx *sql.Tx, dsID uint, startTime time.Time, assetURL string, ttlHours uint) []string

ValidateJobUniqueness returns a message describing each overlap between existing content invalidation jobs for the same assetURL as the one passed.

TODO: This doesn't belong in the lib, and it swallows errors because it can't log them.

func ValidateTypeID

func ValidateTypeID(tx *sql.Tx, typeID *int, expectedUseInTable string) (string, error)

ValidateTypeID validates that the typeID references a type with the expected use_in_table string and returns "" and an error if the typeID is invalid. If valid, the type's name is returned.

TODO: Move this to the DB helpers package.

Types

type APICapability

type APICapability struct {
	ID          int       `json:"id" db:"id"`
	HTTPMethod  string    `json:"httpMethod" db:"http_method"`
	Route       string    `json:"httpRoute" db:"route"`
	Capability  string    `json:"capability" db:"capability"`
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

APICapability represents an association between a Traffic Ops API route and a required capability.

type APICapabilityResponse

type APICapabilityResponse struct {
	Response []APICapability `json:"response"`
	Alerts
}

APICapabilityResponse represents an HTTP response to an API Capability request.

type ASN

type ASN struct {
	// The ASN to retrieve
	//
	// Autonomous System Numbers per APNIC for identifying a service provider
	// required: true
	ASN int `json:"asn" db:"asn"`

	// Related cachegroup name
	//
	Cachegroup string `json:"cachegroup" db:"cachegroup"`

	// Related cachegroup id
	//
	CachegroupID int `json:"cachegroupId" db:"cachegroup_id"`

	// ID of the ASN
	//
	// required: true
	ID int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated string `json:"lastUpdated" db:"last_updated"`
}

ASN contains info relating to a single Autonomous System Number (see RFC 1930).

type ASNNullable

type ASNNullable struct {
	// The ASN to retrieve
	//
	// Autonomous System Numbers per APNIC for identifying a service provider
	// required: true
	ASN *int `json:"asn" db:"asn"`

	// Related cachegroup name
	//
	Cachegroup *string `json:"cachegroup" db:"cachegroup"`

	// Related cachegroup id
	//
	CachegroupID *int `json:"cachegroupId" db:"cachegroup_id"`

	// ID of the ASN
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

ASNNullable contains info related to a single Autonomous System Number (see RFC 1930). Unlike ASN, ASNNullable's fields are nullable.

type ASNResponse

type ASNResponse struct {
	// in: body
	Response ASN `json:"response"`
	Alerts
}

ASNResponse is a single ASN response for Update and Create to depict what changed. swagger:response ASNResponse in: body

type ASNsResponse

type ASNsResponse struct {
	// in: body
	Response []ASN `json:"response"`
	Alerts
}

ASNsResponse is a list of ASNs (Autonomous System Numbers) as a response. swagger:response ASNsResponse in: body

type ASNsV11

type ASNsV11 struct {
	ASNs []interface{} `json:"asns"`
}

ASNsV11 is used for the Traffic OPS API version 1.1, which lists ASNs (Autonomous System Numbers) under its own key in the response and does not validate structure. The Traffic Ops API uses its own TOASNV11 instead.

type AcmeAccount

type AcmeAccount struct {
	Email      *string `json:"email" db:"email"`
	PrivateKey *string `json:"privateKey" db:"private_key"`
	Uri        *string `json:"uri" db:"uri"`
	Provider   *string `json:"provider" db:"provider"`
}

AcmeAccount is the information needed to access an account with an ACME provider.

func (*AcmeAccount) Validate

func (aa *AcmeAccount) Validate(tx *sql.Tx) error

Validate validates the AcmeAccount request is valid for creation or update.

type Alert

type Alert struct {
	// Text is the actual message being conveyed.
	Text string `json:"text"`
	// Level describes what kind of message is being relayed. In practice, it should be the string
	// representation of one of ErrorLevel, WarningLevel, InfoLevel or SuccessLevel.
	Level string `json:"level"`
}

Alert represents an informational message, typically returned through the Traffic Ops API.

type AlertLevel

type AlertLevel int

AlertLevel is used for specifying or comparing different levels of alerts.

const (
	// SuccessLevel indicates that an action is successful.
	SuccessLevel AlertLevel = iota

	// InfoLevel indicates that the message is supplementary and is not directly
	// the result of the user's request.
	InfoLevel

	// WarnLevel indicates dangerous but non-failing conditions.
	WarnLevel

	// ErrorLevel indicates that the request failed.
	ErrorLevel
)

func (AlertLevel) String

func (a AlertLevel) String() string

String returns the string representation of an AlertLevel.

type Alerts

type Alerts struct {
	Alerts []Alert `json:"alerts"`
}

Alerts is merely a collection of arbitrary "Alert"s for ease of use in other structures, most notably those used in Traffic Ops API responses.

func CreateAlerts

func CreateAlerts(level AlertLevel, messages ...string) Alerts

CreateAlerts creates and returns an Alerts structure filled with "Alert"s that are all of the provided level, each having one of messages as text in turn.

Example
alerts := CreateAlerts(InfoLevel, "foo", "bar")
fmt.Printf("%d\n", len(alerts.Alerts))
fmt.Printf("Level: %s, Text: %s\n", alerts.Alerts[0].Level, alerts.Alerts[0].Text)
fmt.Printf("Level: %s, Text: %s\n", alerts.Alerts[1].Level, alerts.Alerts[1].Text)
Output:

2
Level: info, Text: foo
Level: info, Text: bar

func CreateErrorAlerts

func CreateErrorAlerts(errs ...error) Alerts

CreateErrorAlerts creates and returns an Alerts structure filled with ErrorLevel-level "Alert"s using the errors to provide text.

Example
alerts := CreateErrorAlerts(errors.New("foo"))
fmt.Printf("%v\n", alerts)
Output:

{[{foo error}]}

func (*Alerts) AddAlert

func (self *Alerts) AddAlert(alert Alert)

AddAlert appends an alert to the Alerts structure.

Example
var alerts Alerts
fmt.Printf("%d\n", len(alerts.Alerts))
alert := Alert{
	Level: InfoLevel.String(),
	Text:  "foo",
}
alerts.AddAlert(alert)
fmt.Printf("%d\n", len(alerts.Alerts))
fmt.Printf("Level: %s, Text: %s\n", alerts.Alerts[0].Level, alerts.Alerts[0].Text)
Output:

0
1
Level: info, Text: foo

func (*Alerts) AddAlerts

func (self *Alerts) AddAlerts(alerts Alerts)

AddAlerts appends all of the "Alert"s in the given Alerts structure to this Alerts structure.

Example
alerts1 := Alerts{
	[]Alert{
		{
			Level: InfoLevel.String(),
			Text:  "foo",
		},
	},
}
alerts2 := Alerts{
	[]Alert{
		{
			Level: ErrorLevel.String(),
			Text:  "bar",
		},
	},
}

alerts1.AddAlerts(alerts2)
fmt.Printf("%d\n", len(alerts1.Alerts))
fmt.Printf("Level: %s, Text: %s\n", alerts1.Alerts[0].Level, alerts1.Alerts[0].Text)
fmt.Printf("Level: %s, Text: %s\n", alerts1.Alerts[1].Level, alerts1.Alerts[1].Text)
Output:

2
Level: info, Text: foo
Level: error, Text: bar

func (*Alerts) AddNewAlert

func (self *Alerts) AddNewAlert(level AlertLevel, text string)

AddNewAlert constructs a new Alert with the given Level and Text and appends it to the Alerts structure.

Example
var alerts Alerts
fmt.Printf("%d\n", len(alerts.Alerts))
alerts.AddNewAlert(InfoLevel, "foo")
fmt.Printf("%d\n", len(alerts.Alerts))
fmt.Printf("Level: %s, Text: %s\n", alerts.Alerts[0].Level, alerts.Alerts[0].Text)
Output:

0
1
Level: info, Text: foo

func (Alerts) ErrorString

func (self Alerts) ErrorString() string

ErrorString concatenates any and all Error-Level alerts in the Alerts to make one string representative of any reported errors.

Example
alerts := CreateErrorAlerts(errors.New("foo"), errors.New("bar"))
fmt.Println(alerts.ErrorString())

alerts = CreateAlerts(WarnLevel, "test")
alerts.AddAlert(Alert{Level: InfoLevel.String(), Text: "quest"})
fmt.Println(alerts.ErrorString())
Output:

foo; bar

func (*Alerts) HasAlerts

func (self *Alerts) HasAlerts() bool

HasAlerts returns if the Alerts contains any "alert"s.

func (*Alerts) ToStrings

func (alerts *Alerts) ToStrings() []string

ToStrings converts Alerts to a slice of strings that are their messages. Note that this return value doesn't contain their Levels anywhere.

Example
alerts := CreateAlerts(InfoLevel, "foo", "bar")
strs := alerts.ToStrings()
fmt.Printf("%d\n%s\n%s\n", len(strs), strs[0], strs[1])
Output:

2
foo
bar

type AllCacheGroupParametersResponse deprecated

type AllCacheGroupParametersResponse struct {
	Response CacheGroupParametersList `json:"response"`
	Alerts
}

AllCacheGroupParametersResponse is a Cache Group Parameter response body.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type AllDeliveryServiceFederationsMapping

type AllDeliveryServiceFederationsMapping struct {
	Mappings        []FederationResolverMapping `json:"mappings"`
	DeliveryService DeliveryServiceName         `json:"deliveryService"`
}

AllDeliveryServiceFederationsMapping is a structure that contains identifying information for a Delivery Service as well as any and all Federation Resolver mapping assigned to it (or all those getting assigned to it).

func (AllDeliveryServiceFederationsMapping) IsAllFederations

func (a AllDeliveryServiceFederationsMapping) IsAllFederations() bool

IsAllFederations implements the IAllFederation interface. Always returns true.

type AllFederationCDN

type AllFederationCDN struct {
	CDNName *CDNName `json:"cdnName"`
}

AllFederationCDN is the structure of a response from Traffic Ops to a GET request made to its /federations/all endpoint.

func (AllFederationCDN) IsAllFederations

func (a AllFederationCDN) IsAllFederations() bool

IsAllFederations implements the IAllFederation interface. Always returns true.

type AssignFederationFederationResolversResponse

type AssignFederationFederationResolversResponse struct {
	Response AssignFederationResolversRequest `json:"response"`
	Alerts
}

AssignFederationFederationResolversResponse represents an API response for assigning a Federation Resolver to a Federation.

type AssignFederationResolversRequest

type AssignFederationResolversRequest struct {
	Replace        bool  `json:"replace"`
	FedResolverIDs []int `json:"fedResolverIds"`
}

AssignFederationResolversRequest represents an API request/response for assigning Federation Resolvers to a Federation.

type AssignedDsResponse

type AssignedDsResponse struct {
	ServerID int   `json:"serverId"`
	DSIds    []int `json:"dsIds"`
	Replace  bool  `json:"replace"`
}

AssignedDsResponse is the type of the `response` property of a response from Traffic Ops to a POST request made to its /servers/{{ID}}/deliveryservices API endpoint.

type AsyncStatus

type AsyncStatus struct {
	// Id is the integral, unique identifier for the asynchronous job status.
	Id int `json:"id,omitempty" db:"id"`
	// Status is the status of the asynchronous job. This will be PENDING, SUCCEEDED, or FAILED.
	Status string `json:"status,omitempty" db:"status"`
	// StartTime is the time the asynchronous job was started.
	StartTime time.Time `json:"start_time,omitempty" db:"start_time"`
	// EndTime is the time the asynchronous job completed. This will be null if it has not completed yet.
	EndTime *time.Time `json:"end_time,omitempty" db:"end_time"`
	// Message is the message about the job status.
	Message *string `json:"message,omitempty" db:"message"`
}

AsyncStatus represents an async job status.

type AsyncStatusResponse

type AsyncStatusResponse struct {
	Response AsyncStatus `json:"response"`
	Alerts
}

AsyncStatusResponse represents the response from the GET /async_status/{id} API.

type BypassDestination

type BypassDestination struct {
	FQDN string `json:"fqdn"`
	Type string `json:"type"`
	Port int    `json:"Port"`
}

A BypassDestination is an FQDN, IP address, or CNAME to use for redirection in the event that bypass becomes necessary.

type CDN

type CDN struct {

	// The CDN to retrieve
	//
	// enables Domain Name Security Extensions on the specified CDN
	//
	// required: true
	DNSSECEnabled bool `json:"dnssecEnabled" db:"dnssec_enabled"`

	// DomainName of the CDN
	//
	// required: true
	DomainName string `json:"domainName" db:"domain_name"`

	// ID of the CDN
	//
	// required: true
	ID int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// Name of the CDN
	//
	// required: true
	Name string `json:"name" db:"name"`
}

A CDN represents a set of configuration and hardware that can be used to serve content within a specific top-level domain.

type CDNConfig

type CDNConfig struct {
	Name *string `json:"name"`
	ID   *int    `json:"id"`
}

CDNConfig includes the name and ID of a single CDN configuration.

type CDNDNSSECGenerateReq

type CDNDNSSECGenerateReq struct {
	// Key is the CDN name, as documented in the API documentation.
	Key               *string                   `json:"key"`
	TTL               *util.JSONIntStr          `json:"ttl"`
	KSKExpirationDays *util.JSONIntStr          `json:"kskExpirationDays"`
	ZSKExpirationDays *util.JSONIntStr          `json:"zskExpirationDays"`
	EffectiveDateUnix *CDNDNSSECGenerateReqDate `json:"effectiveDate"`
}

A CDNDNSSECGenerateReq is the structure used to request generation of CDN DNSSEC Keys through the Traffic Ops API's /cdns/dnsseckeys/generate endpoint.

func (CDNDNSSECGenerateReq) Validate

func (r CDNDNSSECGenerateReq) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type CDNDNSSECGenerateReqDate

type CDNDNSSECGenerateReqDate int64

CDNDNSSECGenerateReqDate is the date accepted by CDNDNSSECGenerateReq. This will unmarshal a UNIX epoch integer, a RFC3339 string, the old format string used by Perl '2018-08-21+14:26:06', and the old format string sent by the Portal '2018-08-21 14:14:42'. This exists to fix a critical bug, see https://github.com/apache/trafficcontrol/issues/2723 - it SHOULD NOT be used by any other endpoint.

func (*CDNDNSSECGenerateReqDate) UnmarshalJSON

func (i *CDNDNSSECGenerateReqDate) UnmarshalJSON(d []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

type CDNDNSSECKeysResponse

type CDNDNSSECKeysResponse struct {
	Response DNSSECKeys `json:"response"`
	Alerts
}

CDNDNSSECKeysResponse is the type of a response from Traffic Ops to GET requests made to its /cdns/name/{{name}}/dnsseckeys API endpoint.

type CDNFederation

type CDNFederation struct {
	ID          *int       `json:"id" db:"id"`
	CName       *string    `json:"cname" db:"cname"`
	TTL         *int       `json:"ttl" db:"ttl"`
	Description *string    `json:"description" db:"description"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// omitempty only works with primitive types and pointers
	*DeliveryServiceIDs `json:"deliveryService,omitempty"`
}

CDNFederation represents a Federation.

type CDNFederationResponse

type CDNFederationResponse struct {
	Response []CDNFederation `json:"response"`
	Alerts
}

CDNFederationResponse represents a Traffic Ops API response to a request for one or more of a CDN's Federations.

type CDNGenerateKSKReq

type CDNGenerateKSKReq struct {
	ExpirationDays *uint64    `json:"expirationDays"`
	EffectiveDate  *time.Time `json:"effectiveDate"`
}

A CDNGenerateKSKReq is a request to generate Key-Signing Keys for CDNs for use in DNSSEC operations, and is the structure required for the bodies of POST requests made to the /cdns/{{Name}}/dnsseckeys/ksk/generate endpoint of the Traffic Ops API.

func (*CDNGenerateKSKReq) Sanitize

func (r *CDNGenerateKSKReq) Sanitize()

Sanitize ensures that the CDNGenerateKSKReq's EffectiveDate is not nil.

If it was nil, this will set it to the current time.

func (*CDNGenerateKSKReq) Validate

func (r *CDNGenerateKSKReq) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type CDNLock

type CDNLock struct {
	UserName    string    `json:"userName" db:"username"`
	CDN         string    `json:"cdn" db:"cdn"`
	Message     *string   `json:"message" db:"message"`
	Soft        *bool     `json:"soft" db:"soft"`
	LastUpdated time.Time `json:"lastUpdated" db:"last_updated"`
}

CDNLock is a struct to store the details of a lock that a user wishes to acquire on a CDN.

type CDNLockCreateResponse

type CDNLockCreateResponse struct {
	Response CDNLock `json:"response"`
	Alerts
}

CDNLockCreateResponse is a struct to store the response of a CREATE operation on a lock.

type CDNLockDeleteResponse

type CDNLockDeleteResponse CDNLockCreateResponse

CDNLockDeleteResponse is a struct to store the response of a DELETE operation on a lock.

type CDNLocksGetResponse

type CDNLocksGetResponse struct {
	Response []CDNLock `json:"response"`
	Alerts
}

CDNLocksGetResponse is a struct to store the response of a GET operation on locks.

type CDNName

type CDNName string

CDNName is the name of a CDN in Traffic Control.

type CDNNotification

type CDNNotification struct {
	ID           int       `json:"id" db:"id"`
	CDN          string    `json:"cdn" db:"cdn"`
	LastUpdated  time.Time `json:"lastUpdated" db:"last_updated"`
	Notification string    `json:"notification" db:"notification"`
	User         string    `json:"user" db:"user"`
}

CDNNotification is a notification created for a specific CDN.

type CDNNotificationRequest

type CDNNotificationRequest struct {
	CDN          string `json:"cdn"`
	Notification string `json:"notification"`
}

CDNNotificationRequest encodes the request data for the POST cdn_notifications endpoint.

func (*CDNNotificationRequest) Validate

func (n *CDNNotificationRequest) Validate(tx *sql.Tx) error

Validate validates the CDNNotificationRequest request is valid for creation.

type CDNNotificationsResponse

type CDNNotificationsResponse struct {
	Response []CDNNotification `json:"response"`
	Alerts
}

CDNNotificationsResponse is a list of CDN notifications as a response.

type CDNNullable

type CDNNullable struct {

	// The CDN to retrieve
	//
	// enables Domain Name Security Extensions on the specified CDN
	//
	// required: true
	DNSSECEnabled *bool `json:"dnssecEnabled" db:"dnssec_enabled"`

	// DomainName of the CDN
	//
	// required: true
	DomainName *string `json:"domainName" db:"domain_name"`

	// ID of the CDN
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// Name of the CDN
	//
	// required: true
	Name *string `json:"name" db:"name"`
}

CDNNullable is identical to CDN except that its fields are reference values, which allows them to be nil.

type CDNQueueUpdateRequest

type CDNQueueUpdateRequest ServerQueueUpdateRequest

CDNQueueUpdateRequest encodes the request data for the POST cdns/{{ID}}/queue_update endpoint.

type CDNQueueUpdateResponse

type CDNQueueUpdateResponse struct {
	Action string `json:"action"`
	CDNID  int64  `json:"cdnId"`
}

CDNQueueUpdateResponse encodes the response data for the POST cdns/{{ID}}/queue_update endpoint.

type CDNResponse

type CDNResponse struct {
	// in: body
	Response CDN `json:"response"`
	Alerts
}

CDNResponse is a single CDN response for Update and Create to depict what changed. swagger:response CDNResponse in: body

type CDNSSLKey

type CDNSSLKey struct {
	DeliveryService string        `json:"deliveryservice"`
	HostName        string        `json:"hostname"`
	Certificate     CDNSSLKeyCert `json:"certificate"`
}

CDNSSLKey structures represent an SSL key/certificate pair used by a CDN. This is the structure used by each entry of the `response` array property of responses from Traffic Ops to GET requests made to its /cdns/name/{{Name}}/sslkeys API endpoint.

type CDNSSLKeyCert

type CDNSSLKeyCert struct {
	Crt string `json:"crt"`
	Key string `json:"key"`
}

A CDNSSLKeyCert represents an SSL key/certificate pair used by a CDN, without any other associated data.

type CDNSSLKeys

type CDNSSLKeys struct {
	DeliveryService string                `json:"deliveryservice"`
	Certificate     CDNSSLKeysCertificate `json:"certificate"`
	Hostname        string                `json:"hostname"`
}

CDNSSLKeys is an SSL key/certificate pair for a certain Delivery Service.

type CDNSSLKeysCertificate

type CDNSSLKeysCertificate struct {
	Crt string `json:"crt"`
	Key string `json:"key"`
}

CDNSSLKeysCertificate is an SSL key/certificate pair.

type CDNSSLKeysResp deprecated

type CDNSSLKeysResp []CDNSSLKey

CDNSSLKeysResp is a slice of CDNSSLKeys.

Deprecated: This is not used by any known ATC code and has no known purpose. Therefore, it's probably just technical debt subject to removal in the near future.

type CDNSSLKeysResponse

type CDNSSLKeysResponse struct {
	Response []CDNSSLKeys `json:"response"`
	Alerts
}

CDNSSLKeysResponse is the structure of the Traffic Ops API's response to requests made to its /cdns/name/{{name}}/sslkeys endpoint.

type CDNsResponse

type CDNsResponse struct {
	// in: body
	Response []CDN `json:"response"`
	Alerts
}

CDNsResponse is a list of CDNs as a response. swagger:response CDNsResponse in: body

type CRConfig

type CRConfig struct {
	// Config is mostly a map of string values, but may contain an 'soa' key which is a map[string]string, and may contain a 'ttls' key with a value map[string]string. It might not contain these values, so they must be checked for, and all values must be checked by the user and an error returned if the type is unexpected. Be aware, neither the language nor the API provides any guarantees about the type!
	Config           map[string]interface{}               `json:"config,omitempty"`
	ContentServers   map[string]CRConfigTrafficOpsServer  `json:"contentServers,omitempty"`
	ContentRouters   map[string]CRConfigRouter            `json:"contentRouters,omitempty"`
	DeliveryServices map[string]CRConfigDeliveryService   `json:"deliveryServices,omitempty"`
	EdgeLocations    map[string]CRConfigLatitudeLongitude `json:"edgeLocations,omitempty"`
	RouterLocations  map[string]CRConfigLatitudeLongitude `json:"trafficRouterLocations,omitempty"`
	Monitors         map[string]CRConfigMonitor           `json:"monitors,omitempty"`
	Stats            CRConfigStats                        `json:"stats,omitempty"`
	Topologies       map[string]CRConfigTopology          `json:"topologies,omitempty"`
}

CRConfig is JSON-serializable as the CRConfig used by Traffic Control.

type CRConfigBackupLocations

type CRConfigBackupLocations struct {
	FallbackToClosest bool     `json:"fallbackToClosest,string"`
	List              []string `json:"list,omitempty"`
}

CRConfigBackupLocations defines how a Traffic Router should handle traffic normally bound for a given CRConfigLatitudeLongitude in the event that said CRConfigLatitudeLongitude becomes unavailable, named with "CRConfig" for legacy reasons.

type CRConfigBypassDestination

type CRConfigBypassDestination struct {
	IP    *string `json:"ip,omitempty"`    // only used by DNS DSes
	IP6   *string `json:"ip6,omitempty"`   // only used by DNS DSes
	CName *string `json:"cname,omitempty"` // only used by DNS DSes
	TTL   *int    `json:"ttl,omitempty"`   // only used by DNS DSes
	FQDN  *string `json:"fqdn,omitempty"`  // only used by HTTP DSes
	Port  *string `json:"port,omitempty"`  // only used by HTTP DSes
}

CRConfigBypassDestination is a network location to which excess traffic requesting a Delivery Service's content will be directed when the Service's ability to deliver content is deemed to be saturated, named with "CRConfig" for legacy reasons.

This is generated based on the Delivery Service's Type (specifically whether it is DNS-routed or HTTP-routed) and its HTTP Bypass FQDN, DNS Bypass CNAME, DNS Bypass IP, DNS Bypass IPv6, and DNS Bypass TTL properties.

type CRConfigConfig

type CRConfigConfig struct {
	APICacheControlMaxAge                      *string      `json:"api.cache-control.max-age,omitempty"`
	ConsistentDNSRouting                       *string      `json:"consistent.dns.routing,omitempty"`
	CoverageZonePollingIntervalSeconds         *string      `json:"coveragezone.polling.interval,omitempty"`
	CoverageZonePollingURL                     *string      `json:"coveragezone.polling.url,omitempty"`
	DNSSecDynamicResponseExpiration            *string      `json:"dnssec.dynamic.response.expiration,omitempty"`
	DNSSecEnabled                              *string      `json:"dnssec.enabled,omitempty"`
	DomainName                                 *string      `json:"domain_name,omitempty"`
	FederationMappingPollingIntervalSeconds    *string      `json:"federationmapping.polling.interval,omitempty"`
	FederationMappingPollingURL                *string      `json:"federationmapping.polling.url"`
	GeoLocationPollingInterval                 *string      `json:"geolocation.polling.interval,omitempty"`
	GeoLocationPollingURL                      *string      `json:"geolocation.polling.url,omitempty"`
	KeyStoreMaintenanceIntervalSeconds         *string      `json:"keystore.maintenance.interval,omitempty"`
	NeustarPollingIntervalSeconds              *string      `json:"neustar.polling.interval,omitempty"`
	NeustarPollingURL                          *string      `json:"neustar.polling.url,omitempty"`
	SOA                                        *SOA         `json:"soa,omitempty"`
	DNSSecInceptionSeconds                     *string      `json:"dnssec.inception,omitempty"`
	Ttls                                       *CRConfigTTL `json:"ttls,omitempty"`
	Weight                                     *string      `json:"weight,omitempty"`
	ZoneManagerCacheMaintenanceIntervalSeconds *string      `json:"zonemanager.cache.maintenance.interval,omitempty"`
	ZoneManagerThreadpoolScale                 *string      `json:"zonemanager.threadpool.scale,omitempty"`
}

CRConfigConfig used to be the type of CRConfig's Config field, though CRConfigConfig is no longer used.

type CRConfigDeliveryService

type CRConfigDeliveryService struct {
	AnonymousBlockingEnabled  *string                               `json:"anonymousBlockingEnabled,omitempty"`
	BypassDestination         map[string]*CRConfigBypassDestination `json:"bypassDestination,omitempty"`
	ConsistentHashQueryParams []string                              `json:"consistentHashQueryParams,omitempty"`
	ConsistentHashRegex       *string                               `json:"consistentHashRegex,omitempty"`
	CoverageZoneOnly          bool                                  `json:"coverageZoneOnly,string"`
	DeepCachingType           *DeepCachingType                      `json:"deepCachingType"`
	Dispersion                *CRConfigDispersion                   `json:"dispersion,omitempty"`
	Domains                   []string                              `json:"domains,omitempty"`
	EcsEnabled                *bool                                 `json:"ecsEnabled,string,omitempty"`
	GeoEnabled                []CRConfigGeoEnabled                  `json:"geoEnabled,omitempty"`
	GeoLimitRedirectURL       *string                               `json:"geoLimitRedirectURL,omitempty"`
	GeoLocationProvider       *string                               `json:"geolocationProvider,omitempty"`
	IP6RoutingEnabled         *bool                                 `json:"ip6RoutingEnabled,string,omitempty"`
	MatchSets                 []*MatchSet                           `json:"matchsets,omitempty"`
	MaxDNSIPsForLocation      *int                                  `json:"maxDnsIpsForLocation,omitempty"`
	MissLocation              *CRConfigLatitudeLongitudeShort       `json:"missLocation,omitempty"`
	Protocol                  *CRConfigDeliveryServiceProtocol      `json:"protocol,omitempty"`
	RegionalGeoBlocking       *string                               `json:"regionalGeoBlocking,omitempty"`
	RequestHeaders            []string                              `json:"requestHeaders,omitempty"`
	RequiredCapabilities      []string                              `json:"requiredCapabilities,omitempty"`
	ResponseHeaders           map[string]string                     `json:"responseHeaders,omitempty"`
	RoutingName               *string                               `json:"routingName,omitempty"`
	Soa                       *SOA                                  `json:"soa,omitempty"`
	SSLEnabled                bool                                  `json:"sslEnabled,string"`
	StaticDNSEntries          []CRConfigStaticDNSEntry              `json:"staticDnsEntries,omitempty"`
	Topology                  *string                               `json:"topology,omitempty"`
	TTL                       *int                                  `json:"ttl,omitempty"`
	TTLs                      *CRConfigTTL                          `json:"ttls,omitempty"`
}

CRConfigDeliveryService represents a Delivery Service as they appear in CDN Snapshots, named with "CRConfig" for legacy reasons.

type CRConfigDeliveryServiceProtocol

type CRConfigDeliveryServiceProtocol struct {
	AcceptHTTP      *bool `json:"acceptHttp,string,omitempty"`
	AcceptHTTPS     bool  `json:"acceptHttps,string"`
	RedirectOnHTTPS bool  `json:"redirectToHttps,string"`
}

CRConfigDeliveryServiceProtocol is used in CDN Snapshots to define the protocols used to access Delivery Service content, named with "CRConfig" for legacy reasons.

This is generated for Delivery Services based on their Protocol property.

type CRConfigDispersion

type CRConfigDispersion struct {
	Limit    int  `json:"limit"`
	Shuffled bool `json:"shuffled,string"`
}

CRConfigDispersion defines for a Delivery Service appearing in a CDN Snapshot the number of cache servers to which its content is initially distributed, named with "CRConfig" for legacy reasons.

This is generated from a Delivery Service's Initial Dispersion property.

type CRConfigGeoEnabled

type CRConfigGeoEnabled struct {
	CountryCode string `json:"countryCode"`
}

CRConfigGeoEnabled is a structure that contains information describing a geographical location allowed to access a Delivery Service's content, named with "CRConfig" for legacy reasons.

Presently, each CRConfigGeoEnabled in a CDN Snapshot's Delivery Service's GeoEnabled property is a single entry in the underlying, actual Delivery Service's Geo Limit Countries array.

type CRConfigLatitudeLongitude

type CRConfigLatitudeLongitude struct {
	Lat                 float64                 `json:"latitude"`
	Lon                 float64                 `json:"longitude"`
	BackupLocations     CRConfigBackupLocations `json:"backupLocations,omitempty"`
	LocalizationMethods []LocalizationMethod    `json:"localizationMethods"`
}

CRConfigLatitudeLongitude structures are geographical locations for routing purpose that can contain either edge-tier cache servers or Traffic Routers (but not a mixture of both), named with "CRConfig" for legacy reasons.

In general, any given CRConfigLatitudeLongitude represents a Cache Group object.

type CRConfigLatitudeLongitudeShort

type CRConfigLatitudeLongitudeShort struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"long"`
}

CRConfigLatitudeLongitudeShort is a geographical location where clients will be assumed to be located if determining their location fails (a "Geo Miss"), named with "CRConfig" for legacy reasons.

These are generated for Delivery Services in CDN Snapshots from their Geo Miss Default Latitude and Geo Miss Default Longitude properties.

type CRConfigMonitor

type CRConfigMonitor struct {
	FQDN         *string               `json:"fqdn,omitempty"`
	HTTPSPort    *int                  `json:"httpsPort"`
	IP           *string               `json:"ip,omitempty"`
	IP6          *string               `json:"ip6,omitempty"`
	Location     *string               `json:"location,omitempty"`
	Port         *int                  `json:"port,omitempty"`
	Profile      *string               `json:"profile,omitempty"`
	ServerStatus *CRConfigServerStatus `json:"status,omitempty"`
}

CRConfigMonitor structures are used in CDN Snapshots to represent Traffic Monitors, named with "CRConfig" for legacy reasons.

type CRConfigRouter

type CRConfigRouter struct {
	APIPort       *string               `json:"api.port,omitempty"`
	FQDN          *string               `json:"fqdn,omitempty"`
	HTTPSPort     *int                  `json:"httpsPort"`
	HashCount     *int                  `json:"hashCount,omitempty"`
	IP            *string               `json:"ip,omitempty"`
	IP6           *string               `json:"ip6,omitempty"`
	Location      *string               `json:"location,omitempty"`
	Port          *int                  `json:"port,omitempty"`
	Profile       *string               `json:"profile,omitempty"`
	SecureAPIPort *string               `json:"secure.api.port,omitempty"`
	ServerStatus  *CRConfigRouterStatus `json:"status,omitempty"`
}

CRConfigRouter represents a Traffic Router as defined within a CDN Snapshot, named with "CRConfig" for legacy reasons.

type CRConfigRouterStatus

type CRConfigRouterStatus string

CRConfigRouterStatus is the name of the Status of a Traffic Router server object. This is only used in the context of CDN Snapshots, and has no special nuance or behavior not afforded to a regular string - so in general it is suggested that a string be used instead where possible, to keep compatibility with Server/ServerV4/ServerNullable etc. structures.

type CRConfigServerStatus

type CRConfigServerStatus string

CRConfigServerStatus is the name of the Status of a server object. This is only used in the context of CDN Snapshots, and has no special nuance or behavior not afforded to a regular string - so in general it is suggested that a string be used instead where possible, to keep compatibility with Server/ServerV4/ServerNullable etc. structures.

type CRConfigStaticDNSEntry

type CRConfigStaticDNSEntry struct {
	Name  string `json:"name"`
	TTL   int    `json:"ttl"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

CRConfigStaticDNSEntry structures encode a Static DNS Entry for a Delivery Service in a CDN Snapshot, named with "CRConfig" for legacy reasons.

type CRConfigStats

type CRConfigStats struct {
	CDNName         *string `json:"CDN_name,omitempty"`
	DateUnixSeconds *int64  `json:"date,omitempty"`
	TMHost          *string `json:"tm_host,omitempty"`
	// Deprecated: Don't ever use this for anything. It's been removed from APIv4 responses.
	TMPath    *string `json:"tm_path,omitempty"`
	TMUser    *string `json:"tm_user,omitempty"`
	TMVersion *string `json:"tm_version,omitempty"`
}

CRConfigStats is the type of the 'stats' property of a CDN Snapshot.

type CRConfigTTL

type CRConfigTTL struct {
	// A records
	ASeconds *string `json:"A,omitempty"`
	// AAAA records
	AAAASeconds *string `json:"AAAA,omitempty"`
	// DNSKEY records
	DNSkeySeconds *string `json:"DNSKEY,omitempty"`
	// DS records
	DSSeconds *string `json:"DS,omitempty"`
	// NS records
	NSSeconds *string `json:"NS,omitempty"`
	// SOA records
	SOASeconds *string `json:"SOA,omitempty"`
}

CRConfigTTL defines the Time-To-Live (TTL) of various record types served by Traffic Router.

Each TTL given is an optional field containing a number of seconds encoded as a string. If a field is nil, the CRConfigTTL is instructing Traffic Router to use its configured default for records of that type.

type CRConfigTopology

type CRConfigTopology struct {
	Nodes []string `json:"nodes"`
}

CRConfigTopology is the format in which Topologies are represented in a CDN Snapshot, named with "CRConfig" for legacy reasons.

CRConfigTopology structures do not include the Topologies' Names, because in a CDN Snapshot they are stored in a mapping of their Names to this structure.

type CRConfigTrafficOpsServer

type CRConfigTrafficOpsServer struct {
	CacheGroup       *string               `json:"cacheGroup,omitempty"`
	Capabilities     []string              `json:"capabilities,omitempty"`
	Fqdn             *string               `json:"fqdn,omitempty"`
	HashCount        *int                  `json:"hashCount,omitempty"`
	HashId           *string               `json:"hashId,omitempty"`
	HttpsPort        *int                  `json:"httpsPort"`
	InterfaceName    *string               `json:"interfaceName"`
	Ip               *string               `json:"ip,omitempty"`
	Ip6              *string               `json:"ip6,omitempty"`
	LocationId       *string               `json:"locationId,omitempty"`
	Port             *int                  `json:"port"`
	Profile          *string               `json:"profile,omitempty"`
	ServerStatus     *CRConfigServerStatus `json:"status,omitempty"`
	ServerType       *string               `json:"type,omitempty"`
	DeliveryServices map[string][]string   `json:"deliveryServices,omitempty"`
	RoutingDisabled  int64                 `json:"routingDisabled"`
}

CRConfigTrafficOpsServer represents a Traffic Ops instance as defined within a CDN Snapshot, named with "CRConfig" for legacy reasons.

type CRSStats

type CRSStats struct {
	App   CRSStatsApp   `json:"app"`
	Stats CRSStatsStats `json:"stats"`
}

CRSStats is the returned data from TRs stats endpoint.

type CRSStatsApp

type CRSStatsApp struct {
	BuildTimestamp string `json:"buildTimestamp"`
	Name           string `json:"name"`
	DeployDir      string `json:"deploy-dir"`
	GitRevision    string `json:"git-revision"`
	Version        string `json:"version"`
}

CRSStatsApp represents metadata about a given TR.

type CRSStatsStat

type CRSStatsStat struct {
	CZCount                uint64 `json:"czCount"`
	GeoCount               uint64 `json:"geoCount"`
	DeepCZCount            uint64 `json:"deepCzCount"`
	MissCount              uint64 `json:"missCount"`
	DSRCount               uint64 `json:"dsrCount"`
	ErrCount               uint64 `json:"errCount"`
	StaticRouteCount       uint64 `json:"staticRouteCount"`
	FedCount               uint64 `json:"fedCount"`
	RegionalDeniedCount    uint64 `json:"regionalDeniedCount"`
	RegionalAlternateCount uint64 `json:"regionalAlternateCount"`
}

CRSStatsStat represents an individual stat.

type CRSStatsStats

type CRSStatsStats struct {
	DNSMap  map[string]CRSStatsStat
	HTTPMap map[string]CRSStatsStat
}

CRSStatsStats represents stats about a given TR.

type CRStates

type CRStates struct {
	Caches          map[CacheName]IsAvailable                       `json:"caches"`
	DeliveryService map[DeliveryServiceName]CRStatesDeliveryService `json:"deliveryServices"`
}

CRStates includes availability data for caches and delivery services, as gathered and aggregated by this Traffic Monitor. It is designed to be served at an API endpoint primarily for Traffic Routers (Content Router) to consume.

func CRStatesUnMarshall

func CRStatesUnMarshall(body []byte) (CRStates, error)

CRStatesUnMarshall takes bytes of a JSON string, and unmarshals them into a CRStates object.

func NewCRStates

func NewCRStates() CRStates

NewCRStates creates a new CR states object, initializing pointer members.

func (CRStates) Copy

func (a CRStates) Copy() CRStates

Copy creates a deep copy of this object. It does not mutate, and is thus safe for multiple goroutines.

func (CRStates) CopyCaches

func (a CRStates) CopyCaches() map[CacheName]IsAvailable

CopyCaches creates a deep copy of the cache availability data.. It does not mutate, and is thus safe for multiple goroutines.

func (CRStates) CopyDeliveryServices

func (a CRStates) CopyDeliveryServices() map[DeliveryServiceName]CRStatesDeliveryService

CopyDeliveryServices creates a deep copy of the delivery service availability data.. It does not mutate, and is thus safe for multiple goroutines.

type CRStatesDeliveryService

type CRStatesDeliveryService struct {
	DisabledLocations []CacheGroupName `json:"disabledLocations"`
	IsAvailable       bool             `json:"isAvailable"`
}

CRStatesDeliveryService contains data about the availability of a particular delivery service, and which caches in that delivery service have been marked as unavailable.

type CacheGroup

type CacheGroup struct {
	ID                          int                  `json:"id" db:"id"`
	Name                        string               `json:"name" db:"name"`
	ShortName                   string               `json:"shortName" db:"short_name"`
	Latitude                    float64              `json:"latitude" db:"latitude"`
	Longitude                   float64              `json:"longitude" db:"longitude"`
	ParentName                  string               `json:"parentCachegroupName" db:"parent_cachegroup_name"`
	ParentCachegroupID          int                  `json:"parentCachegroupId" db:"parent_cachegroup_id"`
	SecondaryParentName         string               `json:"secondaryParentCachegroupName" db:"secondary_parent_cachegroup_name"`
	SecondaryParentCachegroupID int                  `json:"secondaryParentCachegroupId" db:"secondary_parent_cachegroup_id"`
	FallbackToClosest           bool                 `json:"fallbackToClosest" db:"fallback_to_closest"`
	LocalizationMethods         []LocalizationMethod `json:"localizationMethods" db:"localization_methods"`
	Type                        string               `json:"typeName" db:"type_name"` // aliased to type_name to disambiguate struct scans due to join on 'type' table
	TypeID                      int                  `json:"typeId" db:"type_id"`     // aliased to type_id to disambiguate struct scans due join on 'type' table
	LastUpdated                 TimeNoMod            `json:"lastUpdated" db:"last_updated"`
	Fallbacks                   []string             `json:"fallbacks" db:"fallbacks"`
}

CacheGroup contains information about a given cache group in Traffic Ops.

type CacheGroupDetailResponse

type CacheGroupDetailResponse struct {
	Response CacheGroupNullable `json:"response"`
	Alerts
}

CacheGroupDetailResponse is the JSON object returned for a single Cache Group.

type CacheGroupName

type CacheGroupName string

CacheGroupName is the name of a Cache Group.

type CacheGroupNullable

type CacheGroupNullable struct {
	ID                          *int                  `json:"id" db:"id"`
	Name                        *string               `json:"name" db:"name"`
	ShortName                   *string               `json:"shortName" db:"short_name"`
	Latitude                    *float64              `json:"latitude" db:"latitude"`
	Longitude                   *float64              `json:"longitude" db:"longitude"`
	ParentName                  *string               `json:"parentCachegroupName" db:"parent_cachegroup_name"`
	ParentCachegroupID          *int                  `json:"parentCachegroupId" db:"parent_cachegroup_id"`
	SecondaryParentName         *string               `json:"secondaryParentCachegroupName" db:"secondary_parent_cachegroup_name"`
	SecondaryParentCachegroupID *int                  `json:"secondaryParentCachegroupId" db:"secondary_parent_cachegroup_id"`
	FallbackToClosest           *bool                 `json:"fallbackToClosest" db:"fallback_to_closest"`
	LocalizationMethods         *[]LocalizationMethod `json:"localizationMethods" db:"localization_methods"`
	Type                        *string               `json:"typeName" db:"type_name"` // aliased to type_name to disambiguate struct scans due to join on 'type' table
	TypeID                      *int                  `json:"typeId" db:"type_id"`     // aliased to type_id to disambiguate struct scans due join on 'type' table
	LastUpdated                 *TimeNoMod            `json:"lastUpdated" db:"last_updated"`
	Fallbacks                   *[]string             `json:"fallbacks" db:"fallbacks"`
}

CacheGroupNullable contains information about a given cache group in Traffic Ops. Unlike CacheGroup, CacheGroupNullable's fields are nullable.

type CacheGroupParameter deprecated

type CacheGroupParameter struct {
	ConfigFile  string    `json:"configFile"`
	ID          int       `json:"id"`
	LastUpdated TimeNoMod `json:"lastUpdated"`
	Name        string    `json:"name"`
	Secure      bool      `json:"secure"`
	Value       string    `json:"value"`
}

A CacheGroupParameter is an object that represents a Parameter, but also implies that it is associated with a Cache Group rather than (or in addition to) a Profile.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParameterNullable deprecated

type CacheGroupParameterNullable struct {
	ConfigFile  *string    `json:"configFile" db:"config_file"`
	ID          *int       `json:"id" db:"id"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        *string    `json:"name" db:"name"`
	Secure      *bool      `json:"secure" db:"secure"`
	Value       *string    `json:"value" db:"value"`
}

A CacheGroupParameterNullable is an object that represents a Parameter, but also implies that it is associated with a Cache Group rather than (or in addition to) a Profile.

The only substantial difference between this and a CacheGroupParameter is that Go client methods unmarshal Traffic Ops responses into a CacheGroupParameter, while those responses are generated by marshalling data stored in CacheGroupParameterNullables.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParameterRequest deprecated

type CacheGroupParameterRequest struct {
	CacheGroupID int `json:"cacheGroupId"`
	ParameterID  int `json:"parameterId"`
}

CacheGroupParameterRequest is a Cache Group Parameter request body.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParametersList deprecated

type CacheGroupParametersList struct {
	CacheGroupParameters []CacheGroupParametersResponseNullable `json:"cachegroupParameters"`
}

CacheGroupParametersList is the type of the `response` property of Traffic Ops's responses to its /cachegroupparameters API endpoint.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParametersNullable deprecated

type CacheGroupParametersNullable struct {
	CacheGroup     *int       `json:"cacheGroupId"  db:"cachegroup"`
	CacheGroupName *string    `json:"cachegroup,omitempty"`
	Parameter      *int       `json:"parameterId"  db:"parameter"`
	LastUpdated    *TimeNoMod `json:"lastUpdated,omitempty"  db:"last_updated"`
}

CacheGroupParametersNullable is the type of a response from Traffic Ops to a POST request made to its /cachegroupparameters API endpoint.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParametersPostResponse deprecated

type CacheGroupParametersPostResponse struct {
	Response []CacheGroupParameterRequest `json:"response"`
	Alerts
}

CacheGroupParametersPostResponse Response body when Posting to associate a Parameter with a Cache Group.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParametersResponse deprecated

type CacheGroupParametersResponse struct {
	Response []CacheGroupParameter `json:"response"`
	Alerts
}

CacheGroupParametersResponse is a Cache Group Parameter response body.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupParametersResponseNullable deprecated

type CacheGroupParametersResponseNullable struct {
	CacheGroup  *string    `json:"cachegroup"  db:"cachegroup"`
	Parameter   *int       `json:"parameter"  db:"parameter"`
	LastUpdated *TimeNoMod `json:"last_updated,omitempty"  db:"last_updated"`
}

CacheGroupParametersResponseNullable is the type of each entry in the `cachegroupParameters` property of the response from Traffic Ops to requests made to its /cachegroupparameters endpoint.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

func FormatForResponse deprecated

FormatForResponse converts a CacheGroupParametersNullable to CacheGroupParametersResponseNullable in order to format the output the same as the Perl endpoint.

Deprecated: Cache Group Parameter associations have been removed in APIv4.

type CacheGroupPostDSResp

type CacheGroupPostDSResp struct {
	ID               util.JSONIntStr `json:"id"`
	ServerNames      []CacheName     `json:"serverNames"`
	DeliveryServices []int           `json:"deliveryServices"`
}

CacheGroupPostDSResp is the type of the `response` property of a response from Traffic Ops to a POST request made to its /cachegroups/{{ID}}/deliveryservices API endpoint.

type CacheGroupPostDSRespResponse

type CacheGroupPostDSRespResponse struct {
	Alerts
	Response CacheGroupPostDSResp `json:"response"`
}

CacheGroupPostDSRespResponse is the type of a response from Traffic Ops to a POST request made to its /cachegroups/{{ID}}/deliveryservices API endpoint.

type CacheGroupsNullableResponse

type CacheGroupsNullableResponse struct {
	Response []CacheGroupNullable `json:"response"`
	Alerts
}

CacheGroupsNullableResponse is a response with a list of CacheGroupNullables. Traffic Ops API responses instead uses an interface hold a list of TOCacheGroups.

type CacheGroupsResponse

type CacheGroupsResponse struct {
	Response []CacheGroup `json:"response"`
	Alerts
}

CacheGroupsResponse is a list of CacheGroups as a response.

type CacheName

type CacheName string

CacheName is the (short) hostname of a cache server.

func (CacheName) String

func (c CacheName) String() string

String implements the fmt.Stringer interface.

type CacheStatus

type CacheStatus string

CacheStatus is a Name of some Status.

More specifically, it is used here to enumerate the Statuses that are understood and acted upon in specific ways by Traffic Monitor.

Note that the Statuses captured in this package as CacheStatus values are in no way restricted to use by cache servers, despite the name.

func CacheStatusFromString

func CacheStatusFromString(s string) CacheStatus

CacheStatusFromString returns a CacheStatus from its string representation, or CacheStatusInvalid if the string is not a valid CacheStatus.

func (CacheStatus) String

func (t CacheStatus) String() string

String returns a string representation of this CacheStatus, implementing the fmt.Stringer interface.

type CacheType

type CacheType string

CacheType is the type (or tier) of a cache server.

func CacheTypeFromString

func CacheTypeFromString(s string) CacheType

CacheTypeFromString returns a CacheType structure from its string representation, or CacheTypeInvalid if the string is not a valid CacheType.

func (CacheType) String

func (t CacheType) String() string

String returns a string representation of this CacheType, implementing the fmt.Stringer interface.

type CachegroupPostDSReq

type CachegroupPostDSReq struct {
	DeliveryServices []int `json:"deliveryServices"`
}

A CachegroupPostDSReq is a request to associate some Cache Group with a set of zero or more Delivery Services.

type CachegroupQueueUpdatesRequest

type CachegroupQueueUpdatesRequest struct {
	Action string           `json:"action"`
	CDN    *CDNName         `json:"cdn"`
	CDNID  *util.JSONIntStr `json:"cdnId"`
}

CachegroupQueueUpdatesRequest holds info relating to the cachegroups/{{ID}}/queue_update TO route.

type CachegroupTrimmedName

type CachegroupTrimmedName struct {
	Name string `json:"name"`
}

CachegroupTrimmedName is useful when the only info about a cache group you want to return is its name.

type CapabilitiesResponse

type CapabilitiesResponse struct {
	Response []Capability `json:"response"`
	Alerts
}

CapabilitiesResponse models the structure of a minimal response from the Capabilities API in Traffic Ops.

type Capability

type Capability struct {
	Description string    `json:"description" db:"description"`
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        string    `json:"name" db:"name"`
}

Capability reflects the ability of a user in ATC to perform some operation.

In practice, they are assigned to relevant Traffic Ops API endpoints - to describe the capabilities of said endpoint - and to user permission Roles - to describe the capabilities afforded by said Role. Note that enforcement of Capability-based permissions is not currently implemented.

type CommonAPIData

type CommonAPIData struct {
	QueryParams string `json:"pp"`
	DateStr     string `json:"date"`
}

CommonAPIData contains generic data common to most Traffic Monitor API endpoints.

type CommonCheckFields

type CommonCheckFields struct {

	// AdminState is the server's status - called "AdminState" for legacy reasons.
	AdminState string `json:"adminState"`

	// CacheGroup is the name of the Cache Group to which the server belongs.
	CacheGroup string `json:"cacheGroup"`

	// ID is the integral, unique identifier of the server.
	ID int `json:"id"`

	// HostName of the checked server.
	HostName string `json:"hostName"`

	// RevalPending is a flag that indicates if revalidations are pending for the checked server.
	RevalPending bool `json:"revalPending"`

	// Profile is the name of the Profile used by the checked server.
	Profile string `json:"profile"`

	// Type is the name of the server's Type.
	Type string `json:"type"`

	// UpdPending is a flag that indicates if updates are pending for the checked server.
	UpdPending bool `json:"updPending"`
}

CommonCheckFields is a structure containing all of the fields common to both Serverchecks and GenericServerChecks.

type CommonServerProperties

type CommonServerProperties struct {
	Cachegroup       *string              `json:"cachegroup" db:"cachegroup"`
	CachegroupID     *int                 `json:"cachegroupId" db:"cachegroup_id"`
	CDNID            *int                 `json:"cdnId" db:"cdn_id"`
	CDNName          *string              `json:"cdnName" db:"cdn_name"`
	DeliveryServices *map[string][]string `json:"deliveryServices,omitempty"`
	DomainName       *string              `json:"domainName" db:"domain_name"`
	FQDN             *string              `json:"fqdn,omitempty"`
	FqdnTime         time.Time            `json:"-"`
	GUID             *string              `json:"guid" db:"guid"`
	HostName         *string              `json:"hostName" db:"host_name"`
	HTTPSPort        *int                 `json:"httpsPort" db:"https_port"`
	ID               *int                 `json:"id" db:"id"`
	ILOIPAddress     *string              `json:"iloIpAddress" db:"ilo_ip_address"`
	ILOIPGateway     *string              `json:"iloIpGateway" db:"ilo_ip_gateway"`
	ILOIPNetmask     *string              `json:"iloIpNetmask" db:"ilo_ip_netmask"`
	ILOPassword      *string              `json:"iloPassword" db:"ilo_password"`
	ILOUsername      *string              `json:"iloUsername" db:"ilo_username"`
	LastUpdated      *TimeNoMod           `json:"lastUpdated" db:"last_updated"`
	MgmtIPAddress    *string              `json:"mgmtIpAddress" db:"mgmt_ip_address"`
	MgmtIPGateway    *string              `json:"mgmtIpGateway" db:"mgmt_ip_gateway"`
	MgmtIPNetmask    *string              `json:"mgmtIpNetmask" db:"mgmt_ip_netmask"`
	OfflineReason    *string              `json:"offlineReason" db:"offline_reason"`
	PhysLocation     *string              `json:"physLocation" db:"phys_location"`
	PhysLocationID   *int                 `json:"physLocationId" db:"phys_location_id"`
	Profile          *string              `json:"profile" db:"profile"`
	ProfileDesc      *string              `json:"profileDesc" db:"profile_desc"`
	ProfileID        *int                 `json:"profileId" db:"profile_id"`
	Rack             *string              `json:"rack" db:"rack"`
	RevalPending     *bool                `json:"revalPending" db:"reval_pending"`
	Status           *string              `json:"status" db:"status"`
	StatusID         *int                 `json:"statusId" db:"status_id"`
	TCPPort          *int                 `json:"tcpPort" db:"tcp_port"`
	Type             string               `json:"type" db:"server_type"`
	TypeID           *int                 `json:"typeId" db:"server_type_id"`
	UpdPending       *bool                `json:"updPending" db:"upd_pending"`
	XMPPID           *string              `json:"xmppId" db:"xmpp_id"`
	XMPPPasswd       *string              `json:"xmppPasswd" db:"xmpp_passwd"`
}

CommonServerProperties is just the collection of properties which are shared by all servers across API versions.

type ConfigFileName

type ConfigFileName string

ConfigFileName is a Parameter ConfigFile value.

This has no additional attached semantics, and so while it is known to most frequently refer to a Parameter's ConfigFile, it may also be used to refer to the name of a literal configuration file within or without the context of Traffic Control, with unknown specificity (relative or absolute path? file:// URL?) and/or restrictions.

type Coordinate

type Coordinate struct {

	// The Coordinate to retrieve
	//
	// ID of the Coordinate
	//
	// required: true
	ID int `json:"id" db:"id"`

	// Name of the Coordinate
	//
	// required: true
	Name string `json:"name" db:"name"`

	// the latitude of the Coordinate
	//
	// required: true
	Latitude float64 `json:"latitude" db:"latitude"`

	// the latitude of the Coordinate
	//
	// required: true
	Longitude float64 `json:"longitude" db:"longitude"`

	// LastUpdated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

Coordinate is a representation of a Coordinate as it relates to the Traffic Ops data model.

type CoordinateNullable

type CoordinateNullable struct {

	// The Coordinate to retrieve
	//
	// ID of the Coordinate
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// Name of the Coordinate
	//
	// required: true
	Name *string `json:"name" db:"name"`

	// the latitude of the Coordinate
	//
	// required: true
	Latitude *float64 `json:"latitude" db:"latitude"`

	// the latitude of the Coordinate
	//
	// required: true
	Longitude *float64 `json:"longitude" db:"longitude"`

	// LastUpdated
	//
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

CoordinateNullable is identical to Coordinate except that its fields are reference values, which allows them to be nil.

type CoordinateResponse

type CoordinateResponse struct {
	// in: body
	Response Coordinate `json:"response"`
	Alerts
}

CoordinateResponse is a single Coordinate response for Update and Create to depict what changed. swagger:response CoordinateResponse in: body

type CoordinatesResponse

type CoordinatesResponse struct {
	// in: body
	Response []Coordinate `json:"response"`
	Alerts
}

CoordinatesResponse is a list of Coordinates as a response. swagger:response CoordinatesResponse in: body

type CreateCDNFederationResponse

type CreateCDNFederationResponse struct {
	Response CDNFederation `json:"response"`
	Alerts
}

CreateCDNFederationResponse represents a Traffic Ops API response to a request to create a new Federation for a CDN.

type CreateDeliveryServiceNullableResponse deprecated

type CreateDeliveryServiceNullableResponse struct {
	Response []DeliveryServiceNullable `json:"response"`
	Alerts
}

CreateDeliveryServiceNullableResponse roughly models the structure of responses from Traffic Ops to POST requests made to its /deliveryservices API endpoint.

"Roughly" because although that's what it's used for, this type cannot actually represent those accurately, because its representation is tied to a version of the API that no longer exists - DO NOT USE THIS, it WILL drop data that the API returns.

Deprecated: Please only use the versioned structures.

type CreateUserResponse

type CreateUserResponse struct {
	Response User `json:"response"`
	Alerts
}

CreateUserResponse can hold a Traffic Ops API response to a POST request to create a user.

type CurrentStatsResponse

type CurrentStatsResponse = TrafficStatsCDNStatsResponse

CurrentStatsResponse is the type of a response from Traffic Ops to a request to its /current_stats endpoint.

type CurrentUserUpdateRequest

type CurrentUserUpdateRequest struct {
	// User, for whatever reason, contains all of the actual data.
	User CurrentUserUpdateRequestUser `json:"user"`
}

CurrentUserUpdateRequest differs from a regular User/UserCurrent in that many of its fields are *parsed* but not *unmarshaled*. This allows a handler to distinguish between "null" and "undefined" values.

type CurrentUserUpdateRequestUser

type CurrentUserUpdateRequestUser struct {
	AddressLine1       json.RawMessage `json:"addressLine1"`
	AddressLine2       json.RawMessage `json:"addressLine2"`
	City               json.RawMessage `json:"city"`
	Company            json.RawMessage `json:"company"`
	ConfirmLocalPasswd *string         `json:"confirmLocalPasswd"`
	Country            json.RawMessage `json:"country"`
	Email              json.RawMessage `json:"email"`
	FullName           json.RawMessage `json:"fullName"`
	GID                json.RawMessage `json:"gid"`
	ID                 json.RawMessage `json:"id"`
	LocalPasswd        *string         `json:"localPasswd"`
	PhoneNumber        json.RawMessage `json:"phoneNumber"`
	PostalCode         json.RawMessage `json:"postalCode"`
	PublicSSHKey       json.RawMessage `json:"publicSshKey"`
	Role               json.RawMessage `json:"role"`
	StateOrProvince    json.RawMessage `json:"stateOrProvince"`
	TenantID           json.RawMessage `json:"tenantId"`
	UID                json.RawMessage `json:"uid"`
	Username           json.RawMessage `json:"username"`
}

CurrentUserUpdateRequestUser holds all of the actual data in a request to update the current user.

func (*CurrentUserUpdateRequestUser) UnmarshalAndValidate

func (u *CurrentUserUpdateRequestUser) UnmarshalAndValidate(user *User) error

UnmarshalAndValidate validates the request and returns a User into which the request's information has been unmarshalled.

type DNSSECKey

type DNSSECKey struct {
	DNSSECKeyV11
	DSRecord *DNSSECKeyDSRecord `json:"dsRecord,omitempty"`
}

A DNSSECKey is a DNSSEC Key (Key-Signing or Zone-Signing) and all associated data - computed data as well as data that is actually stored by Traffic Vault.

type DNSSECKeyDSRecord

type DNSSECKeyDSRecord struct {
	DNSSECKeyDSRecordV11
	Text string `json:"text"`
}

DNSSECKeyDSRecord structures are used by the Traffic Ops API after version 1.1, and they contain all the same information as well as an additional "Text" property of unknown purpose.

type DNSSECKeyDSRecordRiak

type DNSSECKeyDSRecordRiak DNSSECKeyDSRecordV11

DNSSECKeyDSRecordRiak is a DNSSEC key DS record, as stored in Riak. This is specifically the key data, without the DS record text (which can be computed), and is also the format used in API 1.1 through 1.3.

type DNSSECKeyDSRecordV11

type DNSSECKeyDSRecordV11 struct {
	Algorithm  int64  `json:"algorithm,string"`
	DigestType int64  `json:"digestType,string"`
	Digest     string `json:"digest"`
}

DNSSECKeyDSRecordV11 structures contain meta information for Key-Signing DNSSEC Keys (KSKs) used by Delivery Services.

type DNSSECKeySet

type DNSSECKeySet struct {
	ZSK []DNSSECKey `json:"zsk"`
	KSK []DNSSECKey `json:"ksk"`
}

A DNSSECKeySet is a set of keys used for DNSSEC zone and key signing.

type DNSSECKeySetV11

type DNSSECKeySetV11 struct {
	ZSK []DNSSECKeyV11 `json:"zsk"`
	KSK []DNSSECKeyV11 `json:"ksk"`
}

DNSSECKeySetV11 is a DNSSEC key set (ZSK and KSK), as stored in Traffic Vault. This is specifically the key data, without the DS record text (which can be computed), and was also the format used in API 1.1 through 1.3.

type DNSSECKeyV11

type DNSSECKeyV11 struct {
	InceptionDateUnix  int64                 `json:"inceptionDate"`
	ExpirationDateUnix int64                 `json:"expirationDate"`
	Name               string                `json:"name"`
	TTLSeconds         uint64                `json:"ttl,string"`
	Status             string                `json:"status"`
	EffectiveDateUnix  int64                 `json:"effectiveDate"`
	Public             string                `json:"public"`
	Private            string                `json:"private"`
	DSRecord           *DNSSECKeyDSRecordV11 `json:"dsRecord,omitempty"`
}

A DNSSECKeyV11 represents a DNSSEC Key (Key-Signing or Zone-Signing) as it appeared in Traffic Ops API version 1.1. This structure still exists because it is used by modern structures, but in general should not be used on its own, and github.com/apache/trafficcontrol/lib/go-tc.DNSSECKey should usually be used instead.

type DNSSECKeys

type DNSSECKeys map[string]DNSSECKeySet

DNSSECKeys is the DNSSEC keys as stored in Traffic Vault, plus the DS record text.

type DNSSECKeysRiak deprecated

type DNSSECKeysRiak DNSSECKeysV11

DNSSECKeysRiak is the structure in which DNSSECKeys are stored in the Riak backend for Traffic Vault.

Deprecated: use DNSSECKeysTrafficVault instead.

type DNSSECKeysTrafficVault

type DNSSECKeysTrafficVault DNSSECKeysV11

A DNSSECKeysTrafficVault is a mapping of CDN Names and/or Delivery Service XMLIDs to sets of keys used for DNSSEC with that CDN or Delivery Service.

type DNSSECKeysV11

type DNSSECKeysV11 map[string]DNSSECKeySetV11

DNSSECKeysV11 is the DNSSEC keys object stored in Traffic Vault. The map key strings are both DeliveryServiceNames and CDNNames.

type DSMatchType

type DSMatchType string

A DSMatchType is the Name of a Type of a Regular Expression ("Regex") used by a Delivery Service.

const (
	DSMatchTypeHostRegex     DSMatchType = "HOST_REGEXP"
	DSMatchTypePathRegex     DSMatchType = "PATH_REGEXP"
	DSMatchTypeSteeringRegex DSMatchType = "STEERING_REGEXP"
	DSMatchTypeHeaderRegex   DSMatchType = "HEADER_REGEXP"
	DSMatchTypeInvalid       DSMatchType = ""
)

These are the allowed values for a DSMatchType.

Note that, in general, there is no guarantee that a Type by any of these Names exists in Traffic Ops at any given time, nor that any such Types - should they exist - will have any particular UseInTable value, nor that the Types assigned to Delivery Service Regexes will be representable by these values.

func DSMatchTypeFromString

func DSMatchTypeFromString(s string) DSMatchType

DSMatchTypeFromString returns a DSMatchType from its string representation, or DSMatchTypeInvalid if the string is not a valid type.

func (DSMatchType) String

func (t DSMatchType) String() string

String returns a string representation of this DSMatchType, implementing the fmt.Stringer interface.

type DSRChangeType

type DSRChangeType string

DSRChangeType is an "enumerated" string type that encodes the legal values of a Delivery Service Request's Change Type.

func DSRChangeTypeFromString

func DSRChangeTypeFromString(s string) (DSRChangeType, error)

DSRChangeTypeFromString converts the passed string to a DSRChangeType (case-insensitive), returning an error if the string is not a valid Delivery Service Request Change Type.

func (DSRChangeType) MarshalJSON

func (dsrct DSRChangeType) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaller interface.

func (DSRChangeType) String

func (dsrct DSRChangeType) String() string

String implements the fmt.Stringer interface, returning a textual representation of the DSRChangeType.

func (*DSRChangeType) UnmarshalJSON

func (dsrct *DSRChangeType) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaller interface.

Example
var dsrct DSRChangeType
raw := `"CREATE"`
if err := json.Unmarshal([]byte(raw), &dsrct); err != nil {
	fmt.Printf("Error: %v\n", err)
	return
}
fmt.Printf("Parsed DSRCT: '%s'\n", dsrct.String())

raw = `"something invalid"`
if err := json.Unmarshal([]byte(raw), &dsrct); err != nil {
	fmt.Printf("Error: %v\n", err)
	return
}
fmt.Printf("Parsed DSRCT: '%s'\n", dsrct.String())
Output:

Parsed DSRCT: 'create'
Error: invalid Delivery Service Request changeType: 'something invalid'

type DSSMapResponse

type DSSMapResponse struct {
	DsId    int   `json:"dsId"`
	Replace bool  `json:"replace"`
	Servers []int `json:"servers"`
}

DSSMapResponse is the type of the `response` property of a response from Traffic Ops to a PUT request made to the /deliveryserviceserver endpoint of its API.

type DSSReplaceResponse

type DSSReplaceResponse struct {
	Alerts
	Response DSSMapResponse `json:"response"`
}

DSSReplaceResponse is the type of a response from Traffic Ops to a PUT request made to the /deliveryserviceserver endpoint of its API.

type DSServer

type DSServer struct {
	DSServerBase
	ServerInterfaces *[]ServerInterfaceInfo `json:"interfaces" db:"interfaces"`
}

DSServer contains information for a Delivery Service Server.

type DSServerBase

type DSServerBase struct {
	Cachegroup                  *string              `json:"cachegroup" db:"cachegroup"`
	CachegroupID                *int                 `json:"cachegroupId" db:"cachegroup_id"`
	CDNID                       *int                 `json:"cdnId" db:"cdn_id"`
	CDNName                     *string              `json:"cdnName" db:"cdn_name"`
	DeliveryServices            *map[string][]string `json:"deliveryServices,omitempty"`
	DomainName                  *string              `json:"domainName" db:"domain_name"`
	FQDN                        *string              `json:"fqdn,omitempty"`
	FqdnTime                    time.Time            `json:"-"`
	GUID                        *string              `json:"guid" db:"guid"`
	HostName                    *string              `json:"hostName" db:"host_name"`
	HTTPSPort                   *int                 `json:"httpsPort" db:"https_port"`
	ID                          *int                 `json:"id" db:"id"`
	ILOIPAddress                *string              `json:"iloIpAddress" db:"ilo_ip_address"`
	ILOIPGateway                *string              `json:"iloIpGateway" db:"ilo_ip_gateway"`
	ILOIPNetmask                *string              `json:"iloIpNetmask" db:"ilo_ip_netmask"`
	ILOPassword                 *string              `json:"iloPassword" db:"ilo_password"`
	ILOUsername                 *string              `json:"iloUsername" db:"ilo_username"`
	LastUpdated                 *TimeNoMod           `json:"lastUpdated" db:"last_updated"`
	MgmtIPAddress               *string              `json:"mgmtIpAddress" db:"mgmt_ip_address"`
	MgmtIPGateway               *string              `json:"mgmtIpGateway" db:"mgmt_ip_gateway"`
	MgmtIPNetmask               *string              `json:"mgmtIpNetmask" db:"mgmt_ip_netmask"`
	OfflineReason               *string              `json:"offlineReason" db:"offline_reason"`
	PhysLocation                *string              `json:"physLocation" db:"phys_location"`
	PhysLocationID              *int                 `json:"physLocationId" db:"phys_location_id"`
	Profile                     *string              `json:"profile" db:"profile"`
	ProfileDesc                 *string              `json:"profileDesc" db:"profile_desc"`
	ProfileID                   *int                 `json:"profileId" db:"profile_id"`
	Rack                        *string              `json:"rack" db:"rack"`
	RouterHostName              *string              `json:"routerHostName" db:"router_host_name"`
	RouterPortName              *string              `json:"routerPortName" db:"router_port_name"`
	Status                      *string              `json:"status" db:"status"`
	StatusID                    *int                 `json:"statusId" db:"status_id"`
	TCPPort                     *int                 `json:"tcpPort" db:"tcp_port"`
	Type                        string               `json:"type" db:"server_type"`
	TypeID                      *int                 `json:"typeId" db:"server_type_id"`
	UpdPending                  *bool                `json:"updPending" db:"upd_pending"`
	ServerCapabilities          []string             `json:"-" db:"server_capabilities"`
	DeliveryServiceCapabilities []string             `json:"-" db:"deliveryservice_capabilities"`
}

DSServerBase contains the base information for a Delivery Service Server.

func (DSServerBase) ToDSServerBaseV4

func (oldBase DSServerBase) ToDSServerBaseV4() DSServerBaseV4

ToDSServerBaseV4 upgrades the DSServerBase to the structure used by the latest minor version of version 4 of Traffic Ops's API.

type DSServerBaseV4

type DSServerBaseV4 struct {
	Cachegroup                  *string              `json:"cachegroup" db:"cachegroup"`
	CachegroupID                *int                 `json:"cachegroupId" db:"cachegroup_id"`
	CDNID                       *int                 `json:"cdnId" db:"cdn_id"`
	CDNName                     *string              `json:"cdnName" db:"cdn_name"`
	DeliveryServices            *map[string][]string `json:"deliveryServices,omitempty"`
	DomainName                  *string              `json:"domainName" db:"domain_name"`
	FQDN                        *string              `json:"fqdn,omitempty"`
	FqdnTime                    time.Time            `json:"-"`
	GUID                        *string              `json:"guid" db:"guid"`
	HostName                    *string              `json:"hostName" db:"host_name"`
	HTTPSPort                   *int                 `json:"httpsPort" db:"https_port"`
	ID                          *int                 `json:"id" db:"id"`
	ILOIPAddress                *string              `json:"iloIpAddress" db:"ilo_ip_address"`
	ILOIPGateway                *string              `json:"iloIpGateway" db:"ilo_ip_gateway"`
	ILOIPNetmask                *string              `json:"iloIpNetmask" db:"ilo_ip_netmask"`
	ILOPassword                 *string              `json:"iloPassword" db:"ilo_password"`
	ILOUsername                 *string              `json:"iloUsername" db:"ilo_username"`
	LastUpdated                 *TimeNoMod           `json:"lastUpdated" db:"last_updated"`
	MgmtIPAddress               *string              `json:"mgmtIpAddress" db:"mgmt_ip_address"`
	MgmtIPGateway               *string              `json:"mgmtIpGateway" db:"mgmt_ip_gateway"`
	MgmtIPNetmask               *string              `json:"mgmtIpNetmask" db:"mgmt_ip_netmask"`
	OfflineReason               *string              `json:"offlineReason" db:"offline_reason"`
	PhysLocation                *string              `json:"physLocation" db:"phys_location"`
	PhysLocationID              *int                 `json:"physLocationId" db:"phys_location_id"`
	Profile                     *string              `json:"profile" db:"profile"`
	ProfileDesc                 *string              `json:"profileDesc" db:"profile_desc"`
	ProfileID                   *int                 `json:"profileId" db:"profile_id"`
	Rack                        *string              `json:"rack" db:"rack"`
	Status                      *string              `json:"status" db:"status"`
	StatusID                    *int                 `json:"statusId" db:"status_id"`
	TCPPort                     *int                 `json:"tcpPort" db:"tcp_port"`
	Type                        string               `json:"type" db:"server_type"`
	TypeID                      *int                 `json:"typeId" db:"server_type_id"`
	UpdPending                  *bool                `json:"updPending" db:"upd_pending"`
	ServerCapabilities          []string             `json:"-" db:"server_capabilities"`
	DeliveryServiceCapabilities []string             `json:"-" db:"deliveryservice_capabilities"`
}

DSServerBaseV4 contains the base information for a Delivery Service Server.

func (DSServerBaseV4) ToDSServerBase

func (baseV4 DSServerBaseV4) ToDSServerBase(routerHostName, routerPort *string) DSServerBase

ToDSServerBase downgrades the DSServerBaseV4 to the structure used by the Traffic Ops API in versions earlier than 4.0.

type DSServerIDs

type DSServerIDs struct {
	DeliveryServiceID *int  `json:"dsId" db:"deliveryservice"`
	ServerIDs         []int `json:"servers"`
	Replace           *bool `json:"replace"`
}

A DSServerIDs is a description of relationships between a Delivery Service and zero or more servers, as well as how that relationship may have been recently modified.

type DSServerResponseV30

type DSServerResponseV30 struct {
	Response []DSServer `json:"response"`
	Alerts
}

DSServerResponseV30 is the type of a response from Traffic Ops to a request for servers assigned to a Delivery Service - in API version 3.0.

type DSServerResponseV4

type DSServerResponseV4 = DSServerResponseV40

DSServerResponseV4 is the type of a response from Traffic Ops to a request for servers assigned to a Delivery Service - in the latest minor version of API version 4.

type DSServerResponseV40

type DSServerResponseV40 struct {
	Response []DSServerV4 `json:"response"`
	Alerts
}

DSServerResponseV40 is the type of a response from Traffic Ops to a request for servers assigned to a Delivery Service - in API version 4.0.

type DSServerV11

type DSServerV11 struct {
	DSServerBase
	LegacyInterfaceDetails
}

DSServerV11 contains the legacy format for a Delivery Service Server.

type DSServerV4

type DSServerV4 struct {
	DSServerBaseV4
	ServerInterfaces *[]ServerInterfaceInfoV40 `json:"interfaces" db:"interfaces"`
}

DSServerV4 contains information for a V4.x Delivery Service Server.

type DSServersResponse

type DSServersResponse struct {
	Response DeliveryServiceServers `json:"response"`
	Alerts
}

DSServersResponse is the type of a response from Traffic Ops to a POST request made to the /deliveryservices/{{XML ID}}/servers endpoint of its API.

type DSType

type DSType string

DSType is the Name of a Type used by a Delivery Service.

const (
	DSTypeClientSteering   DSType = "CLIENT_STEERING"
	DSTypeDNS              DSType = "DNS"
	DSTypeDNSLive          DSType = "DNS_LIVE"
	DSTypeDNSLiveNational  DSType = "DNS_LIVE_NATNL"
	DSTypeHTTP             DSType = "HTTP"
	DSTypeHTTPLive         DSType = "HTTP_LIVE"
	DSTypeHTTPLiveNational DSType = "HTTP_LIVE_NATNL"
	DSTypeHTTPNoCache      DSType = "HTTP_NO_CACHE"
	DSTypeSteering         DSType = "STEERING"
	DSTypeAnyMap           DSType = "ANY_MAP"
	DSTypeInvalid          DSType = ""
)

These are the allowable values for a DSType.

Note that, in general, there is no guarantee that a Type by any of these Names exists in Traffic Ops at any given time, nor that any such Types - should they exist - will have any particular UseInTable value, nor that the Types assigned to Delivery Services will be representable by these values.

func DSTypeFromString

func DSTypeFromString(s string) DSType

DSTypeFromString returns a DSType from its string representation, or DSTypeInvalid if the string is not a valid DSType.

func (DSType) HasSSLKeys

func (t DSType) HasSSLKeys() bool

HasSSLKeys returns whether Dlivery Services of this Type can have SSL keys.

func (DSType) IsDNS

func (t DSType) IsDNS() bool

IsDNS returns whether a Delivery Service of a Type that has a Name that is this DSType is DNS-routed.

func (DSType) IsHTTP

func (t DSType) IsHTTP() bool

IsHTTP returns whether a Delivery Service of a Type that has a Name that is this DSType is HTTP-routed.

func (DSType) IsLive

func (t DSType) IsLive() bool

IsLive returns whether Delivery Services of this Type are "live".

func (DSType) IsNational

func (t DSType) IsNational() bool

IsNational returns whether Delivery Services of this Type are "national".

func (DSType) IsSteering

func (t DSType) IsSteering() bool

IsSteering returns whether a Delivery Service of a Type that has a Name that is this DSType is Steering-routed.

func (DSType) String

func (t DSType) String() string

String returns a string representation of this DSType, implementing the fmt.Stringer interface.

func (DSType) UsesDNSSECKeys

func (t DSType) UsesDNSSECKeys() bool

UsesDNSSECKeys returns whether a Delivery Service of a Type that has a Name that is this DSType uses or needs DNSSEC keys.

func (DSType) UsesMidCache

func (t DSType) UsesMidCache() bool

UsesMidCache returns whether Delivery Services of this Type use mid-tier cache servers.

type DSTypeCategory

type DSTypeCategory string

A DSTypeCategory defines the routing method for a Delivery Service, i.e. HTTP or DNS.

func DSTypeCategoryFromString

func DSTypeCategoryFromString(s string) DSTypeCategory

DSTypeCategoryFromString returns a DSTypeCategory from its string representation, or DSTypeCategoryInvalid if the string is not a valid DSTypeCategory.

This is cAsE-iNsEnSiTiVe.

func (DSTypeCategory) String

func (t DSTypeCategory) String() string

String returns a string representation of this DSTypeCategory, implementing the fmt.Stringer interface.

type DeepCachingType

type DeepCachingType string

DeepCachingType represents a Delivery Service's Deep Caching Type. The string values of this type should match the Traffic Ops values.

func DeepCachingTypeFromString

func DeepCachingTypeFromString(s string) DeepCachingType

DeepCachingTypeFromString returns a DeepCachingType from its string representation, or DeepCachingTypeInvalid if the string is not a valid DeepCachingTypeFromString.

func (DeepCachingType) MarshalJSON

func (t DeepCachingType) MarshalJSON() ([]byte, error)

MarshalJSON marshals into a JSON representation, implementing the encoding/json.Marshaler interface.

func (DeepCachingType) String

func (t DeepCachingType) String() string

String returns a string representation of this DeepCachingType, implementing the fmt.Stringer interface.

func (*DeepCachingType) UnmarshalJSON

func (t *DeepCachingType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a JSON representation of a DeepCachingType (i.e. a string) or returns an error if the DeepCachingType is invalid.

This implements the encoding/json.Unmarshaler interface.

type DeleteCDNDNSSECKeysResponse

type DeleteCDNDNSSECKeysResponse GenerateCDNDNSSECKeysResponse

DeleteCDNDNSSECKeysResponse is the type of a response from Traffic Ops to DELETE requests made to its /cdns/name/{{name}}/dnsseckeys API endpoint.

type DeleteCDNFederationResponse

type DeleteCDNFederationResponse struct {
	Alerts
}

DeleteCDNFederationResponse represents a Traffic Ops API response to a request to remove a Federation from a CDN.

type DeleteDeliveryServiceResponse

type DeleteDeliveryServiceResponse struct {
	Alerts
}

DeleteDeliveryServiceResponse is the type of a response from Traffic Ops to DELETE requests made to its /deliveryservices/{{ID}} API endpoint.

type DeleteTenantResponse deprecated

type DeleteTenantResponse struct {
	Alerts []TenantAlert `json:"alerts"`
}

DeleteTenantResponse is a legacy structure used to represent responses to DELETE requests made to Traffic Ops's /tenants API endpoint.

Deprecated: This uses a deprecated type for its Alerts property and drops information returned by the TO API - new code should use TenantResponse instead.

type DeleteUserResponse

type DeleteUserResponse struct {
	Alerts
}

DeleteUserResponse can theoretically hold a Traffic Ops API response to a DELETE request to update a user. It is unused.

type DeliveryService deprecated

type DeliveryService struct {
	DeliveryServiceV13
	MaxOriginConnections      int      `json:"maxOriginConnections" db:"max_origin_connections"`
	ConsistentHashRegex       string   `json:"consistentHashRegex"`
	ConsistentHashQueryParams []string `json:"consistentHashQueryParams"`
}

DeliveryService structures represent a Delivery Service as it is exposed through the Traffic Ops API at version 1.4 - which no longer exists.

DO NOT USE THIS - it ONLY still exists because it is used in the DeliveryServiceRequest type that is still in use by Traffic Ops's Go client for API versions 2 and 3 - and even that is incorrect and DOES DROP DATA.

Deprecated: Instead use the appropriate structure for the version of the Traffic Ops API being worked with, e.g. DeliveryServiceV4.

type DeliveryServiceAcmeSSLKeysReq

type DeliveryServiceAcmeSSLKeysReq struct {
	DeliveryServiceSSLKeysReq
}

DeliveryServiceAcmeSSLKeysReq structures are requests to generate new key/certificate pairs for a Delivery Service using an ACME provider, and are the type of structures required for POST request bodies to the /deliveryservices/sslkeys/generate/letsencrypt endpoint of the Traffic Ops API.

func (*DeliveryServiceAcmeSSLKeysReq) Validate

func (r *DeliveryServiceAcmeSSLKeysReq) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceAddSSLKeysReq

type DeliveryServiceAddSSLKeysReq struct {
	DeliveryServiceSSLKeysReq
}

DeliveryServiceAddSSLKeysReq structures are requests to import key/certificate pairs for a Delivery Service directly, and are the type of structures required for POST request bodies to the /deliveryservices/sslkeys/add endpoint of the Traffic Ops API.

func (*DeliveryServiceAddSSLKeysReq) Validate

func (r *DeliveryServiceAddSSLKeysReq) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceCacheGroup

type DeliveryServiceCacheGroup struct {
	Online  int `json:"online"`
	Offline int `json:"offline"`
	// The name of the Cache Group represented by this data.
	Name string `json:"name"`
}

DeliveryServiceCacheGroup breaks down the "health" of a Delivery Service by the number of cache servers responsible for serving its content within a specific Cache Group that are determined to be "online"/"healthy" and "offline"/"unhealthy".

type DeliveryServiceCapacity

type DeliveryServiceCapacity struct {
	// The portion of cache servers that are ready, willing, and able to
	// service client requests.
	AvailablePercent float64 `json:"availablePercent"`
	// The portion of cache servers that are read and willing, but not able to
	// service client requests, generally because Traffic Monitor deems them
	// "unhealthy".
	UnavailablePercent float64 `json:"unavailablePercent"`
	// The portion of cache servers that are actively involved in the flow of
	// Delivery Service content.
	UtilizedPercent float64 `json:"utilizedPercent"`
	// The portion of cache servers that are not yet ready to service client
	// requests because they are undergoing maintenance.
	MaintenancePercent float64 `json:"maintenancePercent"`
}

DeliveryServiceCapacity represents the "capacity" of a Delivery Service as the portions of the pool of cache servers responsible for serving its content that are available for servicing client requests.

type DeliveryServiceCapacityResponse

type DeliveryServiceCapacityResponse struct {
	Response DeliveryServiceCapacity `json:"response"`
	Alerts
}

DeliveryServiceCapacityResponse is the type of a response from Traffic Ops to a request for a Delivery Service's "capacity".

type DeliveryServiceFederationResolverMapping

type DeliveryServiceFederationResolverMapping struct {
	DeliveryService string          `json:"deliveryService"`
	Mappings        ResolverMapping `json:"mappings"`
}

DeliveryServiceFederationResolverMapping structures represent resolvers to which a Delivery Service maps "federated" CDN traffic.

func (*DeliveryServiceFederationResolverMapping) Validate

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceFederationResolverMappingRequest

type DeliveryServiceFederationResolverMappingRequest []DeliveryServiceFederationResolverMapping

DeliveryServiceFederationResolverMappingRequest is the format of a request to create (or modify) the Federation Resolver mappings of one or more Delivery Services. Use this when working only with API versions 1.4 and newer.

func (*DeliveryServiceFederationResolverMappingRequest) Validate

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceFieldsV13 deprecated

type DeliveryServiceFieldsV13 struct {
	// DeepCachingType may only legally point to 'ALWAYS' or 'NEVER', which
	// define whether "deep caching" may or may not be used for this Delivery
	// Service, respectively.
	DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
	// FQPacingRate sets the maximum bytes per second a cache server will deliver
	// on any single TCP connection for this Delivery Service. This may never
	// legally point to a value less than zero.
	FQPacingRate *int `json:"fqPacingRate" db:"fq_pacing_rate"`
	// SigningAlgorithm is the name of the algorithm used to sign CDN URIs for
	// this Delivery Service's content, or nil if no URI signing is done for the
	// Delivery Service. This may only point to the values "url_sig" or
	// "uri_signing".
	SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
	// Tenant is the Tenant to which the Delivery Service belongs.
	Tenant *string `json:"tenant"`
	// TRResponseHeaders is a set of headers (separated by CRLF pairs as per the
	// HTTP spec) and their values (separated by a colon as per the HTTP spec)
	// which will be sent by Traffic Router in HTTP responses to client requests
	// for this Delivery Service's content. This has no effect on DNS-routed or
	// un-routed Delivery Service Types.
	TRResponseHeaders *string `json:"trResponseHeaders"`
	// TRRequestHeaders is an "array" of HTTP headers which should be logged
	// from client HTTP requests for this Delivery Service's content by Traffic
	// Router, separated by newlines. This has no effect on DNS-routed or
	// un-routed Delivery Service Types.
	TRRequestHeaders *string `json:"trRequestHeaders"`
}

DeliveryServiceFieldsV13 contains additions to Delivery Services introduced in Traffic Ops API v1.3.

Deprecated: API version 1.3 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceFieldsV14 deprecated

type DeliveryServiceFieldsV14 struct {
	// ConsistentHashRegex is used by Traffic Router to extract meaningful parts
	// of a client's request URI for HTTP-routed Delivery Services before
	// hashing the request to find a cache server to which to direct the client.
	ConsistentHashRegex *string `json:"consistentHashRegex"`
	// ConsistentHashQueryParams is a list of al of the query string parameters
	// which ought to be considered by Traffic Router in client request URIs for
	// HTTP-routed Delivery Services in the hashing process.
	ConsistentHashQueryParams []string `json:"consistentHashQueryParams"`
	// MaxOriginConnections defines the total maximum  number of connections
	// that the highest caching layer ("Mid-tier" in a non-Topology context) is
	// allowed to have concurrently open to the Delivery Service's Origin. This
	// may never legally point to a value less than 0.
	MaxOriginConnections *int `json:"maxOriginConnections" db:"max_origin_connections"`
}

DeliveryServiceFieldsV14 contains additions to Delivery Services introduced in Traffic Ops API v1.4.

Deprecated: API version 1.4 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceFieldsV15 deprecated

type DeliveryServiceFieldsV15 struct {
	// EcsEnabled describes whether or not the Traffic Router's EDNS0 Client
	// Subnet extensions should be enabled when serving DNS responses for this
	// Delivery Service. Even if this is true, the Traffic Router may still
	// have the extensions unilaterally disabled in its own configuration.
	EcsEnabled bool `json:"ecsEnabled" db:"ecs_enabled"`
	// RangeSliceBlockSize defines the size of range request blocks - or
	// "slices" - used by the "slice" plugin. This has no effect if
	// RangeRequestHandling does not point to exactly 3. This may never legally
	// point to a value less than zero.
	RangeSliceBlockSize *int `json:"rangeSliceBlockSize" db:"range_slice_block_size"`
}

DeliveryServiceFieldsV15 contains additions to Delivery Services introduced in Traffic Ops API v1.5.

Deprecated: API version 1.5 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceFieldsV30 deprecated

type DeliveryServiceFieldsV30 struct {
	// FirstHeaderRewrite is a "header rewrite rule" used by ATS at the first
	// caching layer encountered in the Delivery Service's Topology, or nil if
	// there is no such rule. This has no effect on Delivery Services that don't
	// employ Topologies.
	FirstHeaderRewrite *string `json:"firstHeaderRewrite" db:"first_header_rewrite"`
	// InnerHeaderRewrite is a "header rewrite rule" used by ATS at all caching
	// layers encountered in the Delivery Service's Topology except the first
	// and last, or nil if there is no such rule. This has no effect on Delivery
	// Services that don't employ Topologies.
	InnerHeaderRewrite *string `json:"innerHeaderRewrite" db:"inner_header_rewrite"`
	// LastHeaderRewrite is a "header rewrite rule" used by ATS at the first
	// caching layer encountered in the Delivery Service's Topology, or nil if
	// there is no such rule. This has no effect on Delivery Services that don't
	// employ Topologies.
	LastHeaderRewrite *string `json:"lastHeaderRewrite" db:"last_header_rewrite"`
	// ServiceCategory defines a category to which a Delivery Service may
	// belong, which will cause HTTP Responses containing content for the
	// Delivery Service to have the "X-CDN-SVC" header with a value that is the
	// XMLID of the Delivery Service.
	ServiceCategory *string `json:"serviceCategory" db:"service_category"`
	// Topology is the name of the Topology used by the Delivery Service, or nil
	// if no Topology is used.
	Topology *string `json:"topology" db:"topology"`
}

DeliveryServiceFieldsV30 contains additions to Delivery Services introduced in API v3.0.

Deprecated: API version 3.0 is deprecated - upgrade to DeliveryServiceV4.

type DeliveryServiceFieldsV31 deprecated

type DeliveryServiceFieldsV31 struct {
	// MaxRequestHeaderBytes is the maximum size (in bytes) of the request
	// header that is allowed for this Delivery Service.
	MaxRequestHeaderBytes *int `json:"maxRequestHeaderBytes" db:"max_request_header_bytes"`
}

DeliveryServiceFieldsV31 contains additions to DeliverySservices introduced in API v3.1.

Deprecated: API version 3.1 is deprecated.

type DeliveryServiceGenSSLKeysReq

type DeliveryServiceGenSSLKeysReq struct {
	DeliveryServiceSSLKeysReq
}

DeliveryServiceGenSSLKeysReq structures are requests to generate new key/certificate pairs for a Delivery Service, and are the type of structures required for POST request bodies to the /deliveryservices/sslkeys/generate endpoint of the Traffic Ops API.

func (*DeliveryServiceGenSSLKeysReq) Validate

func (r *DeliveryServiceGenSSLKeysReq) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceHealth

type DeliveryServiceHealth struct {
	TotalOnline  int                         `json:"totalOnline"`
	TotalOffline int                         `json:"totalOffline"`
	CacheGroups  []DeliveryServiceCacheGroup `json:"cacheGroups"`
}

DeliveryServiceHealth represents the "health" of a Delivery Service by the number of cache servers responsible for serving its content that are determined to be "online"/"healthy" and "offline"/"unhealthy".

type DeliveryServiceHealthResponse

type DeliveryServiceHealthResponse struct {
	Response DeliveryServiceHealth `json:"response"`
	Alerts
}

DeliveryServiceHealthResponse is the type of a response from Traffic Ops to a request for a Delivery Service's "health".

type DeliveryServiceIDRegex

type DeliveryServiceIDRegex struct {
	ID        int    `json:"id"`
	Type      int    `json:"type"`
	TypeName  string `json:"typeName"`
	SetNumber int    `json:"setNumber"`
	Pattern   string `json:"pattern"`
}

DeliveryServiceIDRegex holds information relating to a single routing regular expression of a delivery service, e.g., one of those listed at the deliveryservices/{{ID}}/regexes TO API route.

type DeliveryServiceIDRegexResponse

type DeliveryServiceIDRegexResponse struct {
	Response []DeliveryServiceIDRegex `json:"response"`
	Alerts
}

DeliveryServiceIDRegexResponse is a list of DeliveryServiceIDRegexes.

type DeliveryServiceIDs

type DeliveryServiceIDs struct {
	DsId  *int    `json:"id,omitempty" db:"ds_id"`
	XmlId *string `json:"xmlId,omitempty" db:"xml_id"`
}

DeliveryServiceIDs are pairs of identifiers for Delivery Services.

type DeliveryServiceMatch

type DeliveryServiceMatch struct {
	Type      DSMatchType `json:"type"`
	SetNumber int         `json:"setNumber"`
	Pattern   string      `json:"pattern"`
}

DeliveryServiceMatch structures are the type of each entry in a Delivery Service's Match List.

type DeliveryServiceName

type DeliveryServiceName string

DeliveryServiceName is the name of a Delivery Service.

This has no attached semantics, and so it may be encountered in situations where it is the actual Display Name, but most often (as far as this author knows), it actually refers to a Delivery Service's XMLID.

func (DeliveryServiceName) String

func (d DeliveryServiceName) String() string

String implements the fmt.Stringer interface.

type DeliveryServiceNullable deprecated

type DeliveryServiceNullable DeliveryServiceNullableV15

DeliveryServiceNullable represents a Delivery Service as they appeared in version 1.5 - and coincidentally also version 2.0 - of the Traffic Ops API.

Deprecated: All API versions for which this could be used to represent structures are deprecated - upgrade to DeliveryServiceV4.

func (*DeliveryServiceNullable) Scan

func (ds *DeliveryServiceNullable) Scan(src interface{}) error

Scan implements the database/sql.Scanner interface.

This expects src to be an encoding/json.RawMessage and unmarshals that into the DeliveryServiceNullable.

func (*DeliveryServiceNullable) Value

func (ds *DeliveryServiceNullable) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface by marshaling the struct to JSON to pass back as an encoding/json.RawMessage.

type DeliveryServiceNullableFieldsV11 deprecated

type DeliveryServiceNullableFieldsV11 struct {
	// Active dictates whether the Delivery Service is routed by Traffic Router.
	Active *bool `json:"active" db:"active"`
	// AnonymousBlockingEnabled sets whether or not anonymized IP addresses
	// (e.g. Tor exit nodes) should be restricted from accessing the Delivery
	// Service's content.
	AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
	// CCRDNSTTL sets the Time-to-Live - in seconds - for DNS responses for this
	// Delivery Service from Traffic Router.
	CCRDNSTTL *int `json:"ccrDnsTtl" db:"ccr_dns_ttl"`
	// CDNID is the integral, unique identifier for the CDN to which the
	// Delivery Service belongs.
	CDNID *int `json:"cdnId" db:"cdn_id"`
	// CDNName is the name of the CDN to which the Delivery Service belongs.
	CDNName *string `json:"cdnName"`
	// CheckPath is a path which may be requested of the Delivery Service's
	// origin to ensure it's working properly.
	CheckPath *string `json:"checkPath" db:"check_path"`
	// DisplayName is a human-friendly name that might be used in some UIs
	// somewhere.
	DisplayName *string `json:"displayName" db:"display_name"`
	// DNSBypassCNAME is a fully qualified domain name to be used in a CNAME
	// record presented to clients in bypass scenarios.
	DNSBypassCNAME *string `json:"dnsBypassCname" db:"dns_bypass_cname"`
	// DNSBypassIP is an IPv4 address to be used in an A record presented to
	// clients in bypass scenarios.
	DNSBypassIP *string `json:"dnsBypassIp" db:"dns_bypass_ip"`
	// DNSBypassIP6 is an IPv6 address to be used in an AAAA record presented to
	// clients in bypass scenarios.
	DNSBypassIP6 *string `json:"dnsBypassIp6" db:"dns_bypass_ip6"`
	// DNSBypassTTL sets the Time-to-Live - in seconds - of DNS responses from
	// the Traffic Router that contain records for bypass destinations.
	DNSBypassTTL *int `json:"dnsBypassTtl" db:"dns_bypass_ttl"`
	// DSCP sets the Differentiated Services Code Point for IP packets
	// transferred between clients, origins, and cache servers when obtaining
	// and serving content for this Delivery Service.
	// See Also: https://en.wikipedia.org/wiki/Differentiated_services
	DSCP *int `json:"dscp" db:"dscp"`
	// EdgeHeaderRewrite is a "header rewrite rule" used by ATS at the Edge-tier
	// of caching. This has no effect on Delivery Services that don't use a
	// Topology.
	EdgeHeaderRewrite *string `json:"edgeHeaderRewrite" db:"edge_header_rewrite"`
	// ExampleURLs is a list of all of the URLs from which content may be
	// requested from the Delivery Service.
	ExampleURLs []string `json:"exampleURLs"`
	// GeoLimit defines whether or not access to a Delivery Service's content
	// should be limited based on the requesting client's geographic location.
	// Despite that this is a pointer to an arbitrary integer, the only valid
	// values are 0 (which indicates that content should not be limited
	// geographically), 1 (which indicates that content should only be served to
	// clients whose IP addresses can be found within a Coverage Zone File), and
	// 2 (which indicates that content should be served to clients whose IP
	// addresses can be found within a Coverage Zone File OR are allowed access
	// according to the "array" in GeoLimitCountries).
	GeoLimit *int `json:"geoLimit" db:"geo_limit"`
	// GeoLimitCountries is an "array" of "country codes" that itemizes the
	// countries within which the Delivery Service's content ought to be made
	// available. This has no effect if GeoLimit is not a pointer to exactly the
	// value 2.
	GeoLimitCountries *string `json:"geoLimitCountries" db:"geo_limit_countries"`
	// GeoLimitRedirectURL is a URL to which clients will be redirected if their
	// access to the Delivery Service's content is blocked by GeoLimit rules.
	GeoLimitRedirectURL *string `json:"geoLimitRedirectURL" db:"geolimit_redirect_url"`
	// GeoProvider names the type of database to be used for providing IP
	// address-to-geographic-location mapping for this Delivery Service. The
	// only valid values to which it may point are 0 (which indicates the use of
	// a MaxMind GeoIP2 database) and 1 (which indicates the use of a Neustar
	// GeoPoint IP address database).
	GeoProvider *int `json:"geoProvider" db:"geo_provider"`
	// GlobalMaxMBPS defines a maximum number of MegaBytes Per Second which may
	// be served for the Delivery Service before redirecting clients to bypass
	// locations.
	GlobalMaxMBPS *int `json:"globalMaxMbps" db:"global_max_mbps"`
	// GlobalMaxTPS defines a maximum number of Transactions Per Second which
	// may be served for the Delivery Service before redirecting clients to
	// bypass locations.
	GlobalMaxTPS *int `json:"globalMaxTps" db:"global_max_tps"`
	// HTTPBypassFQDN is a network location to which clients will be redirected
	// in bypass scenarios using HTTP "Location" headers and appropriate
	// redirection response codes.
	HTTPBypassFQDN *string `json:"httpBypassFqdn" db:"http_bypass_fqdn"`
	// ID is an integral, unique identifier for the Delivery Service.
	ID *int `json:"id" db:"id"`
	// InfoURL is a URL to which operators or clients may be directed to obtain
	// further information about a Delivery Service.
	InfoURL *string `json:"infoUrl" db:"info_url"`
	// InitialDispersion sets the number of cache servers within the first
	// caching layer ("Edge-tier" in a non-Topology context) across which
	// content will be dispersed per Cache Group.
	InitialDispersion *int `json:"initialDispersion" db:"initial_dispersion"`
	// IPV6RoutingEnabled controls whether or not routing over IPv6 should be
	// done for this Delivery Service.
	IPV6RoutingEnabled *bool `json:"ipv6RoutingEnabled" db:"ipv6_routing_enabled"`
	// LastUpdated is the time and date at which the Delivery Service was last
	// updated.
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	// LogsEnabled controls nothing. It is kept only for legacy compatibility.
	LogsEnabled *bool `json:"logsEnabled" db:"logs_enabled"`
	// LongDesc is a description of the Delivery Service, having arbitrary
	// length.
	LongDesc *string `json:"longDesc" db:"long_desc"`
	// LongDesc1 is a description of the Delivery Service, having arbitrary
	// length.
	LongDesc1 *string `json:"longDesc1,omitempty" db:"long_desc_1"`
	// LongDesc2 is a description of the Delivery Service, having arbitrary
	// length.
	LongDesc2 *string `json:"longDesc2,omitempty" db:"long_desc_2"`
	// MatchList is a list of Regular Expressions used for routing the Delivery
	// Service. Order matters, and the array is not allowed to be sparse.
	MatchList *[]DeliveryServiceMatch `json:"matchList"`
	// MaxDNSAnswers sets the maximum number of records which should be returned
	// by Traffic Router in DNS responses to requests for resolving names for
	// this Delivery Service.
	MaxDNSAnswers *int `json:"maxDnsAnswers" db:"max_dns_answers"`
	// MidHeaderRewrite is a "header rewrite rule" used by ATS at the Mid-tier
	// of caching. This has no effect on Delivery Services that don't use a
	// Topology.
	MidHeaderRewrite *string `json:"midHeaderRewrite" db:"mid_header_rewrite"`
	// MissLat is a latitude to default to for clients of this Delivery Service
	// when geolocation attempts fail.
	MissLat *float64 `json:"missLat" db:"miss_lat"`
	// MissLong is a longitude to default to for clients of this Delivery
	// Service when geolocation attempts fail.
	MissLong *float64 `json:"missLong" db:"miss_long"`
	// MultiSiteOrigin determines whether or not the Delivery Service makes use
	// of "Multi-Site Origin".
	MultiSiteOrigin *bool `json:"multiSiteOrigin" db:"multi_site_origin"`
	// OriginShield is a field that does nothing. It is kept only for legacy
	// compatibility reasons.
	OriginShield *string `json:"originShield" db:"origin_shield"`
	// OrgServerFQDN is the URL - NOT Fully Qualified Domain Name - of the
	// origin of the Delivery Service's content.
	OrgServerFQDN *string `json:"orgServerFqdn" db:"org_server_fqdn"`
	// ProfileDesc is the Description of the Profile used by the Delivery
	// Service, if any.
	ProfileDesc *string `json:"profileDescription"`
	// ProfileID is the integral, unique identifier of the Profile used by the
	// Delivery Service, if any.
	ProfileID *int `json:"profileId" db:"profile"`
	// ProfileName is the Name of the Profile used by the Delivery Service, if
	// any.
	ProfileName *string `json:"profileName"`
	// Protocol defines the protocols by which caching servers may communicate
	// with clients. The valid values to which it may point are 0 (which implies
	// that only HTTP may be used), 1 (which implies that only HTTPS may be
	// used), 2 (which implies that either HTTP or HTTPS may be used), and 3
	// (which implies that clients using HTTP must be redirected to use HTTPS,
	// while communications over HTTPS may proceed as normal).
	Protocol *int `json:"protocol" db:"protocol"`
	// QStringIgnore sets how query strings in HTTP requests to cache servers
	// from clients are treated. The only valid values to which it may point are
	// 0 (which implies that all caching layers will pass query strings in
	// upstream requests and use them in the cache key), 1 (which implies that
	// all caching layers will pass query strings in upstream requests, but not
	// use them in cache keys), and 2 (which implies that the first encountered
	// caching layer - "Edge-tier" in a non-Topology context - will strip query
	// strings, effectively preventing them from being passed in upstream
	// requests, and not use them in the cache key).
	QStringIgnore *int `json:"qstringIgnore" db:"qstring_ignore"`
	// RangeRequestHandling defines how HTTP GET requests with a Range header
	// will be handled by cache servers serving the Delivery Service's content.
	// The only valid values to which it may point are 0 (which implies that
	// Range requests will not be cached at all), 1 (which implies that the
	// background_fetch plugin will be used to service the range request while
	// caching the whole object), 2 (which implies that the cache_range_requests
	// plugin will be used to cache ranges as unique objects), and 3 (which
	// implies that the slice plugin will be used to slice range based requests
	// into deterministic chunks.)
	RangeRequestHandling *int `json:"rangeRequestHandling" db:"range_request_handling"`
	// Regex Remap is a raw line to be inserted into "regex_remap.config" on the
	// cache server. Care is necessitated in its use, because the input is in no
	// way restricted, validated, or limited in scope to the Delivery Service.
	RegexRemap *string `json:"regexRemap" db:"regex_remap"`
	// RegionalGeoBlocking defines whether or not whatever Regional Geo Blocking
	// rules are configured on the Traffic Router serving content for this
	// Delivery Service will have an effect on the traffic of this Delivery
	// Service.
	RegionalGeoBlocking *bool `json:"regionalGeoBlocking" db:"regional_geo_blocking"`
	// RemapText is raw text to insert in "remap.config" on the cache servers
	// serving content for this Delivery Service. Care is necessitated in its
	// use, because the input is in no way restricted, validated, or limited in
	// scope to the Delivery Service.
	RemapText *string `json:"remapText" db:"remap_text"`
	// RoutingName defines the lowest-level DNS label used by the Delivery
	// Service, e.g. if trafficcontrol.apache.org were a Delivery Service, it
	// would have a RoutingName of "trafficcontrol".
	RoutingName *string `json:"routingName" db:"routing_name"`
	// Signed is a legacy field. It is allowed to be `true` if and only if
	// SigningAlgorithm is not nil.
	Signed bool `json:"signed"`
	// SSLKeyVersion incremented whenever Traffic Portal generates new SSL keys
	// for the Delivery Service, effectively making it a "generational" marker.
	SSLKeyVersion *int `json:"sslKeyVersion" db:"ssl_key_version"`
	// TenantID is the integral, unique identifier for the Tenant to which the
	// Delivery Service belongs.
	TenantID *int `json:"tenantId" db:"tenant_id"`
	// Type describes how content is routed and cached for this Delivery Service
	// as well as what other properties have any meaning.
	Type *DSType `json:"type"`
	// TypeID is an integral, unique identifier for the Tenant to which the
	// Delivery Service belongs.
	TypeID *int `json:"typeId" db:"type"`
	// XMLID is a unique identifier that is also the second lowest-level DNS
	// label used by the Delivery Service. For example, if a Delivery Service's
	// content may be requested from video.demo1.mycdn.ciab.test, it may be
	// inferred that the Delivery Service's XMLID is demo1.
	XMLID *string `json:"xmlId" db:"xml_id"`
}

DeliveryServiceNullableFieldsV11 contains properties that Delivery Services as they appeared in Traffic Ops API v1.1 had, AND were not removed by ANY later API version.

Deprecated: API version 1.1 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV11 deprecated

type DeliveryServiceNullableV11 struct {
	DeliveryServiceNullableFieldsV11
	DeliveryServiceRemovedFieldsV11
}

DeliveryServiceNullableV11 represents a Delivery Service as they appeared in version 1.1 of the Traffic Ops API - which no longer exists.

Deprecated: API version 1.1 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV12 deprecated

type DeliveryServiceNullableV12 struct {
	DeliveryServiceNullableV11
}

DeliveryServiceNullableV12 represents a Delivery Service as they appeared in version 1.2 of the Traffic Ops API - which no longer exists.

Deprecated: API version 1.2 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV13 deprecated

type DeliveryServiceNullableV13 struct {
	DeliveryServiceNullableV12
	DeliveryServiceFieldsV13
}

DeliveryServiceNullableV13 represents a Delivery Service as they appeared in version 1.3 of the Traffic Ops API - which no longer exists.

Deprecated: API version 1.3 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV14 deprecated

type DeliveryServiceNullableV14 struct {
	DeliveryServiceNullableV13
	DeliveryServiceFieldsV14
}

DeliveryServiceNullableV14 represents a Delivery Service as they appeared in version 1.4 of the Traffic Ops API - which no longer exists.

Deprecated: API version 1.4 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV15 deprecated

type DeliveryServiceNullableV15 struct {
	DeliveryServiceNullableV14
	DeliveryServiceFieldsV15
}

DeliveryServiceNullableV15 represents a Delivery Service as they appeared in version 1.5 of the Traffic Ops API - which no longer exists.

Because the structure of Delivery Services did not change between Traffic Ops API versions 1.5 and 2.0, this is also used in many places to represent an APIv2 Delivery Service.

Deprecated: All API versions for which this could be used to represent structures are deprecated - upgrade to DeliveryServiceV4.

type DeliveryServiceNullableV30 deprecated

type DeliveryServiceNullableV30 DeliveryServiceV31

DeliveryServiceNullableV30 is the aliased structure that we should be using for all API 3.x Delivery Service operations.

Again, this type is an alias that refers to the LATEST MINOR VERSION of API version 3 - NOT API version 3.0 as the name might imply.

This type should always alias the latest 3.x minor version struct. For example, if you wanted to create a DeliveryServiceV32 struct, you would do the following:

type DeliveryServiceNullableV30 DeliveryServiceV32
DeliveryServiceV32 = DeliveryServiceV31 + the new fields.

Deprecated: API version 3 is deprecated - upgrade to DeliveryServiceV4.

func (*DeliveryServiceNullableV30) UpgradeToV4

UpgradeToV4 converts the 3.x DS to a 4.x DS.

type DeliveryServiceRegex

type DeliveryServiceRegex struct {
	Type      string `json:"type"`
	SetNumber int    `json:"setNumber"`
	Pattern   string `json:"pattern"`
}

DeliveryServiceRegex is a regular expression used for routing to a Delivery Service.

type DeliveryServiceRegexPost

type DeliveryServiceRegexPost struct {
	Type      int    `json:"type"`
	SetNumber int    `json:"setNumber"`
	Pattern   string `json:"pattern"`
}

DeliveryServiceRegexPost holds all of the information necessary to create a new routing regular expression for a delivery service.

type DeliveryServiceRegexResponse

type DeliveryServiceRegexResponse struct {
	Response []DeliveryServiceRegexes `json:"response"`
	Alerts
}

DeliveryServiceRegexResponse is the type of a Traffic Ops API response to the /deliveryservices_regexes endpoint - in all API verions (at the time of this writing).

type DeliveryServiceRegexes

type DeliveryServiceRegexes struct {
	Regexes []DeliveryServiceRegex `json:"regexes"`
	// The XMLID of the Delivery Service to which the Regexes belong - NOT its
	// Display Name.
	DSName string `json:"dsName"`
}

DeliveryServiceRegexes structures associate a set of Delivery Service Regular Expressions (Delivery Service "Regexes") with a particular Delivery Service.

type DeliveryServiceRegexesTest

type DeliveryServiceRegexesTest struct {
	DSName string `json:"dsName"`
	DSID   int
	DeliveryServiceIDRegex
}

DeliveryServiceRegexesTest is used to represent the entire deliveryservice_regex for testing.

This is ONLY meant to be used by testing code internal to ATC, do NOT use this to represent real CDN objects of any kind.

type DeliveryServiceRemovedFieldsV11 deprecated

type DeliveryServiceRemovedFieldsV11 struct {
	CacheURL *string `json:"cacheurl" db:"cacheurl"`
}

DeliveryServiceRemovedFieldsV11 contains properties of Delivery Services as they appeared in version 1.1 of the Traffic Ops API that were later removed in some other API version.

Deprecated: API version 1.1 no longer exists, this type ONLY still exists because newer structures nest it, so removing it would be a breaking change - please upgrade to DeliveryServiceV4.

type DeliveryServiceRequest

type DeliveryServiceRequest struct {
	AssigneeID      int             `json:"assigneeId,omitempty"`
	Assignee        string          `json:"assignee,omitempty"`
	AuthorID        IDNoMod         `json:"authorId"`
	Author          string          `json:"author"`
	ChangeType      string          `json:"changeType"`
	CreatedAt       *TimeNoMod      `json:"createdAt"`
	ID              int             `json:"id"`
	LastEditedBy    string          `json:"lastEditedBy,omitempty"`
	LastEditedByID  IDNoMod         `json:"lastEditedById,omitempty"`
	LastUpdated     *TimeNoMod      `json:"lastUpdated"`
	DeliveryService DeliveryService `json:"deliveryService"` // TODO version DeliveryServiceRequest
	Status          RequestStatus   `json:"status"`
	XMLID           string          `json:"-" db:"xml_id"`
}

DeliveryServiceRequest is used as part of the workflow to create, modify, or delete a delivery service.

type DeliveryServiceRequestComment

type DeliveryServiceRequestComment struct {
	AuthorID                 IDNoMod   `json:"authorId" db:"author_id"`
	Author                   string    `json:"author"`
	DeliveryServiceRequestID int       `json:"deliveryServiceRequestId" db:"deliveryservice_request_id"`
	ID                       int       `json:"id" db:"id"`
	LastUpdated              TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Value                    string    `json:"value" db:"value"`
	XMLID                    string    `json:"xmlId" db:"xml_id"`
}

DeliveryServiceRequestComment is a struct containing the fields for a delivery service request comment.

type DeliveryServiceRequestCommentNullable

type DeliveryServiceRequestCommentNullable struct {
	AuthorID                 *IDNoMod   `json:"authorId" db:"author_id"`
	Author                   *string    `json:"author"`
	DeliveryServiceRequestID *int       `json:"deliveryServiceRequestId" db:"deliveryservice_request_id"`
	ID                       *int       `json:"id" db:"id"`
	LastUpdated              *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Value                    *string    `json:"value" db:"value"`
	XMLID                    *string    `json:"xmlId" db:"xml_id"`
}

DeliveryServiceRequestCommentNullable is a nullable struct containing the fields for a delivery service request comment.

type DeliveryServiceRequestCommentsResponse

type DeliveryServiceRequestCommentsResponse struct {
	Response []DeliveryServiceRequestComment `json:"response"`
	Alerts
}

DeliveryServiceRequestCommentsResponse is a list of DeliveryServiceRequestComments as a response.

type DeliveryServiceRequestDetails deprecated

type DeliveryServiceRequestDetails struct {
	// ContentType is the type of content to be delivered, e.g. "static", "VOD" etc.
	ContentType string `json:"contentType"`
	// Customer is the requesting customer - typically this is a Tenant.
	Customer string `json:"customer"`
	// DeepCachingType represents whether or not the Delivery Service should use Deep Caching.
	DeepCachingType *DeepCachingType `json:"deepCachingType"`
	// Delivery Protocol is the protocol clients should use to connect to the Delivery Service.
	DeliveryProtocol *Protocol `json:"deliveryProtocol"`
	// HasNegativeCachingCustomization indicates whether or not the resulting Delivery Service should
	// customize the use of negative caching. When this is `true`, NegativeCachingCustomizationNote
	// should be consulted for instructions on the customization.
	HasNegativeCachingCustomization *bool `json:"hasNegativeCachingCustomization"`
	// HasOriginACLWhitelist indicates whether or not the Origin has an ACL whitelist. When this is
	// `true`, Notes should ideally contain the actual whitelist (or viewing instructions).
	HasOriginACLWhitelist *bool `json:"hasOriginACLWhitelist"`
	// Has OriginDynamicRemap indicates whether or not the OriginURL can dynamically map to multiple
	// different actual origin servers.
	HasOriginDynamicRemap *bool `json:"hasOriginDynamicRemap"`
	// HasSignedURLs indicates whether or not the resulting Delivery Service should sign its URLs.
	HasSignedURLs *bool `json:"hasSignedURLs"`
	// HeaderRewriteEdge is an optional HeaderRewrite rule to apply at the Edge tier.
	HeaderRewriteEdge *string `json:"headerRewriteEdge"`
	// HeaderRewriteMid is an optional HeaderRewrite rule to apply at the Mid tier.
	HeaderRewriteMid *string `json:"headerRewriteMid"`
	// HeaderRewriteRedirectRouter is an optional HeaderRewrite rule to apply at routing time by
	// the Traffic Router.
	HeaderRewriteRedirectRouter *string `json:"headerRewriteRedirectRouter"`
	// MaxLibrarySizeEstimate is an estimation of the total size of content that will be delivered
	// through the resulting Delivery Service.
	MaxLibrarySizeEstimate string `json:"maxLibrarySizeEstimate"`
	// NegativeCachingCustomizationNote is an optional note describing the customization to be
	// applied to Negative Caching. This should never be `nil` (or empty) if
	// HasNegativeCachingCustomization is `true`, but in that case the recipient ought to contact
	// Customer for instructions.
	NegativeCachingCustomizationNote *string `json:"negativeCachingCustomizationNote"`
	// Notes is an optional set of extra information supplied to describe the requested Delivery
	// Service.
	Notes *string `json:"notes"`
	// OriginHeaders is an optional list of HTTP headers that must be sent in requests to the Origin. When
	// parsing from JSON, this field can be either an actual array of headers, or a string containing
	// a comma-delimited list of said headers.
	OriginHeaders *OriginHeaders `json:"originHeaders"`
	// OriginTestFile is the path to a file on the origin that can be requested to test the server's
	// operational readiness, e.g. '/test.xml'.
	OriginTestFile string `json:"originTestFile"`
	// OriginURL is the URL of the origin server that has the content to be served by the requested
	// Delivery Service.
	OriginURL string `json:"originURL"`
	// OtherOriginSecurity is an optional note about any and all other Security employed by the origin
	// server (beyond an ACL whitelist, which has its own field: HasOriginACLWhitelist).
	OtherOriginSecurity *string `json:"otherOriginSecurity"`
	// OverflowService is an optional IP Address or URL to which clients should be redirected when
	// the requested Delivery Service exceeds its operational capacity.
	OverflowService *string `json:"overflowService"`
	// PeakBPSEstimate is an estimate of the bytes per second expected at peak operation.
	PeakBPSEstimate string `json:"peakBPSEstimate"`
	// PeakTPSEstimate is an estimate of the transactions per second expected at peak operation.
	PeakTPSEstimate string `json:"peakTPSEstimate"`
	// QueryStringHandling describes the manner in which the CDN should handle query strings in client
	// requests. Generally one of "use", "drop", or "ignore-in-cache-key-and-pass-up".
	QueryStringHandling string `json:"queryStringHandling"`
	// RangeRequestHandling describes the manner in which HTTP requests are handled.
	RangeRequestHandling string `json:"rangeRequestHandling"`
	// RateLimitingGBPS is an optional rate limit for the requested Delivery Service in gigabytes per
	// second.
	RateLimitingGBPS *uint `json:"rateLimitingGBPS"`
	// RateLimitingTPS is an optional rate limit for the requested Delivery Service in transactions
	// per second.
	RateLimitingTPS *uint `json:"rateLimitingTPS"`
	// RoutingName is the top-level DNS label under which the Delivery Service should be requested.
	RoutingName string `json:"routingName"`
	// RoutingType is the type of routing Traffic Router should perform for the requested Delivery
	// Service.
	RoutingType *DSType `json:"routingType"`
	// ServiceAliases is an optional list of alternative names for the requested Delivery Service.
	ServiceAliases []string `json:"serviceAliases"`
	// ServiceDesc is a basic description of the requested Delivery Service.
	ServiceDesc string `json:"serviceDesc"`
}

DeliveryServiceRequestDetails holds information about what a user is trying to change, with respect to a delivery service.

Deprecated: Delivery Services Requests have been deprecated in favor of Delivery Service Requests, and will be removed from the Traffic Ops API at some point in the future.

func (DeliveryServiceRequestDetails) Format

Format formats the DeliveryServiceRequestDetails into the text/html body of an email. The template used is EmailTemplate.

type DeliveryServiceRequestNullable

type DeliveryServiceRequestNullable struct {
	AssigneeID      *int                        `json:"assigneeId,omitempty" db:"assignee_id"`
	Assignee        *string                     `json:"assignee,omitempty"`
	AuthorID        *IDNoMod                    `json:"authorId" db:"author_id"`
	Author          *string                     `json:"author"`
	ChangeType      *string                     `json:"changeType" db:"change_type"`
	CreatedAt       *TimeNoMod                  `json:"createdAt" db:"created_at"`
	ID              *int                        `json:"id" db:"id"`
	LastEditedBy    *string                     `json:"lastEditedBy"`
	LastEditedByID  *IDNoMod                    `json:"lastEditedById" db:"last_edited_by_id"`
	LastUpdated     *TimeNoMod                  `json:"lastUpdated" db:"last_updated"`
	DeliveryService *DeliveryServiceNullableV30 `json:"deliveryService" db:"deliveryservice"`
	Status          *RequestStatus              `json:"status" db:"status"`
	XMLID           *string                     `json:"-" db:"xml_id"`
}

DeliveryServiceRequestNullable is used as part of the workflow to create, modify, or delete a delivery service.

func (DeliveryServiceRequestNullable) Upgrade

Upgrade coerces the DeliveryServiceRequestNullable to the newer DeliveryServiceRequestV40 structure.

All reference properties are "deep"-copied so they may be modified without affecting the original. However, DeliveryService is constructed as a "deep" copy, but the properties of the underlying DeliveryServiceNullableV30 are "shallow" copied, and so modifying them *can* affect the original and vice-versa.

type DeliveryServiceRequestRequest deprecated

type DeliveryServiceRequestRequest struct {
	// EmailTo is the email address that is ultimately the destination of a formatted DeliveryServiceRequestRequest.
	EmailTo string `json:"emailTo"`
	// Details holds the actual request in a data structure.
	Details DeliveryServiceRequestDetails `json:"details"`
}

DeliveryServiceRequestRequest is a literal request to make a Delivery Service.

Deprecated: Delivery Services Requests have been deprecated in favor of Delivery Service Requests, and will be removed from the Traffic Ops API at some point in the future.

func (*DeliveryServiceRequestRequest) Validate

func (d *DeliveryServiceRequestRequest) Validate() error

Validate validates that the delivery service request has all of the required fields. In some cases, e.g. the top-level EmailTo field, the format is also checked for correctness.

type DeliveryServiceRequestResponseV4

type DeliveryServiceRequestResponseV4 = DeliveryServiceRequestResponseV40

DeliveryServiceRequestResponseV4 is the type of a response from Traffic Ops when creating, updating, or deleting a Delivery Service Request using the latest minor version of API version 4.

type DeliveryServiceRequestResponseV40

type DeliveryServiceRequestResponseV40 struct {
	Response DeliveryServiceRequestV40 `json:"response"`
	Alerts
}

DeliveryServiceRequestResponseV40 is the type of a response from Traffic Ops when creating, updating, or deleting a Delivery Service Request using API version 4.0.

type DeliveryServiceRequestV4

type DeliveryServiceRequestV4 = DeliveryServiceRequestV40

DeliveryServiceRequestV4 is the type of a Delivery Service Request as it appears in API version 4.

type DeliveryServiceRequestV40

type DeliveryServiceRequestV40 struct {
	// Assignee is the username of the user assigned to the Delivery Service
	// Request, if any.
	Assignee *string `json:"assignee"`
	// AssigneeID is the integral, unique identifier of the user assigned to the
	// Delivery Service Request, if any.
	AssigneeID *int `json:"-" db:"assignee_id"`
	// Author is the username of the user who created the Delivery Service
	// Request.
	Author string `json:"author"`
	// AuthorID is the integral, unique identifier of the user who created the
	// Delivery Service Request, if/when it is known.
	AuthorID *int `json:"-" db:"author_id"`
	// ChangeType represents the type of change being made, must be one of
	// "create", "change" or "delete".
	ChangeType DSRChangeType `json:"changeType" db:"change_type"`
	// CreatedAt is the date/time at which the Delivery Service Request was
	// created.
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	// ID is the integral, unique identifier for the Delivery Service Request
	// if/when it is known.
	ID *int `json:"id" db:"id"`
	// LastEditedBy is the username of the user by whom the Delivery Service
	// Request was last edited.
	LastEditedBy string `json:"lastEditedBy"`
	// LastEditedByID is the integral, unique identifier of the user by whom the
	// Delivery Service Request was last edited, if/when it is known.
	LastEditedByID *int `json:"-" db:"last_edited_by_id"`
	// LastUpdated is the date/time at which the Delivery Service was last
	// modified.
	LastUpdated time.Time `json:"lastUpdated" db:"last_updated"`
	// Original is the original Delivery Service for which changes are
	// requested. This is present in responses only for ChangeTypes 'change' and
	// 'delete', and is only required in requests where ChangeType is 'delete'.
	Original *DeliveryServiceV4 `json:"original,omitempty" db:"original"`
	// Requested is the set of requested changes. This is present in responses
	// only for ChangeTypes 'change' and 'create', and is only required in
	// requests in those cases.
	Requested *DeliveryServiceV4 `json:"requested,omitempty" db:"deliveryservice"`
	// Status is the status of the Delivery Service Request.
	Status RequestStatus `json:"status" db:"status"`
	// Used internally to define the affected Delivery Service.
	XMLID string `json:"-"`
}

DeliveryServiceRequestV40 is the type of a Delivery Service Request in Traffic Ops API version 4.0.

func (DeliveryServiceRequestV40) Downgrade

Downgrade coerces the DeliveryServiceRequestV40 to the older DeliveryServiceRequestNullable structure.

"XMLID" will be copied directly if it is non-empty, otherwise determined from the DeliveryService (if it's not 'nil').

All reference properties are "deep"-copied so they may be modified without affecting the original. However, DeliveryService is constructed as a "deep" copy of "Requested", but the properties of the underlying DeliveryServiceNullableV30 are "shallow" copied, and so modifying them *can* affect the original and vice-versa.

func (DeliveryServiceRequestV40) IsClosed

func (dsr DeliveryServiceRequestV40) IsClosed() bool

IsClosed returns whether or not the Delivery Service Request has been "closed", by being either rejected or completed.

func (DeliveryServiceRequestV40) IsOpen

func (dsr DeliveryServiceRequestV40) IsOpen() bool

IsOpen returns whether or not the Delivery Service Request is still "open" - i.e. has not been rejected or completed.

func (*DeliveryServiceRequestV40) SetXMLID

func (dsr *DeliveryServiceRequestV40) SetXMLID()

SetXMLID sets the DeliveryServiceRequestV40's XMLID based on its DeliveryService.

Example
var dsr DeliveryServiceRequestV40
fmt.Println(dsr.XMLID == "")

dsr.Requested = new(DeliveryServiceV4)
dsr.Requested.XMLID = new(string)
*dsr.Requested.XMLID = "test"
dsr.SetXMLID()

fmt.Println(dsr.XMLID)
Output:

true
test

func (DeliveryServiceRequestV40) String

func (dsr DeliveryServiceRequestV40) String() string

String encodes the DeliveryServiceRequestV40 as a string, in the format "DeliveryServiceRequestV40({{Property}}={{Value}}[, {{Property}}={{Value}}]+)".

If a property is a pointer value, then its dereferenced value is used - unless it's nil, in which case "<nil>" is used as the value. DeliveryService is omitted, because of how large it is. Times are formatted in RFC3339 format.

Example
var dsr DeliveryServiceRequestV40
fmt.Println(dsr.String())
Output:

DeliveryServiceRequestV40(Assignee=<nil>, AssigneeID=<nil>, Author="", AuthorID=<nil>, ChangeType="", CreatedAt=0001-01-01T00:00:00Z, ID=<nil>, LastEditedBy="", LastEditedByID=<nil>, LastUpdated=0001-01-01T00:00:00Z, Status="")

type DeliveryServiceRequestsResponseV4

type DeliveryServiceRequestsResponseV4 = DeliveryServiceRequestsResponseV40

DeliveryServiceRequestsResponseV4 is the type of a response from Traffic Ops for Delivery Service Requests using the latest minor version of API version 4.

type DeliveryServiceRequestsResponseV40

type DeliveryServiceRequestsResponseV40 struct {
	Response []DeliveryServiceRequestV40 `json:"response"`
	Alerts
}

DeliveryServiceRequestsResponseV40 is the type of a response from Traffic Ops for Delivery Service Requests using API version 4.0.

type DeliveryServiceSSLKeys

type DeliveryServiceSSLKeys struct {
	AuthType        string                            `json:"authType,omitempty"`
	CDN             string                            `json:"cdn,omitempty"`
	DeliveryService string                            `json:"deliveryservice,omitempty"`
	BusinessUnit    string                            `json:"businessUnit,omitempty"`
	City            string                            `json:"city,omitempty"`
	Organization    string                            `json:"organization,omitempty"`
	Hostname        string                            `json:"hostname,omitempty"`
	Country         string                            `json:"country,omitempty"`
	State           string                            `json:"state,omitempty"`
	Key             string                            `json:"key"`
	Version         util.JSONIntStr                   `json:"version"`
	Certificate     DeliveryServiceSSLKeysCertificate `json:"certificate,omitempty"`
}

DeliveryServiceSSLKeys contains information about an SSL key and certificate used by a Delivery Service to secure its HTTP-delivered content.

type DeliveryServiceSSLKeysCertificate

type DeliveryServiceSSLKeysCertificate struct {
	Crt string `json:"crt"`
	Key string `json:"key"`
	CSR string `json:"csr"`
}

DeliveryServiceSSLKeysCertificate contains an SSL key/certificate pair for a Delivery Service, as well as the Certificate Signing Request associated with them.

type DeliveryServiceSSLKeysGenerationResponse

type DeliveryServiceSSLKeysGenerationResponse struct {
	Response string `json:"response"`
	Alerts
}

DeliveryServiceSSLKeysGenerationResponse is the type of a response from Traffic Ops to a request for generation of SSL Keys for a Delivery Service.

type DeliveryServiceSSLKeysReq

type DeliveryServiceSSLKeysReq struct {
	AuthType        *string `json:"authType,omitempty"`
	CDN             *string `json:"cdn,omitempty"`
	DeliveryService *string `json:"deliveryservice,omitempty"`
	BusinessUnit    *string `json:"businessUnit,omitempty"`
	City            *string `json:"city,omitempty"`
	Organization    *string `json:"organization,omitempty"`
	HostName        *string `json:"hostname,omitempty"`
	Country         *string `json:"country,omitempty"`
	State           *string `json:"state,omitempty"`
	// Key is the XMLID of the delivery service
	Key         *string                            `json:"key"`
	Version     *util.JSONIntStr                   `json:"version"`
	Certificate *DeliveryServiceSSLKeysCertificate `json:"certificate,omitempty"`
}

DeliveryServiceSSLKeysReq structures are requests for the generation of SSL key certificate pairs for a Delivery Service, and this is, in fact, the structure required for POST request bodies to the /deliveryservices/sslkeys/generate Traffic Ops API endpoint.

func (*DeliveryServiceSSLKeysReq) Sanitize

func (r *DeliveryServiceSSLKeysReq) Sanitize()

Sanitize ensures that if either the DeliveryService or Key property of a DeliveryServiceSSLKeysReq is nil, it will be set to a reference to a copy of the value of the other property (if that is not nil).

This does NOT ensure that both fields are not nil, nor does it ensure that they match.

type DeliveryServiceSSLKeysResponse

type DeliveryServiceSSLKeysResponse struct {
	Response DeliveryServiceSSLKeys `json:"response"`
	Alerts
}

DeliveryServiceSSLKeysResponse is the type of a response from Traffic Ops to GET requests made to its /deliveryservices/xmlId/{{XML ID}}/sslkeys API endpoint.

type DeliveryServiceSSLKeysV15

type DeliveryServiceSSLKeysV15 struct {
	DeliveryServiceSSLKeys
	Expiration time.Time `json:"expiration,omitempty"`
}

DeliveryServiceSSLKeysV15 structures contain information about an SSL key certificate pair used by a Delivery Service.

"V15" is used because this structure was first introduced in version 1.5 of the Traffic Ops API.

This is, ostensibly, an updated version of DeliveryServiceSSLKeys, but beware that this may not be completely accurate as the predecessor structure appears to be used in many more contexts than this this structure.

type DeliveryServiceSafeUpdateRequest

type DeliveryServiceSafeUpdateRequest struct {
	DisplayName *string `json:"displayName"`
	InfoURL     *string `json:"infoUrl"`
	LongDesc    *string `json:"longDesc"`
	LongDesc1   *string `json:"longDesc1,omitempty"`
}

DeliveryServiceSafeUpdateRequest represents a request to update the "safe" fields of a Delivery Service.

func (*DeliveryServiceSafeUpdateRequest) Validate

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type DeliveryServiceSafeUpdateResponse

type DeliveryServiceSafeUpdateResponse struct {
	Alerts
	// Response contains the representation of the Delivery Service after it has been updated.
	Response []DeliveryServiceNullable `json:"response"`
}

DeliveryServiceSafeUpdateResponse represents Traffic Ops's response to a PUT request to its /deliveryservices/{{ID}}/safe endpoint. Deprecated: Please only use versioned structures.

type DeliveryServiceSafeUpdateResponseV30

type DeliveryServiceSafeUpdateResponseV30 struct {
	Alerts
	// Response contains the representation of the Delivery Service after it has
	// been updated.
	Response []DeliveryServiceNullableV30 `json:"response"`
}

DeliveryServiceSafeUpdateResponseV30 represents Traffic Ops's response to a PUT request to its /api/3.0/deliveryservices/{{ID}}/safe endpoint.

type DeliveryServiceSafeUpdateResponseV4

type DeliveryServiceSafeUpdateResponseV4 = DeliveryServiceSafeUpdateResponseV40

DeliveryServiceSafeUpdateResponseV4 represents TrafficOps's response to a PUT request to its /api/4.x/deliveryservices/{{ID}}/safe endpoint. This is always a type alias for the structure of a response in the latest minor APIv4 version.

type DeliveryServiceSafeUpdateResponseV40

type DeliveryServiceSafeUpdateResponseV40 struct {
	Alerts
	// Response contains the representation of the Delivery Service after it has
	// been updated.
	Response []DeliveryServiceV40 `json:"response"`
}

DeliveryServiceSafeUpdateResponseV40 represents Traffic Ops's response to a PUT request to its /api/4.0/deliveryservices/{{ID}}/safe endpoint.

type DeliveryServiceServer

type DeliveryServiceServer struct {
	Server          *int       `json:"server" db:"server"`
	DeliveryService *int       `json:"deliveryService" db:"deliveryservice"`
	LastUpdated     *TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

DeliveryServiceServer is the type of each entry in the `response` array property of responses from Traffic Ops to GET requests made to the /deliveryserviceservers endpoint of its API.

type DeliveryServiceServerResponse

type DeliveryServiceServerResponse struct {
	Orderby  string                  `json:"orderby"`
	Response []DeliveryServiceServer `json:"response"`
	Size     int                     `json:"size"`
	Limit    int                     `json:"limit"`
	Alerts
}

DeliveryServiceServerResponse is the type of a response from Traffic Ops to a GET request to the /deliveryserviceserver endpoint.

type DeliveryServiceServers

type DeliveryServiceServers struct {
	ServerNames []string `json:"serverNames"`
	XmlId       string   `json:"xmlId"`
}

DeliveryServiceServers structures represent the servers assigned to a Delivery Service.

type DeliveryServiceUserPost deprecated

type DeliveryServiceUserPost struct {
	UserID           *int   `json:"userId"`
	DeliveryServices *[]int `json:"deliveryServices"`
	Replace          *bool  `json:"replace"`
}

DeliveryServiceUserPost represents a legacy concept that no longer exists in Apache Traffic Control.

DO NOT USE THIS - it ONLY still exists because it is still in use by Traffic Ops's Go client for API versions 2 and 3, despite that those API versions do not include the concepts and functionality for which this structure was created.

Deprecated: All Go clients for API versions that still erroneously link to this symbol are deprecated, and this structure serves no known purpose.

type DeliveryServiceV11 deprecated

type DeliveryServiceV11 struct {
	Active                   bool                   `json:"active"`
	AnonymousBlockingEnabled bool                   `json:"anonymousBlockingEnabled"`
	CacheURL                 string                 `json:"cacheurl"`
	CCRDNSTTL                int                    `json:"ccrDnsTtl"`
	CDNID                    int                    `json:"cdnId"`
	CDNName                  string                 `json:"cdnName"`
	CheckPath                string                 `json:"checkPath"`
	DeepCachingType          DeepCachingType        `json:"deepCachingType"`
	DisplayName              string                 `json:"displayName"`
	DNSBypassCname           string                 `json:"dnsBypassCname"`
	DNSBypassIP              string                 `json:"dnsBypassIp"`
	DNSBypassIP6             string                 `json:"dnsBypassIp6"`
	DNSBypassTTL             int                    `json:"dnsBypassTtl"`
	DSCP                     int                    `json:"dscp"`
	EdgeHeaderRewrite        string                 `json:"edgeHeaderRewrite"`
	ExampleURLs              []string               `json:"exampleURLs"`
	GeoLimit                 int                    `json:"geoLimit"`
	GeoProvider              int                    `json:"geoProvider"`
	GlobalMaxMBPS            int                    `json:"globalMaxMbps"`
	GlobalMaxTPS             int                    `json:"globalMaxTps"`
	HTTPBypassFQDN           string                 `json:"httpBypassFqdn"`
	ID                       int                    `json:"id"`
	InfoURL                  string                 `json:"infoUrl"`
	InitialDispersion        float32                `json:"initialDispersion"`
	IPV6RoutingEnabled       bool                   `json:"ipv6RoutingEnabled"`
	LastUpdated              *TimeNoMod             `json:"lastUpdated" db:"last_updated"`
	LogsEnabled              bool                   `json:"logsEnabled"`
	LongDesc                 string                 `json:"longDesc"`
	LongDesc1                string                 `json:"longDesc1"`
	LongDesc2                string                 `json:"longDesc2"`
	MatchList                []DeliveryServiceMatch `json:"matchList,omitempty"`
	MaxDNSAnswers            int                    `json:"maxDnsAnswers"`
	MidHeaderRewrite         string                 `json:"midHeaderRewrite"`
	MissLat                  float64                `json:"missLat"`
	MissLong                 float64                `json:"missLong"`
	MultiSiteOrigin          bool                   `json:"multiSiteOrigin"`
	OrgServerFQDN            string                 `json:"orgServerFqdn"`
	ProfileDesc              string                 `json:"profileDescription"`
	ProfileID                int                    `json:"profileId,omitempty"`
	ProfileName              string                 `json:"profileName"`
	Protocol                 int                    `json:"protocol"`
	QStringIgnore            int                    `json:"qstringIgnore"`
	RangeRequestHandling     int                    `json:"rangeRequestHandling"`
	RegexRemap               string                 `json:"regexRemap"`
	RegionalGeoBlocking      bool                   `json:"regionalGeoBlocking"`
	RemapText                string                 `json:"remapText"`
	RoutingName              string                 `json:"routingName"`
	Signed                   bool                   `json:"signed"`
	TypeID                   int                    `json:"typeId"`
	Type                     DSType                 `json:"type"`
	TRResponseHeaders        string                 `json:"trResponseHeaders"`
	TenantID                 int                    `json:"tenantId"`
	XMLID                    string                 `json:"xmlId"`
}

DeliveryServiceV11 contains the information relating to a Delivery Service that was around in version 1.1 of the Traffic Ops API.

DO NOT USE THIS - it ONLY still exists because it is nested within the structure of the DeliveryServiceV13 type.

Deprecated: Instead, use the appropriate structure for the version of the Traffic Ops API being worked with, e.g. DeliveryServiceV4.

type DeliveryServiceV13 deprecated

type DeliveryServiceV13 struct {
	DeliveryServiceV11
	DeepCachingType   DeepCachingType `json:"deepCachingType"`
	FQPacingRate      int             `json:"fqPacingRate,omitempty"`
	SigningAlgorithm  string          `json:"signingAlgorithm" db:"signing_algorithm"`
	Tenant            string          `json:"tenant"`
	TRRequestHeaders  string          `json:"trRequestHeaders,omitempty"`
	TRResponseHeaders string          `json:"trResponseHeaders,omitempty"`
}

DeliveryServiceV13 structures represent a Delivery Service as it is exposed through the Traffic Ops API at version 1.3 - which no longer exists.

DO NOT USE THIS - it ONLY still exists because it is nested within the structure of the DeliveryService type.

Deprecated: Instead, use the appropriate structure for the version of the Traffic Ops API being worked with, e.g. DeliveryServiceV4.

type DeliveryServiceV30 deprecated

type DeliveryServiceV30 struct {
	DeliveryServiceNullableV15
	DeliveryServiceFieldsV30
}

DeliveryServiceV30 represents a Delivery Service as they appear in version 3.0 of the Traffic Ops API.

Deprecated: API version 3.0 is deprecated - upgrade to DeliveryServiceV4.

type DeliveryServiceV31 deprecated

type DeliveryServiceV31 struct {
	DeliveryServiceV30
	DeliveryServiceFieldsV31
}

DeliveryServiceV31 represents a Delivery Service as they appear in version 3.1 of the Traffic Ops API.

Deprecated: API version 3.1 is deprecated - upgrade to DeliveryServiceV4.

type DeliveryServiceV4

type DeliveryServiceV4 = DeliveryServiceV40

DeliveryServiceV4 is a Delivery Service as it appears in version 4 of the Traffic Ops API - it always points to the highest minor version in APIv4.

func (*DeliveryServiceV4) DowngradeToV3

func (ds *DeliveryServiceV4) DowngradeToV3() DeliveryServiceNullableV30

DowngradeToV3 converts the 4.x DS to a 3.x DS.

func (*DeliveryServiceV4) RemoveLD1AndLD2

func (ds *DeliveryServiceV4) RemoveLD1AndLD2() DeliveryServiceV4

RemoveLD1AndLD2 removes the Long Description 1 and Long Description 2 fields from a V 4.x DS, and returns the resulting struct.

func (*DeliveryServiceV4) Scan

func (ds *DeliveryServiceV4) Scan(src interface{}) error

Scan implements the database/sql.Scanner interface.

This expects src to be an encoding/json.RawMessage and unmarshals that into the DeliveryServiceV4.

func (DeliveryServiceV4) TLSVersionsAlerts

func (ds DeliveryServiceV4) TLSVersionsAlerts() Alerts

TLSVersionsAlerts generates warning-level alerts for the Delivery Service's TLS versions array. It will warn if newer versions are disallowed while older, less secure versions are allowed, if there are unrecognized versions present, if the Delivery Service's Protocol does not make use of TLS Versions, and whenever TLSVersions are explicitly set at all.

This does NOT verify that the Delivery Service's TLS versions are _valid_, it ONLY creates warnings based on conditions that are possibly detrimental to CDN operation, but can, in fact, work.

func (*DeliveryServiceV4) Value

func (ds *DeliveryServiceV4) Value() (driver.Value, error)

Value implements the database/sql/driver.Valuer interface by marshaling the struct to JSON to pass back as an encoding/json.RawMessage.

type DeliveryServiceV40

type DeliveryServiceV40 struct {
	DeliveryServiceFieldsV31
	DeliveryServiceFieldsV30
	DeliveryServiceFieldsV15
	DeliveryServiceFieldsV14
	DeliveryServiceFieldsV13
	DeliveryServiceNullableFieldsV11

	// TLSVersions is the list of explicitly supported TLS versions for cache
	// servers serving the Delivery Service's content.
	TLSVersions []string `json:"tlsVersions" db:"tls_versions"`
}

DeliveryServiceV40 is a Delivery Service as it appears in version 4.0 of the Traffic Ops API.

type DeliveryServicesNullableResponse deprecated

type DeliveryServicesNullableResponse struct {
	Response []DeliveryServiceNullable `json:"response"`
	Alerts
}

DeliveryServicesNullableResponse roughly models the structure of responses from Traffic Ops to GET requests made to its /servers/{{ID}}/deliveryservices and /deliveryservices API endpoints.

"Roughly" because although that's what it's used for, this type cannot actually represent those accurately, because its representation is tied to a version of the API that no longer exists - DO NOT USE THIS, it WILL drop data that the API returns.

Deprecated: Please only use the versioned structures.

type DeliveryServicesRequiredCapabilitiesResponse

type DeliveryServicesRequiredCapabilitiesResponse struct {
	Response []DeliveryServicesRequiredCapability `json:"response"`
	Alerts
}

DeliveryServicesRequiredCapabilitiesResponse is the type of a response from Traffic Ops to a request for relationships between Delivery Services and Capabilities which they require.

type DeliveryServicesRequiredCapability

type DeliveryServicesRequiredCapability struct {
	LastUpdated        *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	DeliveryServiceID  *int       `json:"deliveryServiceID" db:"deliveryservice_id"`
	RequiredCapability *string    `json:"requiredCapability" db:"required_capability"`
	XMLID              *string    `json:"xmlID,omitempty" db:"xml_id"`
}

DeliveryServicesRequiredCapability represents an association between a required capability and a delivery service.

type DeliveryServicesResponseV30

type DeliveryServicesResponseV30 struct {
	Response []DeliveryServiceNullableV30 `json:"response"`
	Alerts
}

DeliveryServicesResponseV30 is the type of a response from the /api/3.0/deliveryservices Traffic Ops endpoint.

TODO: Move these into the respective clients?

type DeliveryServicesResponseV4

type DeliveryServicesResponseV4 = DeliveryServicesResponseV40

DeliveryServicesResponseV4 is the type of a response from the /api/4.x/deliveryservices Traffic Ops endpoint. It always points to the type for the latest minor version of APIv4.

type DeliveryServicesResponseV40

type DeliveryServicesResponseV40 struct {
	Response []DeliveryServiceV40 `json:"response"`
	Alerts
}

DeliveryServicesResponseV40 is the type of a response from the /api/4.0/deliveryservices Traffic Ops endpoint.

type DeliveryserviceserverResponse

type DeliveryserviceserverResponse struct {
	Response DSServerIDs `json:"response"`
	Alerts
}

DeliveryserviceserverResponse - not to be confused with DSServerResponseV40 or DSServerResponse- is the type of a response from Traffic Ops to a request to the /deliveryserviceserver endpoint to associate servers with a Delivery Service.

type Division

type Division struct {

	// Division ID
	//
	ID int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// Division Name
	//
	// required: true
	Name string `json:"name" db:"name"`
}

A Division is a named collection of Regions.

type DivisionNullable

type DivisionNullable struct {
	ID          *int       `json:"id" db:"id"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        *string    `json:"name" db:"name"`
}

DivisionNullable is a nullable struct that holds info about a division, which is a group of regions.

type DivisionResponse

type DivisionResponse struct {
	// in: body
	Response Division `json:"response"`
}

DivisionResponse is a single Division response for Update and Create to depict what changed. swagger:response DivisionResponse in: body

type DivisionsResponse

type DivisionsResponse struct {
	// in: body
	Response []Division `json:"response"`
	Alerts
}

DivisionsResponse is a list of Divisions as a response. swagger:response DivisionsResponse

type Domain

type Domain struct {
	ProfileID int `json:"profileId" db:"profile_id"`

	// This property serves no known purpose; it is always -1.
	ParameterID int `json:"parameterId" db:"parameter_id"`

	ProfileName string `json:"profileName" db:"profile_name"`

	ProfileDescription string `json:"profileDescription" db:"profile_description"`

	// DomainName of the CDN
	DomainName string `json:"domainName" db:"domain_name"`
}

Domain contains information about a single Profile within a Domain.

type DomainNullable

type DomainNullable struct {
	ProfileID          *int    `json:"profileId" db:"profile_id"`
	ParameterID        *int    `json:"parameterId" db:"parameter_id"`
	ProfileName        *string `json:"profileName" db:"profile_name"`
	ProfileDescription *string `json:"profileDescription" db:"profile_description"`
	DomainName         *string `json:"domainName" db:"domain_name"`
}

DomainNullable is identical to a Domain but with reference properties that can have nil values, mostly used by the Traffic Ops API.

type DomainsResponse

type DomainsResponse struct {
	Response []Domain `json:"response"`
	Alerts
}

DomainsResponse is a list of Domains as a response.

type ErrorConstant

type ErrorConstant string

ErrorConstant is used for error messages.

Note that the ErrorConstant constants exported by this package most usually are values that have the same string value as an error-level Alert returned by the Traffic Ops API. Because those are arising from Alerts, one cannot actually use e.g. err == TenantUserNotAuthError or even errors.Is(err, TenantUserNotAuthError) to check for equivalence with these exported errors. Because of this, the use of these constants outside of Traffic Ops-internal code is discouraged, and these constants may be moved into that package (or a sub-package thereof) at some point in the future.

func (ErrorConstant) Error

func (e ErrorConstant) Error() string

Error converts ErrorConstants to a string.

type FederationDSPost

type FederationDSPost struct {
	DSIDs []int `json:"dsIds"`
	// Replace indicates whether existing Federation-to-Delivery Service associations should be
	// replaced by the ones defined by this request, or otherwise merely augmented with them.
	Replace *bool `json:"replace"`
}

FederationDSPost is the format of a request to associate a Federation with any number of Delivery Services.

func (*FederationDSPost) Validate

func (f *FederationDSPost) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type FederationDeliveryServiceNullable

type FederationDeliveryServiceNullable struct {
	ID    *int    `json:"id" db:"id"`
	CDN   *string `json:"cdn" db:"cdn"`
	Type  *string `json:"type" db:"type"`
	XMLID *string `json:"xmlId" db:"xml_id"`
}

A FederationDeliveryServiceNullable is an association between a Federation and a Delivery Service.

type FederationDeliveryServicesResponse

type FederationDeliveryServicesResponse struct {
	Response []FederationDeliveryServiceNullable `json:"response"`
	Alerts
}

FederationDeliveryServicesResponse is the type of a response from Traffic Ops to a request made to its /federations/{{ID}}/deliveryservices endpoint.

type FederationFederationResolversResponse

type FederationFederationResolversResponse struct {
	Response []FederationResolver `json:"response"`
	Alerts
}

FederationFederationResolversResponse represents an API response containing Federation Resolvers for a given Federation.

type FederationMapping

type FederationMapping struct {
	CName string `json:"cname"`
	TTL   int    `json:"ttl"`
}

A FederationMapping is a Federation, without any information about its resolver mappings or any relation to Delivery Services.

type FederationNullable

type FederationNullable struct {
	Mappings        []FederationMapping `json:"mappings"`
	DeliveryService *string             `json:"deliveryService"`
}

FederationNullable represents a relationship between some Federation Mappings and a Delivery Service.

This is not known to be used anywhere.

type FederationResolver

type FederationResolver struct {
	ID          *uint      `json:"id" db:"id"`
	IPAddress   *string    `json:"ipAddress" db:"ip_address"`
	LastUpdated *TimeNoMod `json:"lastUpdated,omitempty" db:"last_updated"`
	Type        *string    `json:"type"`
	TypeID      *uint      `json:"typeId,omitempty" db:"type"`
}

FederationResolver represents a resolver record for a CDN Federation.

func (*FederationResolver) Validate

func (fr *FederationResolver) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

Example
var typeID uint = 1
var IPAddress string = "0.0.0.0"
fr := FederationResolver{
	TypeID:    &typeID,
	IPAddress: &IPAddress,
}

fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "0.0.0.0/24"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "::1"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "dead::babe/63"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "1.2.3.4/33"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "w.x.y.z"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "::f1d0:f00d/129"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = "test::quest"
fmt.Printf("%v\n", fr.Validate(nil))

IPAddress = ""
fmt.Printf("%v\n", fr.Validate(nil))

fr.IPAddress = nil
fmt.Printf("%v\n", fr.Validate(nil))

fr.TypeID = nil
fmt.Printf("%v\n", fr.Validate(nil))
Output:

<nil>
<nil>
<nil>
<nil>
ipAddress: invalid network IP or CIDR-notation subnet.
ipAddress: invalid network IP or CIDR-notation subnet.
ipAddress: invalid network IP or CIDR-notation subnet.
ipAddress: invalid network IP or CIDR-notation subnet.
ipAddress: cannot be blank.
ipAddress: cannot be blank.
ipAddress: cannot be blank; typeId: cannot be blank.

type FederationResolverMapping

type FederationResolverMapping struct {
	// TTL is the Time-to-Live of a DNS response to a request to resolve this Federation's CNAME
	TTL   *int    `json:"ttl"`
	CName *string `json:"cname"`
	ResolverMapping
}

FederationResolverMapping is the set of all resolvers - both IPv4 and IPv6 - for a specific Federation.

type FederationResolverResponse

type FederationResolverResponse struct {
	Alerts
	Response FederationResolver `json:"response"`
}

FederationResolverResponse represents a Traffic Ops API response to a POST or DELETE request to its /federation_resolvers endpoint.

type FederationResolverType

type FederationResolverType string

A FederationResolverType is the Name of a Type of a Federation Resolver Mapping.

func FederationResolverTypeFromString

func FederationResolverTypeFromString(s string) FederationResolverType

FederationResolverTypeFromString parses a string and returns the corresponding FederationResolverType.

func (FederationResolverType) String

func (t FederationResolverType) String() string

String imlpements the fmt.Stringer interface.

type FederationResolversResponse

type FederationResolversResponse struct {
	Alerts
	Response []FederationResolver `json:"response"`
}

FederationResolversResponse represents a Traffic Ops API response to a GET request to its /federation_resolvers endpoint.

type FederationUser

type FederationUser struct {
	Company  *string `json:"company" db:"company"`
	Email    *string `json:"email" db:"email"`
	FullName *string `json:"fullName" db:"full_name"`
	ID       *int    `json:"id" db:"id"`
	Role     *string `json:"role" db:"role_name"`
	Username *string `json:"username" db:"username"`
}

FederationUser represents Federation Users.

type FederationUserPost

type FederationUserPost struct {
	IDs     []int `json:"userIds"`
	Replace *bool `json:"replace"`
}

FederationUserPost represents POST body for assigning Users to Federations.

func (*FederationUserPost) Validate

func (f *FederationUserPost) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type FederationUsersResponse

type FederationUsersResponse struct {
	Response []FederationUser `json:"response"`
	Alerts
}

FederationUsersResponse is the type of a response from Traffic Ops to a request made to its /federations/{{ID}}/users endpoint.

type FederationsResponse

type FederationsResponse struct {
	Response []AllDeliveryServiceFederationsMapping `json:"response"`
	Alerts
}

FederationsResponse is the type of a response from Traffic Ops to requests to its /federations/all and /federations endpoints.

type Filter deprecated

type Filter int

Filter is a type of unknown purpose - though it appears related to the removed APIv1 endpoints regarding the servers which are assigned to a Delivery Service, not assigned to a Delivery Service, and eligible for assignment to a Delivery Service.

Deprecated: This is not used by any known ATC code, and is likely a remnant of legacy behavior that will be removed in the future.

const (
	Assigned Filter = iota
	Unassigned
	Eligible
)

Enumerated values of the Filter type.

Deprecated: These are not used by any known ATC code, and are likely remnants of legacy behavior that will be removed in the future.

type GenerateCDNDNSSECKeysResponse

type GenerateCDNDNSSECKeysResponse struct {
	Response string `json:"response"`
	Alerts
}

GenerateCDNDNSSECKeysResponse is the type of a response from Traffic Ops to requests made to its /cdns/dnsseckeys/generate and /cdns/dnsseckeys/ksk/generate API endpoints.

type GenericServerCheck

type GenericServerCheck struct {
	CommonCheckFields

	// Checks maps arbitrary checks - up to one per "column" (whatever those mean)
	// done on the server to their values.
	Checks map[string]*int `json:"checks,omitempty"`
}

GenericServerCheck represents a server with some associated meta data presented along with its arbitrary "checks". This is unlike a Servercheck in that the represented checks are not known before the time a request is made, and checks with no value are not presented.

type GetTenantsResponse

type GetTenantsResponse struct {
	Response []Tenant `json:"response"`
	Alerts
}

GetTenantsResponse is the response for a request for a group of tenants.

type HWInfo

type HWInfo struct {
	Description    string    `json:"description" db:"description"`
	ID             int       `json:"-" db:"id"`
	LastUpdated    TimeNoMod `json:"lastUpdated" db:"last_updated"`
	ServerHostName string    `json:"serverHostName" db:"serverhostname"`
	ServerID       int       `json:"serverId" db:"serverid"`
	Val            string    `json:"val" db:"val"`
}

HWInfo can be used to return information about a server's hardware, but the corresponding Traffic Ops API route is deprecated and unusable without alteration.

type HWInfoResponse

type HWInfoResponse struct {
	Response []HWInfo `json:"response"`
}

HWInfoResponse is a list of HWInfos as a response.

type HealthData

type HealthData struct {
	TotalOffline uint64                 `json:"totalOffline"`
	TotalOnline  uint64                 `json:"totalOnline"`
	CacheGroups  []HealthDataCacheGroup `json:"cachegroups"`
}

HealthData is a representation of all of the health information for a CDN or Delivery Service.

This is the type of the `response` property of responses from Traffic Ops to GET requests made to its /deliveryservices/{{ID}}/health and /cdns/health API endpoints.

type HealthDataCacheGroup

type HealthDataCacheGroup struct {
	Offline int64          `json:"offline"`
	Online  int64          `json:"online"`
	Name    CacheGroupName `json:"name"`
}

HealthDataCacheGroup holds health information specific to a particular Cache Group.

type HealthThreshold

type HealthThreshold struct {
	// Val is the actual, numeric, threshold value.
	Val float64
	// Comparator is the comparator used to compare the Val to the monitored
	// value. One of '=', '>', '<', '>=', or '<=' - other values are invalid.
	Comparator string // TODO change to enum?
}

HealthThreshold describes some value against which to compare health measurements to determine if a cache server is healthy.

func StrToThreshold

func StrToThreshold(s string) (HealthThreshold, error)

StrToThreshold takes a string like ">=42" and returns a HealthThreshold with a Val of `42` and a Comparator of `">="`. If no comparator exists, `DefaultHealthThresholdComparator` is used. If the string does not match "(>|<|)(=|)\d+" an error is returned.

func (HealthThreshold) String

func (t HealthThreshold) String() string

String implements the fmt.Stringer interface.

Example
ht := HealthThreshold{Comparator: ">=", Val: 500}
fmt.Println(ht)
Output:

>=500.000000

type HealthThresholdJSONParameters

type HealthThresholdJSONParameters struct {
	// AvailableBandwidthInKbps is The total amount of bandwidth that servers using this profile are
	// allowed, in Kilobits per second. This is a string and using comparison operators to specify
	// ranges, e.g. ">10" means "more than 10 kbps".
	AvailableBandwidthInKbps string `json:"health.threshold.availableBandwidthInKbps,omitempty"`
	// LoadAverage is the UNIX loadavg at which the server should be marked "unhealthy".
	LoadAverage string `json:"health.threshold.loadavg,omitempty"`
	// QueryTime is the highest allowed length of time for completing health queries (after
	// connection has been established) in milliseconds.
	QueryTime string `json:"health.threshold.queryTime,omitempty"`
}

HealthThresholdJSONParameters contains Parameters whose Thresholds must be met in order for Caches using the Profile containing these Parameters to be marked as Healthy.

type IAllFederation

type IAllFederation interface {
	IsAllFederations() bool
}

IAllFederation is an interface for the disparate objects returned by Federations-related Traffic Ops API endpoints. Adds additional safety, allowing functions to only return one of the valid object types for the endpoint.

type IDNoMod

type IDNoMod int

IDNoMod type is used to suppress JSON unmarshalling.

func (*IDNoMod) UnmarshalJSON

func (a *IDNoMod) UnmarshalJSON([]byte) error

UnmarshalJSON implements the json.Unmarshaller interface to suppress unmarshalling for IDNoMod.

type InterfaceName

type InterfaceName string

InterfaceName is the name of a server interface.

type InvalidationJob

type InvalidationJob struct {
	AssetURL        *string `json:"assetUrl"`
	CreatedBy       *string `json:"createdBy"`
	DeliveryService *string `json:"deliveryService"`
	ID              *uint64 `json:"id"`
	Keyword         *string `json:"keyword"`
	Parameters      *string `json:"parameters"`

	// StartTime is the time at which the job will come into effect. Must be in the future, but will
	// fail to Validate if it is further in the future than two days.
	StartTime *Time `json:"startTime"`
}

InvalidationJob represents a content invalidation job as returned by the API.

func (*InvalidationJob) TTLHours

func (job *InvalidationJob) TTLHours() uint

TTLHours will parse job.Parameters to find TTL, returns an int representing number of hours. Returns 0 in case of issue (0 is an invalid TTL).

func (*InvalidationJob) Validate

func (job *InvalidationJob) Validate() error

Validate checks that the InvalidationJob is valid, by ensuring all of its fields are well-defined.

This returns an error describing any and all problematic fields encountered during validation.

type InvalidationJobInput

type InvalidationJobInput struct {

	// DeliveryService needs to be an identifier for a Delivery Service. It can be either a string - in which
	// case it is treated as an XML_ID - or a float64 (because that's the type used by encoding/json
	// to represent all JSON numbers) - in which case it's treated as an integral, unique identifier
	// (and any fractional part is discarded, i.e. 2.34 -> 2)
	DeliveryService *interface{} `json:"deliveryService"`

	// Regex is a regular expression which not only must be valid, but should also start with '/'
	// (or escaped: '\/')
	Regex *string `json:"regex"`

	// StartTime is the time at which the job will come into effect. Must be in the future.
	StartTime *Time `json:"startTime"`

	// TTL indicates the Time-to-Live of the job. This can be either a valid string for
	// time.ParseDuration, or a float64 indicating the number of hours. Note that regardless of the
	// actual value here, Traffic Ops will only consider it rounded down to the nearest natural
	// number
	TTL *interface{} `json:"ttl"`
	// contains filtered or unexported fields
}

InvalidationJobInput represents user input intending to create or modify a content invalidation job.

func (*InvalidationJobInput) DSID

func (j *InvalidationJobInput) DSID(tx *sql.Tx) (uint, error)

DSID gets the integral, unique identifier of the Delivery Service identified by InvalidationJobInput.DeliveryService

This requires a transaction connected to a Traffic Ops database, because if DeliveryService is an xml_id, a database lookup will be necessary to get the unique, integral identifier. Thus, this method also checks for the existence of the identified Delivery Service, and will return an error if it does not exist.

func (*InvalidationJobInput) TTLHours

func (j *InvalidationJobInput) TTLHours() (uint, error)

TTLHours gets the number of hours of the job's TTL - rounded down to the nearest natural number, or an error if it is an invalid value.

Example (Duration)
j := InvalidationJobInput{nil, nil, nil, util.InterfacePtr("121m"), nil, nil}
ttl, e := j.TTLHours()
if e != nil {
	fmt.Printf("Error: %v\n", e)
}
fmt.Println(ttl)
Output:

2
Example (Number)
j := InvalidationJobInput{nil, nil, nil, util.InterfacePtr(2.1), nil, nil}
ttl, e := j.TTLHours()
if e != nil {
	fmt.Printf("Error: %v\n", e)
}
fmt.Println(ttl)
Output:

2

func (*InvalidationJobInput) Validate

func (job *InvalidationJobInput) Validate(tx *sql.Tx) error

Validate validates that the user input is correct, given a transaction connected to the Traffic Ops database. In particular, it enforces the constraints described on each field, as well as ensuring they actually exist. This method calls InvalidationJobInput.DSID to validate the DeliveryService field.

This returns an error describing any and all problematic fields encountered during validation.

type InvalidationJobsResponse

type InvalidationJobsResponse struct {
	Response []InvalidationJob `json:"response"`
	Alerts
}

InvalidationJobsResponse is the type of a response from Traffic Ops to a request made to its /jobs API endpoint.

type IsAvailable

type IsAvailable struct {
	IsAvailable   bool `json:"isAvailable"`
	Ipv4Available bool `json:"ipv4Available"`
	Ipv6Available bool `json:"ipv6Available"`
}

IsAvailable contains whether the given cache or delivery service is available. It is designed for JSON serialization, namely in the Traffic Monitor 1.0 API.

type JWKSMap

type JWKSMap map[string]jwk.Set

func (*JWKSMap) UnmarshalJSON

func (ksm *JWKSMap) UnmarshalJSON(data []byte) error

type Job deprecated

type Job struct {
	Parameters      string `json:"parameters"`
	Keyword         string `json:"keyword"`
	AssetURL        string `json:"assetUrl"`
	CreatedBy       string `json:"createdBy"`
	StartTime       string `json:"startTime"`
	ID              int64  `json:"id"`
	DeliveryService string `json:"deliveryService"`
}

Job represents a content invalidation job as stored in the database.

Deprecated: Use InvalidationJob instead, as it's more flexible.

type JobRequest deprecated

type JobRequest struct {
	TTL               time.Duration
	StartTime         time.Time
	DeliveryServiceID int64
	Regex             string
	Urgent            bool
}

JobRequest contains the data to create a job. Note this is a convenience struct for posting users; the actual JSON object is a JobRequestAPI

Deprecated: Use InvalidationJobInput instead, as it's more flexible.

func (JobRequest) MarshalJSON

func (jr JobRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface.

func (*JobRequest) UnmarshalJSON

func (jr *JobRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the encoding/json Unmarshaler interface.

type JobRequestAPI deprecated

type JobRequestAPI struct {
	TTLSeconds int64  `json:"ttl"`
	StartTime  string `json:"startTime"`
	DSID       int64  `json:"dsId"`
	Regex      string `json:"regex"`
	Urgent     bool   `json:"urgent"`
}

JobRequestAPI represents the JSON input accepted by the API for creating new content invalidation jobs.

Deprecated: This structure is technically incorrect, and has been superseded by the InvalidationJobInput structure.

type LegacyDeliveryServiceFederationResolverMappingRequest

type LegacyDeliveryServiceFederationResolverMappingRequest struct {
	Federations []DeliveryServiceFederationResolverMapping `json:"federations"`
}

LegacyDeliveryServiceFederationResolverMappingRequest is the legacy format for a request to create (or modify) the Federation Resolver mappings of one or more Delivery Services. Use this for compatibility with API versions 1.3 and older.

func (*LegacyDeliveryServiceFederationResolverMappingRequest) Validate

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type LegacyInterfaceDetails deprecated

type LegacyInterfaceDetails struct {
	InterfaceMtu  *int    `json:"interfaceMtu" db:"interface_mtu"`
	InterfaceName *string `json:"interfaceName" db:"interface_name"`
	IP6Address    *string `json:"ip6Address" db:"ip6_address"`
	IP6Gateway    *string `json:"ip6Gateway" db:"ip6_gateway"`
	IPAddress     *string `json:"ipAddress" db:"ip_address"`
	IPGateway     *string `json:"ipGateway" db:"ip_gateway"`
	IPNetmask     *string `json:"ipNetmask" db:"ip_netmask"`
}

LegacyInterfaceDetails is the details for interfaces on servers for API v2.

Deprecated: Traffic Ops API version 2 is deprecated, upgrade to Server representations that support interfaces (i.e. ServerInterfaceInfoV40 slices).

func InterfaceInfoToLegacyInterfaces deprecated

func InterfaceInfoToLegacyInterfaces(serverInterfaces []ServerInterfaceInfo) (LegacyInterfaceDetails, error)

InterfaceInfoToLegacyInterfaces converts a ServerInterfaceInfo to an equivalent LegacyInterfaceDetails structure. It does this by creating the IP address fields using the "service" interface's IP addresses. All others are discarded, as the legacy format is incapable of representing them.

Deprecated: LegacyInterfaceDetails is deprecated, and this will be removed with it.

func V4InterfaceInfoToLegacyInterfaces deprecated

func V4InterfaceInfoToLegacyInterfaces(serverInterfaces []ServerInterfaceInfoV40) (LegacyInterfaceDetails, error)

V4InterfaceInfoToLegacyInterfaces downgrades a set of ServerInterfaceInfoV40s to a LegacyInterfaceDetails.

Deprecated: LegacyInterfaceDetails is deprecated, and this will be removed with it.

func (LegacyInterfaceDetails) String

func (lid LegacyInterfaceDetails) String() string

String implements the fmt.Stringer interface.

Example
ipv4 := "192.0.2.0"
ipv6 := "2001:DB8::/64"
name := "test"
mtu := 9000

lid := LegacyInterfaceDetails{
	InterfaceMtu:  &mtu,
	InterfaceName: &name,
	IP6Address:    &ipv6,
	IP6Gateway:    nil,
	IPAddress:     &ipv4,
	IPGateway:     nil,
	IPNetmask:     nil,
}

fmt.Println(lid.String())
Output:

LegacyInterfaceDetails(InterfaceMtu=9000, InterfaceName='test', IP6Address='2001:DB8::/64', IP6Gateway=nil, IPAddress='192.0.2.0', IPGateway=nil, IPNetmask=nil)

func (*LegacyInterfaceDetails) ToInterfaces deprecated

func (lid *LegacyInterfaceDetails) ToInterfaces(ipv4IsService, ipv6IsService bool) ([]ServerInterfaceInfo, error)

ToInterfaces converts a LegacyInterfaceDetails to a slice of ServerInterfaceInfo structures. Only one interface is expected and will be marked for monitoring. It will generate service addresses according to the passed indicators for each address family.

Deprecated: LegacyInterfaceDetails is deprecated, and this will be removed with it.

Example
lid := LegacyInterfaceDetails{
	InterfaceMtu:  new(int),
	InterfaceName: new(string),
	IP6Address:    new(string),
	IP6Gateway:    new(string),
	IPAddress:     new(string),
	IPGateway:     new(string),
	IPNetmask:     new(string),
}
*lid.InterfaceMtu = 9000
*lid.InterfaceName = "test"
*lid.IP6Address = "::14/64"
*lid.IP6Gateway = "::15"
*lid.IPAddress = "1.2.3.4"
*lid.IPGateway = "4.3.2.1"
*lid.IPNetmask = "255.255.255.252"

ifaces, err := lid.ToInterfaces(true, false)
if err != nil {
	fmt.Printf(err.Error())
	return
}

for _, iface := range ifaces {
	fmt.Printf("name=%s, monitor=%t\n", iface.Name, iface.Monitor)
	for _, ip := range iface.IPAddresses {
		fmt.Printf("\taddr=%s, gateway=%s, service address=%t\n", ip.Address, *ip.Gateway, ip.ServiceAddress)
	}
}
Output:

name=test, monitor=true
	addr=1.2.3.4/30, gateway=4.3.2.1, service address=true
	addr=::14/64, gateway=::15, service address=false

func (*LegacyInterfaceDetails) ToInterfacesV4 deprecated

func (lid *LegacyInterfaceDetails) ToInterfacesV4(ipv4IsService, ipv6IsService bool, routerName, routerPort *string) ([]ServerInterfaceInfoV40, error)

ToInterfacesV4 converts a LegacyInterfaceDetails to a slice of ServerInterfaceInfoV40 structures.

Only one interface is expected and will be marked for monitoring. This will generate service addresses according to the passed indicators for each address family.

The passed routerName and routerPort can be nil, which will leave the upgradeded interfaces' RouterHostName and RouterPortName unset, or they can be pointers to string values to which ALL of the interfaces will have their RouterHostName and RouterPortName set.

Deprecated: LegacyInterfaceDetails is deprecated, and this will be removed with it.

type LegacyStats deprecated

type LegacyStats struct {
	CommonAPIData
	Caches map[CacheName]map[string][]ResultStatVal `json:"caches"`
}

LegacyStats is designed for returning via the API. It contains result history for each cache server, as well as common API data.

Deprecated: This structure is incapable of representing interface-level stats, so new code should use Stats instead.

type LegacyTMConfigResponse deprecated

type LegacyTMConfigResponse struct {
	Response LegacyTrafficMonitorConfig `json:"response"`
}

LegacyTMConfigResponse was the response to requests made to the cdns/{{Name}}/configs/monitoring endpoint of the Traffic Ops API in older API versions.

Deprecated: New code should use TMConfigResponse instead.

type LegacyTrafficDSStatsSummary deprecated

type LegacyTrafficDSStatsSummary struct {
	TrafficStatsSummary
	// TotalBytes is the total number of kilobytes served when the "metric type" requested is "kbps"
	// (or actually just contains "kbps"). If this is not nil, TotalTransactions *should* always be
	// nil.
	TotalBytes *float64 `json:"totalBytes"`
	// Totaltransactions is the total number of transactions within the requested window. Whenever
	// the requested metric doesn't contain "kbps", it assumed to be some kind of transactions
	// measurement. In that case, this will not be nil - otherwise it will be nil. If this not nil,
	// TotalBytes *should* always be nil.
	TotalTransactions *float64 `json:"totalTransactions"`
}

LegacyTrafficDSStatsSummary contains summary statistics for a data series for Delivery Service stats.

Deprecated: This uses a confusing, incorrect name for the total number of kilobytes served, so new code should use TrafficDSStatsSummary instead.

type LegacyTrafficMonitorConfig

type LegacyTrafficMonitorConfig struct {
	TrafficServers   []LegacyTrafficServer  `json:"trafficServers,omitempty"`
	CacheGroups      []TMCacheGroup         `json:"cacheGroups,omitempty"`
	Config           map[string]interface{} `json:"config,omitempty"`
	TrafficMonitors  []TrafficMonitor       `json:"trafficMonitors,omitempty"`
	DeliveryServices []TMDeliveryService    `json:"deliveryServices,omitempty"`
	Profiles         []TMProfile            `json:"profiles,omitempty"`
}

LegacyTrafficMonitorConfig represents TrafficMonitorConfig for ATC versions before 5.0.

func (*LegacyTrafficMonitorConfig) Upgrade deprecated

Upgrade converts a legacy TM Config to the newer structure.

Deprecated: LegacyTrafficMonitoryConfig is deprecated. New code should just use TrafficMonitorConfig instead.

type LegacyTrafficMonitorConfigMap deprecated

type LegacyTrafficMonitorConfigMap struct {
	TrafficServer   map[string]LegacyTrafficServer
	CacheGroup      map[string]TMCacheGroup
	Config          map[string]interface{}
	TrafficMonitor  map[string]TrafficMonitor
	DeliveryService map[string]TMDeliveryService
	Profile         map[string]TMProfile
}

LegacyTrafficMonitorConfigMap is a representation of a LegacyTrafficMonitorConfig using unique values as map keys.

Deprecated: This structure is incapable of representing per-interface configuration information for servers, so new code should use TrafficMonitorConfigMap instead.

func LegacyTrafficMonitorTransformToMap

func LegacyTrafficMonitorTransformToMap(tmConfig *LegacyTrafficMonitorConfig) (*LegacyTrafficMonitorConfigMap, error)

LegacyTrafficMonitorTransformToMap converts the given LegacyTrafficMonitorConfig to a LegacyTrafficMonitorConfigMap.

This also implicitly calls LegacyMonitorConfigValid on the LegacyTrafficMonitorConfigMap before returning it, and gives back whatever value that returns as the error return value.

func (*LegacyTrafficMonitorConfigMap) Upgrade deprecated

Upgrade returns a TrafficMonitorConfigMap that is equivalent to this legacy configuration map.

Note that all fields except TrafficServer are "shallow" copies, so modifying the original will impact the upgraded copy.

Deprecated: LegacyTrafficMonitorConfigMap is deprecated.

Example
lcm := LegacyTrafficMonitorConfigMap{
	CacheGroup: map[string]TMCacheGroup{
		"test": {
			Name: "test",
			Coordinates: MonitoringCoordinates{
				Latitude:  0,
				Longitude: 0,
			},
		},
	},
	Config: map[string]interface{}{
		"foo": "bar",
	},
	DeliveryService: map[string]TMDeliveryService{
		"test": {
			XMLID:              "test",
			TotalTPSThreshold:  -1,
			ServerStatus:       "testStatus",
			TotalKbpsThreshold: -1,
		},
	},
	Profile: map[string]TMProfile{
		"test": {
			Parameters: TMParameters{
				HealthConnectionTimeout: -1,
				HealthPollingURL:        "testURL",
				HealthPollingFormat:     "astats",
				HealthPollingType:       "http",
				HistoryCount:            -1,
				MinFreeKbps:             -1,
				Thresholds: map[string]HealthThreshold{
					"availableBandwidthInKbps": {
						Comparator: "<",
						Val:        -1,
					},
				},
			},
			Name: "test",
			Type: "testType",
		},
	},
	TrafficMonitor: map[string]TrafficMonitor{
		"test": {
			Port:         -1,
			IP6:          "::1",
			IP:           "0.0.0.0",
			HostName:     "test",
			FQDN:         "test.quest",
			Profile:      "test",
			Location:     "test",
			ServerStatus: "testStatus",
		},
	},
	TrafficServer: map[string]LegacyTrafficServer{
		"test": {
			CacheGroup:       "test",
			DeliveryServices: []tsdeliveryService{},
			FQDN:             "test.quest",
			HashID:           "test",
			HostName:         "test",
			HTTPSPort:        -1,
			InterfaceName:    "testInterface",
			IP:               "0.0.0.1",
			IP6:              "::2",
			Port:             -1,
			Profile:          "test",
			ServerStatus:     "testStatus",
			Type:             "testType",
		},
	},
}

cm := lcm.Upgrade()
fmt.Println("# of Cachegroups:", len(cm.CacheGroup))
fmt.Println("Cachegroup Name:", cm.CacheGroup["test"].Name)
fmt.Printf("Cachegroup Coordinates: (%v,%v)\n", cm.CacheGroup["test"].Coordinates.Latitude, cm.CacheGroup["test"].Coordinates.Longitude)
fmt.Println("# of Config parameters:", len(cm.Config))
fmt.Println(`Config["foo"]:`, cm.Config["foo"])
fmt.Println("# of DeliveryServices:", len(cm.DeliveryService))
fmt.Println("DeliveryService XMLID:", cm.DeliveryService["test"].XMLID)
fmt.Println("DeliveryService TotalTPSThreshold:", cm.DeliveryService["test"].TotalTPSThreshold)
fmt.Println("DeliveryService ServerStatus:", cm.DeliveryService["test"].ServerStatus)
fmt.Println("DeliveryService TotalKbpsThreshold:", cm.DeliveryService["test"].TotalKbpsThreshold)
fmt.Println("# of Profiles:", len(cm.Profile))
fmt.Println("Profile Name:", cm.Profile["test"].Name)
fmt.Println("Profile Type:", cm.Profile["test"].Type)
fmt.Println("Profile HealthConnectionTimeout:", cm.Profile["test"].Parameters.HealthConnectionTimeout)
fmt.Println("Profile HealthPollingURL:", cm.Profile["test"].Parameters.HealthPollingURL)
fmt.Println("Profile HealthPollingFormat:", cm.Profile["test"].Parameters.HealthPollingFormat)
fmt.Println("Profile HealthPollingType:", cm.Profile["test"].Parameters.HealthPollingType)
fmt.Println("Profile HistoryCount:", cm.Profile["test"].Parameters.HistoryCount)
fmt.Println("Profile MinFreeKbps:", cm.Profile["test"].Parameters.MinFreeKbps)
fmt.Println("# of Profile Thresholds:", len(cm.Profile["test"].Parameters.Thresholds))
fmt.Println("Profile availableBandwidthInKbps Threshold:", cm.Profile["test"].Parameters.Thresholds["availableBandwidthInKbps"])
fmt.Println("# of TrafficMonitors:", len(cm.TrafficMonitor))
fmt.Println("TrafficMonitor Port:", cm.TrafficMonitor["test"].Port)
fmt.Println("TrafficMonitor IP6:", cm.TrafficMonitor["test"].IP6)
fmt.Println("TrafficMonitor IP:", cm.TrafficMonitor["test"].IP)
fmt.Println("TrafficMonitor HostName:", cm.TrafficMonitor["test"].HostName)
fmt.Println("TrafficMonitor FQDN:", cm.TrafficMonitor["test"].FQDN)
fmt.Println("TrafficMonitor Profile:", cm.TrafficMonitor["test"].Profile)
fmt.Println("TrafficMonitor Location:", cm.TrafficMonitor["test"].Location)
fmt.Println("TrafficMonitor ServerStatus:", cm.TrafficMonitor["test"].ServerStatus)
fmt.Println("# of TrafficServers:", len(cm.TrafficServer))
fmt.Println("TrafficServer CacheGroup:", cm.TrafficServer["test"].CacheGroup)
fmt.Println("TrafficServer # of DeliveryServices:", len(cm.TrafficServer["test"].DeliveryServices))
fmt.Println("TrafficServer FQDN:", cm.TrafficServer["test"].FQDN)
fmt.Println("TrafficServer HashID:", cm.TrafficServer["test"].HashID)
fmt.Println("TrafficServer HostName:", cm.TrafficServer["test"].HostName)
fmt.Println("TrafficServer HTTPSPort:", cm.TrafficServer["test"].HTTPSPort)
fmt.Println("TrafficServer # of Interfaces:", len(cm.TrafficServer["test"].Interfaces))
fmt.Println("TrafficServer Interface Name:", cm.TrafficServer["test"].Interfaces[0].Name)
fmt.Println("TrafficServer # of Interface IP Addresses:", len(cm.TrafficServer["test"].Interfaces[0].IPAddresses))
fmt.Println("TrafficServer first IP Address:", cm.TrafficServer["test"].Interfaces[0].IPAddresses[0].Address)
fmt.Println("TrafficServer second IP Address:", cm.TrafficServer["test"].Interfaces[0].IPAddresses[1].Address)
fmt.Println("TrafficServer Port:", cm.TrafficServer["test"].Port)
fmt.Println("TrafficServer Profile:", cm.TrafficServer["test"].Profile)
fmt.Println("TrafficServer ServerStatus:", cm.TrafficServer["test"].ServerStatus)
fmt.Println("TrafficServer Type:", cm.TrafficServer["test"].Type)
Output:

# of Cachegroups: 1
Cachegroup Name: test
Cachegroup Coordinates: (0,0)
# of Config parameters: 1
Config["foo"]: bar
# of DeliveryServices: 1
DeliveryService XMLID: test
DeliveryService TotalTPSThreshold: -1
DeliveryService ServerStatus: testStatus
DeliveryService TotalKbpsThreshold: -1
# of Profiles: 1
Profile Name: test
Profile Type: testType
Profile HealthConnectionTimeout: -1
Profile HealthPollingURL: testURL
Profile HealthPollingFormat: astats
Profile HealthPollingType: http
Profile HistoryCount: -1
Profile MinFreeKbps: -1
# of Profile Thresholds: 1
Profile availableBandwidthInKbps Threshold: <-1.000000
# of TrafficMonitors: 1
TrafficMonitor Port: -1
TrafficMonitor IP6: ::1
TrafficMonitor IP: 0.0.0.0
TrafficMonitor HostName: test
TrafficMonitor FQDN: test.quest
TrafficMonitor Profile: test
TrafficMonitor Location: test
TrafficMonitor ServerStatus: testStatus
# of TrafficServers: 1
TrafficServer CacheGroup: test
TrafficServer # of DeliveryServices: 0
TrafficServer FQDN: test.quest
TrafficServer HashID: test
TrafficServer HostName: test
TrafficServer HTTPSPort: -1
TrafficServer # of Interfaces: 1
TrafficServer Interface Name: testInterface
TrafficServer # of Interface IP Addresses: 2
TrafficServer first IP Address: 0.0.0.1
TrafficServer second IP Address: ::2
TrafficServer Port: -1
TrafficServer Profile: test
TrafficServer ServerStatus: testStatus
TrafficServer Type: testType

type LegacyTrafficServer deprecated

type LegacyTrafficServer struct {
	CacheGroup       string              `json:"cacheGroup"`
	DeliveryServices []tsdeliveryService `json:"deliveryServices,omitempty"` // the deliveryServices key does not exist on mids
	FQDN             string              `json:"fqdn"`
	HashID           string              `json:"hashId"`
	HostName         string              `json:"hostName"`
	HTTPSPort        int                 `json:"httpsPort,omitempty"`
	InterfaceName    string              `json:"interfaceName"`
	IP               string              `json:"ip"`
	IP6              string              `json:"ip6"`
	Port             int                 `json:"port"`
	Profile          string              `json:"profile"`
	ServerStatus     string              `json:"status"`
	Type             string              `json:"type"`
}

A LegacyTrafficServer is a representation of a cache server containing a subset of the information available in a server structure that conveys all the information important for Traffic Router and Traffic Monitor to handle it.

Deprecated: The configuration versions that use this structure to represent a cache server are deprecated, new code should use TrafficServer instead.

func (LegacyTrafficServer) Upgrade deprecated

func (s LegacyTrafficServer) Upgrade() TrafficServer

Upgrade upgrades the LegacyTrafficServer into its modern-day equivalent.

Note that the DeliveryServices slice is a "shallow" copy of the original, so making changes to the original slice will affect the upgraded copy.

Deprecated: LegacyTrafficServer is deprecated.

Example
lts := LegacyTrafficServer{
	CacheGroup:       "testCG",
	DeliveryServices: []tsdeliveryService{},
	FQDN:             "test.quest",
	HashID:           "test",
	HostName:         "test",
	HTTPSPort:        -1,
	InterfaceName:    "testInterface",
	IP:               "198.0.2.0",
	IP6:              "2001:DB8::1",
	Port:             -1,
	Profile:          "testProfile",
	ServerStatus:     "testStatus",
	Type:             "testType",
}

ts := lts.Upgrade()
fmt.Println("CacheGroup:", ts.CacheGroup)
fmt.Println("# of DeliveryServices:", len(ts.DeliveryServices))
fmt.Println("FQDN:", ts.FQDN)
fmt.Println("HashID:", ts.HashID)
fmt.Println("HostName:", ts.HostName)
fmt.Println("HTTPSPort:", ts.HTTPSPort)
fmt.Println("# of Interfaces:", len(ts.Interfaces))
fmt.Println("Interface Name:", ts.Interfaces[0].Name)
fmt.Println("# of Interface IP Addresses:", len(ts.Interfaces[0].IPAddresses))
fmt.Println("first IP Address:", ts.Interfaces[0].IPAddresses[0].Address)
fmt.Println("second IP Address:", ts.Interfaces[0].IPAddresses[1].Address)
fmt.Println("Port:", ts.Port)
fmt.Println("Profile:", ts.Profile)
fmt.Println("ServerStatus:", ts.ServerStatus)
fmt.Println("Type:", ts.Type)
Output:

CacheGroup: testCG
# of DeliveryServices: 0
FQDN: test.quest
HashID: test
HostName: test
HTTPSPort: -1
# of Interfaces: 1
Interface Name: testInterface
# of Interface IP Addresses: 2
first IP Address: 198.0.2.0
second IP Address: 2001:DB8::1
Port: -1
Profile: testProfile
ServerStatus: testStatus
Type: testType

type LocalizationMethod

type LocalizationMethod string

LocalizationMethod represents an enabled localization method for a Cache Group. The string values of this type should match the Traffic Ops values.

func LocalizationMethodFromString

func LocalizationMethodFromString(s string) LocalizationMethod

LocalizationMethodFromString parses and returns a LocalizationMethod from its string representation.

This is cAsE-iNsEnSiTiVe.

func (LocalizationMethod) MarshalJSON

func (m LocalizationMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface.

func (*LocalizationMethod) Scan

func (m *LocalizationMethod) Scan(value interface{}) error

Scan implements the database/sql.Scanner interface.

func (LocalizationMethod) String

func (m LocalizationMethod) String() string

String returns a string representation of this LocalizationMethod, implementing the fmt.Stringer interface.

func (*LocalizationMethod) UnmarshalJSON

func (m *LocalizationMethod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

type Log

type Log struct {
	ID          *int    `json:"id"`
	LastUpdated *Time   `json:"lastUpdated"`
	Level       *string `json:"level"`
	Message     *string `json:"message"`
	TicketNum   *int    `json:"ticketNum"`
	User        *string `json:"user"`
}

Log contains a change that has been made to the Traffic Control system.

type LogsResponse

type LogsResponse struct {
	Response []Log `json:"response"`
	Alerts
}

LogsResponse is a list of Logs as a response.

type MatchList

type MatchList struct {
	Regex     string `json:"regex"`
	MatchType string `json:"match-type"`
}

A MatchList is actually just a single match item in a match list.

type MatchSet

type MatchSet struct {
	Protocol  string      `json:"protocol"`
	MatchList []MatchList `json:"matchlist"`
}

MatchSet structures are a list of MatchList structures with an associated Protocol.

type MissLocation

type MissLocation struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

MissLocation is a geographic location that will be used in the event that a client request cannot be localized (a "Geo Miss").

type MonitoringCoordinates

type MonitoringCoordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

MonitoringCoordinates holds a coordinate pair for inclusion as a field in TMCacheGroup.

type NewLogCountResp

type NewLogCountResp struct {
	NewLogCount uint64 `json:"newLogcount"`
}

NewLogCountResp is the response returned when the total number of new changes made to the Traffic Control system is requested. "New" means since the last time this information was requested.

type OSVersionsAPIResponse

type OSVersionsAPIResponse struct {
	// Structure of this map:
	//  key:   Name of OS
	//  value: Directory where the ISO source can be found
	Response map[string]string `json:"response"`
	Alerts
}

OSVersionsAPIResponse is the type of a response from Traffic Ops to a request to its /osversions endpoint.

type OSVersionsResponse

type OSVersionsResponse map[string]string

OSVersionsResponse is the JSON representation of the OS versions data for ISO generation.

type Origin

type Origin struct {
	Cachegroup        *string    `json:"cachegroup" db:"cachegroup"`
	CachegroupID      *int       `json:"cachegroupId" db:"cachegroup_id"`
	Coordinate        *string    `json:"coordinate" db:"coordinate"`
	CoordinateID      *int       `json:"coordinateId" db:"coordinate_id"`
	DeliveryService   *string    `json:"deliveryService" db:"deliveryservice"`
	DeliveryServiceID *int       `json:"deliveryServiceId" db:"deliveryservice_id"`
	FQDN              *string    `json:"fqdn" db:"fqdn"`
	ID                *int       `json:"id" db:"id"`
	IP6Address        *string    `json:"ip6Address" db:"ip6_address"`
	IPAddress         *string    `json:"ipAddress" db:"ip_address"`
	IsPrimary         *bool      `json:"isPrimary" db:"is_primary"`
	LastUpdated       *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name              *string    `json:"name" db:"name"`
	Port              *int       `json:"port" db:"port"`
	Profile           *string    `json:"profile" db:"profile"`
	ProfileID         *int       `json:"profileId" db:"profile_id"`
	Protocol          *string    `json:"protocol" db:"protocol"`
	Tenant            *string    `json:"tenant" db:"tenant"`
	TenantID          *int       `json:"tenantId" db:"tenant_id"`
}

Origin contains information relating to an Origin, which is NOT, in general, the same as an origin *server*.

type OriginDetailResponse

type OriginDetailResponse struct {
	Response Origin `json:"response"`
	Alerts
}

OriginDetailResponse is the JSON object returned for a single origin.

type OriginHeaders

type OriginHeaders []string

OriginHeaders represents a list of the headers that must be sent to the Origin.

func (*OriginHeaders) UnmarshalJSON

func (o *OriginHeaders) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type OriginsResponse

type OriginsResponse struct {
	Response []Origin `json:"response"`
	Alerts
}

OriginsResponse is a list of Origins as a response.

type Parameter

type Parameter struct {
	ConfigFile  string          `json:"configFile" db:"config_file"`
	ID          int             `json:"id" db:"id"`
	LastUpdated TimeNoMod       `json:"lastUpdated" db:"last_updated"`
	Name        string          `json:"name" db:"name"`
	Profiles    json.RawMessage `json:"profiles" db:"profiles"`
	Secure      bool            `json:"secure" db:"secure"`
	Value       string          `json:"value" db:"value"`
}

A Parameter defines some configuration setting (which is usually but definitely not always a line in a configuration file) used by some Profile or Cache Group.

type ParameterName

type ParameterName string

ParameterName represents the name of a Traffic Ops Parameter.

This has no additional attached semantics.

type ParameterNullable

type ParameterNullable struct {
	//
	// NOTE: the db: struct tags are used for testing to map to their equivalent database column (if there is one)
	//
	ConfigFile  *string         `json:"configFile" db:"config_file"`
	ID          *int            `json:"id" db:"id"`
	LastUpdated *TimeNoMod      `json:"lastUpdated" db:"last_updated"`
	Name        *string         `json:"name" db:"name"`
	Profiles    json.RawMessage `json:"profiles" db:"profiles"`
	Secure      *bool           `json:"secure" db:"secure"`
	Value       *string         `json:"value" db:"value"`
}

ParameterNullable is exactly like Parameter except that its properties are reference values, so they can be nil.

type ParametersResponse

type ParametersResponse struct {
	Response []Parameter `json:"response"`
	Alerts
}

ParametersResponse is the type of the response from Traffic Ops to GET requests made to the /parameters and /profiles/name/{{Name}}/parameters endpoints of its API.

type PhysLocation

type PhysLocation struct {

	//
	// The Street Address of the physical location
	//
	// required: true
	Address string `json:"address" db:"address"`

	//
	// The Address of the physical location
	//
	// required: true
	City string `json:"city" db:"city"`

	//
	// comments are additional details about the physical location
	//
	Comments string `json:"comments" db:"comments"`

	//
	// The email address for the Point of Contact at the physical location
	//
	Email string `json:"email" db:"email"`

	//
	// The name of the physical location
	//
	// required: true
	ID int `json:"id" db:"id"`

	// Timestamp of the last time this row was updated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`

	//
	// The name of the physical location
	//
	// required: true
	Name string `json:"name" db:"name"`

	//
	// The phone number of the physical location
	//
	// required: true
	Phone string `json:"phone" db:"phone"`

	//
	// The Point Of Contact at the physical location
	//
	// required: true
	POC string `json:"poc" db:"poc"`

	//
	// The RegionID associated to this physical location
	//
	// required: true
	RegionID int `json:"regionId" db:"region"`

	//
	// The Region Name for the region associated to this physical location
	//
	RegionName string `json:"region" db:"region_name"`

	//
	// The shortName for the physical location (like an alias)
	//
	// required: true
	ShortName string `json:"shortName" db:"short_name"`

	//
	// The State for the physical location
	//
	// required: true
	State string `json:"state" db:"state"`

	//
	// The Zipcode for the physical location
	//
	// required: true
	Zip string `json:"zip" db:"zip"`
}

PhysLocation contains the physical location of a cache group.

type PhysLocationNullable

type PhysLocationNullable struct {
	//
	// The Street Address of the physical location
	//
	// required: true
	Address *string `json:"address" db:"address"`

	//
	// The Address of the physical location
	//
	// required: true
	City *string `json:"city" db:"city"`

	//
	// comments are additional details about the physical location
	//
	Comments *string `json:"comments" db:"comments"`

	//
	// The email address for the Point of Contact at the physical location
	//
	Email *string `json:"email" db:"email"`

	//
	// The name of the physical location
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// Timestamp of the last time this row was updated
	//
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`

	//
	// The name of the physical location
	//
	// required: true
	Name *string `json:"name" db:"name"`

	//
	// The phone number of the physical location
	//
	// required: true
	Phone *string `json:"phone" db:"phone"`

	//
	// The Point Of Contact at the physical location
	//
	// required: true
	POC *string `json:"poc" db:"poc"`

	//
	// The RegionID associated to this physical location
	//
	// required: true
	RegionID *int `json:"regionId" db:"region"`

	//
	// The Region Name for the region associated to this physical location
	//
	RegionName *string `json:"region" db:"region_name"`

	//
	// The shortName for the physical location (like an alias)
	//
	// required: true
	ShortName *string `json:"shortName" db:"short_name"`

	//
	// The State for the physical location
	//
	// required: true
	State *string `json:"state" db:"state"`

	//
	// The Zipcode for the physical location
	//
	// required: true
	Zip *string `json:"zip" db:"zip"`
}

PhysLocationNullable contains the physical location of a cache group. It allows for all fields to be null.

type PhysLocationResponse

type PhysLocationResponse struct {
	Response PhysLocationNullable `json:"response"`
	Alerts
}

PhysLocationResponse is a single PhysLocationNullable as a response.

type PhysLocationTrimmed

type PhysLocationTrimmed struct {
	Name string `json:"name"`
}

PhysLocationTrimmed contains only the name of a physical location.

type PhysLocationsResponse

type PhysLocationsResponse struct {
	Response []PhysLocation `json:"response"`
	Alerts
}

PhysLocationsResponse is a list of PhysLocations as a response.

type Plugin

type Plugin struct {
	Name        *string `json:"name"`
	Version     *string `json:"version"`
	Description *string `json:"description"`
}

Plugin represents a TO enabled plugin used by Traffic Ops.

type PluginsResponse

type PluginsResponse struct {
	Response []Plugin `json:"response"`
}

PluginsResponse represents the response from Traffic Ops when getting enabled plugins.

type PostParamProfile

type PostParamProfile struct {
	ParamID    *int64   `json:"paramId"`
	ProfileIDs *[]int64 `json:"profileIds"`
	Replace    *bool    `json:"replace"`
}

A PostParamProfile is a request to associate a particular Parameter with zero or more Profiles.

func (*PostParamProfile) Sanitize

func (pp *PostParamProfile) Sanitize(tx *sql.Tx)

Sanitize ensures that Replace is not nil, setting it to false if it is.

TODO: Figure out why this is taking a db transaction - should this be moved?

func (*PostParamProfile) Validate

func (pp *PostParamProfile) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type PostProfileParam

type PostProfileParam struct {
	ProfileID *int64   `json:"profileId"`
	ParamIDs  *[]int64 `json:"paramIds"`
	Replace   *bool    `json:"replace"`
}

A PostProfileParam is a request to associate zero or more Parameters with a particular Profile.

func (*PostProfileParam) Sanitize

func (pp *PostProfileParam) Sanitize(tx *sql.Tx)

Sanitize ensures that Replace is not nil, setting it to false if it is.

TODO: Figure out why this is taking a db transaction - should this be moved?

func (*PostProfileParam) Validate

func (pp *PostProfileParam) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type Profile

type Profile struct {
	ID              int                 `json:"id" db:"id"`
	LastUpdated     TimeNoMod           `json:"lastUpdated"`
	Name            string              `json:"name"`
	Parameter       string              `json:"param"`
	Description     string              `json:"description"`
	CDNName         string              `json:"cdnName"`
	CDNID           int                 `json:"cdn"`
	RoutingDisabled bool                `json:"routingDisabled"`
	Type            string              `json:"type"`
	Parameters      []ParameterNullable `json:"params,omitempty"`
}

A Profile represents a set of configuration for a server or Delivery Service which may be reused to allow sharing configuration across the objects to which it is assigned.

type ProfileCopy

type ProfileCopy struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	ExistingID   int    `json:"idCopyFrom"`
	ExistingName string `json:"profileCopyFrom"`
	Description  string `json:"description"`
}

ProfileCopy contains details about the profile created from an existing profile.

type ProfileCopyResponse

type ProfileCopyResponse struct {
	Response ProfileCopy `json:"response"`
	Alerts
}

ProfileCopyResponse represents the Traffic Ops API's response when a Profile is copied.

type ProfileExportImportNullable

type ProfileExportImportNullable struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
	CDNName     *string `json:"cdn"`
	Type        *string `json:"type"`
}

ProfileExportImportNullable is an object of the form used by Traffic Ops to represent exported and imported profiles.

type ProfileExportImportParameterNullable

type ProfileExportImportParameterNullable struct {
	ConfigFile *string `json:"config_file"`
	Name       *string `json:"name"`
	Value      *string `json:"value"`
}

ProfileExportImportParameterNullable is an object of the form used by Traffic Ops to represent parameters for exported and imported profiles.

type ProfileExportResponse

type ProfileExportResponse struct {
	// Parameters associated to the profile
	//
	Profile ProfileExportImportNullable `json:"profile"`

	// Parameters associated to the profile
	//
	Parameters []ProfileExportImportParameterNullable `json:"parameters"`

	Alerts
}

ProfileExportResponse is an object of the form used by Traffic Ops to represent exported profile response.

type ProfileImportRequest

type ProfileImportRequest struct {
	// Parameters associated to the profile
	//
	Profile ProfileExportImportNullable `json:"profile"`

	// Parameters associated to the profile
	//
	Parameters []ProfileExportImportParameterNullable `json:"parameters"`
}

ProfileImportRequest is an object of the form used by Traffic Ops to represent a request to import a profile.

func (*ProfileImportRequest) Validate

func (profileImport *ProfileImportRequest) Validate(tx *sql.Tx) error

Validate validates an profile import request, implementing the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type ProfileImportResponse

type ProfileImportResponse struct {
	Response ProfileImportResponseObj `json:"response"`
	Alerts
}

ProfileImportResponse is an object of the form used by Traffic Ops to represent a response from importing a profile.

type ProfileImportResponseObj

type ProfileImportResponseObj struct {
	ProfileExportImportNullable
	ID *int `json:"id"`
}

ProfileImportResponseObj contains data about the profile being imported.

type ProfileNullable

type ProfileNullable struct {
	ID              *int                `json:"id" db:"id"`
	LastUpdated     *TimeNoMod          `json:"lastUpdated" db:"last_updated"`
	Name            *string             `json:"name" db:"name"`
	Description     *string             `json:"description" db:"description"`
	CDNName         *string             `json:"cdnName" db:"cdn_name"`
	CDNID           *int                `json:"cdn" db:"cdn"`
	RoutingDisabled *bool               `json:"routingDisabled" db:"routing_disabled"`
	Type            *string             `json:"type" db:"type"`
	Parameters      []ParameterNullable `json:"params,omitempty"`
}

ProfileNullable is exactly the same as Profile except that its fields are reference values, so they may be nil.

type ProfileParam

type ProfileParam struct {
	// Parameter is the ID of the Parameter.
	Parameter int `json:"parameter"`
	// Profile is the name of the Profile to which the Parameter is assigned.
	Profile     string     `json:"profile"`
	LastUpdated *TimeNoMod `json:"lastUpdated"`
}

ProfileParam is a relationship between a Profile and some Parameter assigned to it as it appears in the Traffic Ops API's responses to the /profileparameters endpoint.

type ProfileParameter

type ProfileParameter struct {
	LastUpdated TimeNoMod `json:"lastUpdated"`
	Profile     string    `json:"profile"`
	ProfileID   int       `json:"profileId"`
	Parameter   string    `json:"parameter"`
	ParameterID int       `json:"parameterId"`
}

ProfileParameter is a representation of a relationship between a Parameter and a Profile to which it is assigned.

Note that not all unique identifiers for each represented object in this relationship structure are guaranteed to be populated by the Traffic Ops API.

type ProfileParameterByName

type ProfileParameterByName struct {
	ConfigFile  string    `json:"configFile"`
	ID          int       `json:"id"`
	LastUpdated TimeNoMod `json:"lastUpdated"`
	Name        string    `json:"name"`
	Secure      bool      `json:"secure"`
	Value       string    `json:"value"`
}

ProfileParameterByName is a structure that's used to represent a Parameter in a context where they are associated with some Profile specified by a client of the Traffic Ops API by its Name.

type ProfileParameterByNamePost

type ProfileParameterByNamePost struct {
	ConfigFile *string `json:"configFile"`
	Name       *string `json:"name"`
	Secure     *int    `json:"secure"`
	Value      *string `json:"value"`
}

ProfileParameterByNamePost is a structure that's only used internally to represent a Parameter that has been requested by a client of the Traffic Ops API to be associated with some Profile which was specified by Name.

TODO: This probably shouldn't exist, or at least not be in the lib.

func (*ProfileParameterByNamePost) Validate

func (p *ProfileParameterByNamePost) Validate(tx *sql.Tx) []error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type ProfileParameterCreationRequest

type ProfileParameterCreationRequest struct {
	ParameterID int `json:"parameterId"`
	ProfileID   int `json:"profileId"`
}

ProfileParameterCreationRequest is the type of data accepted by Traffic Ops as payloads in POST requests to its /profileparameters endpoint.

type ProfileParameterNullable

type ProfileParameterNullable struct {
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Profile     *string    `json:"profile" db:"profile"`
	ProfileID   *int       `json:"profileId" db:"profile_id"`
	Parameter   *string    `json:"parameter" db:"parameter"`
	ParameterID *int       `json:"parameterId" db:"parameter_id"`
}

ProfileParameterNullable is identical to ProfileParameter, except that its fields are reference values, which allows them to be nil.

type ProfileParameterPostResp

type ProfileParameterPostResp struct {
	Parameters  []ProfileParameterPostRespObj `json:"parameters"`
	ProfileID   int                           `json:"profileId"`
	ProfileName string                        `json:"profileName"`
}

ProfileParameterPostResp is the type of the `response` property of responses from Traffic Ops to POST requests made to its /profiles/name/{{Name}}/parameters API endpoint.

type ProfileParameterPostRespObj

type ProfileParameterPostRespObj struct {
	ProfileParameterByNamePost
	ID int64 `json:"id"`
}

ProfileParameterPostRespObj is a single Parameter in the Parameters slice of a ProfileParameterPostResp.

type ProfileParameterResponse

type ProfileParameterResponse struct {
	// in: body
	Response ProfileParameter `json:"response"`
	Alerts
}

ProfileParameterResponse is a single ProfileParameter response for Create to depict what changed. swagger:response ProfileParameterResponse in: body

type ProfileParametersAPIResponse

type ProfileParametersAPIResponse struct {
	Response []ProfileParam `json:"response"`
	Alerts
}

ProfileParametersAPIResponse is the type of a response from Traffic Ops to requests made to its /profileparameters endpoint.

type ProfileParametersByNamePost

type ProfileParametersByNamePost []ProfileParameterByNamePost

ProfileParametersByNamePost is the object posted to profile/name/parameter endpoints. This object may be posted as either a single JSON object, or an array of objects. Either will unmarshal into this object; a single object will unmarshal into an array of 1 element.

func (*ProfileParametersByNamePost) UnmarshalJSON

func (pp *ProfileParametersByNamePost) UnmarshalJSON(bts []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

func (*ProfileParametersByNamePost) Validate

func (pp *ProfileParametersByNamePost) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type ProfileParametersNullable

type ProfileParametersNullable struct {
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Profile     *string    `json:"profile" db:"profile"`
	Parameter   *int       `json:"parameter" db:"parameter_id"`
}

ProfileParametersNullable is an object of the form returned by the Traffic Ops /profileparameters endpoint.

type ProfileParametersNullableResponse

type ProfileParametersNullableResponse struct {
	Response []ProfileParametersNullable `json:"response"`
}

ProfileParametersNullableResponse is the structure of a response from Traffic Ops to GET requests made to its /profileparameters API endpoint.

TODO: This is only used internally in a v3 client method (not its call signature) - deprecate? Remove?

type ProfileParametersResponse

type ProfileParametersResponse struct {
	Response []ProfileParameter `json:"response"`
	Alerts
}

ProfileParametersResponse is the type of the response from Traffic Ops to GET requests made to its /profileparameters API endpoint.

type ProfileResponse

type ProfileResponse struct {
	// in: body
	Response Profile `json:"response"`
	Alerts
}

ProfileResponse is a single Profile Response for Update and Create to depict what changed swagger:response ProfileResponse in: body

type ProfilesResponse

type ProfilesResponse struct {
	Response []Profile `json:"response"`
	Alerts
}

ProfilesResponse is a list of profiles returned by GET requests.

type Protocol deprecated

type Protocol string

Protocol represents an ATC-supported content delivery protocol.

Deprecated: This does not accurately model the Protocol of a Delivery Service, use DSProtocolHTTP, DSProtocolHTTPS, DSProtocolHTTPToHTTPS, and DSProtocolHTTPAndHTTPS instead.

func ProtocolFromString

func ProtocolFromString(s string) Protocol

ProtocolFromString parses a string and returns the corresponding Protocol.

func (Protocol) MarshalJSON

func (p Protocol) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface.

func (Protocol) String

func (p Protocol) String() string

String implements the fmt.Stringer interface.

func (*Protocol) UnmarshalJSON

func (p *Protocol) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

type PutSnapshotResponse

type PutSnapshotResponse struct {
	Response *string `json:"response,omitempty"`
	Alerts
}

PutSnapshotResponse is the type of the response of Traffic Ops to requests for *making* CDN Snapshots.

type QStringIgnore

type QStringIgnore int

A QStringIgnore defines how to treat the URL query string for requests for a given Delivery Service's content.

This enum's String function returns the numeric representation, because it is a legacy database value, and the number should be kept for both database and API JSON uses. For the same reason, this enum has no FromString function.

One should normally use the QueryStringIgnoreUseInCacheKeyAndPassUp, QueryStringIgnoreIgnoreInCacheKeyAndPassUp, and QueryStringIgnoreDropAtEdge constants instead, as they have the same type as the Delivery Service field they represent.

const (
	QStringIgnoreUseInCacheKeyAndPassUp    QStringIgnore = 0
	QStringIgnoreIgnoreInCacheKeyAndPassUp QStringIgnore = 1
	QStringIgnoreDrop                      QStringIgnore = 2
)

These are the allowable values for a QStringIgnore.

func (QStringIgnore) String

func (e QStringIgnore) String() string

String returns the string number of the QStringIgnore value, implementing the fmt.Stringer interface.

Note this returns the number, not a human-readable value, because QStringIgnore is a legacy database sigil, and both database and API JSON uses should use the number. This also returns 'INVALID' for unknown values, to fail fast in the event of bad data.

type RefreshDNSSECKeysResponse

type RefreshDNSSECKeysResponse GenerateCDNDNSSECKeysResponse

RefreshDNSSECKeysResponse is the type of a response from Traffic Ops to requests made to its /cdns/dnsseckeys/refresh API endpoint.

type Region

type Region struct {
	DivisionName string    `json:"divisionName"`
	Division     int       `json:"division" db:"division"`
	ID           int       `json:"id" db:"id"`
	LastUpdated  TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name         string    `json:"name" db:"name"`
}

A Region is a named collection of Physical Locations within a Division.

type RegionName

type RegionName struct {
	ID       int                `json:"id"`
	Name     string             `json:"name"`
	Division RegionNameDivision `json:"division"`
}

RegionName is a response to a request to get a region by its name. It includes the division that the region is in.

type RegionNameDivision

type RegionNameDivision struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

RegionNameDivision is the division that contains the region that a request is trying to query by name.

type RegionNameResponse

type RegionNameResponse struct {
	Response []RegionName `json:"response"`
}

RegionNameResponse models the structure of a response to a request to get a region by its name.

type RegionsResponse

type RegionsResponse struct {
	Response []Region `json:"response"`
	Alerts
}

RegionsResponse is the type of responses from Traffic Ops to GET requests made to its /regions API endpoint.

type RequestStatus

type RequestStatus string

RequestStatus captures where in the workflow this request is.

func RequestStatusFromString

func RequestStatusFromString(rs string) (RequestStatus, error)

RequestStatusFromString gets the status enumeration from a string.

func (RequestStatus) MarshalJSON

func (r RequestStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaller.

func (*RequestStatus) Scan

func (r *RequestStatus) Scan(src interface{}) error

Scan implements sql.Scanner.

func (RequestStatus) String

func (r RequestStatus) String() string

String returns the string value of the Request Status.

func (*RequestStatus) UnmarshalJSON

func (r *RequestStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaller.

func (RequestStatus) ValidTransition

func (r RequestStatus) ValidTransition(to RequestStatus) error

ValidTransition returns nil if the transition is allowed for the workflow, an error if not.

func (*RequestStatus) Value

func (r *RequestStatus) Value() (driver.Value, error)

Value implements driver.Valuer.

type ResolverMapping

type ResolverMapping struct {
	Resolve4 []string `json:"resolve4,omitempty"`
	Resolve6 []string `json:"resolve6,omitempty"`
}

A ResolverMapping is a set of Resolvers, ostensibly for a Federation.

func (*ResolverMapping) Validate

func (r *ResolverMapping) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type ResultStatVal

type ResultStatVal struct {
	// Span is the number of polls this stat has been the same. For example,
	// if History is set to 100, and the last 50 polls had the same value for
	// this stat (but none of the previous 50 were the same), this stat's map
	// value slice will actually contain 51 entries, and the first entry will
	// have the value, the time of the last poll, and a Span of 50.
	// Assuming the poll time is every 8 seconds, users will then know, looking
	// at the Span, that the value was unchanged for the last 50*8=400 seconds.
	Span uint64 `json:"span"`
	// Time is the time this stat was returned.
	Time time.Time   `json:"time"`
	Val  interface{} `json:"value"`
}

ResultStatVal is the value of an individual stat returned from a poll. JSON values are all strings, for the TM1.0 /publish/CacheStats API.

func (*ResultStatVal) MarshalJSON

func (t *ResultStatVal) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface.

func (*ResultStatVal) UnmarshalJSON

func (t *ResultStatVal) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

type Role

type Role struct {
	RoleV11

	// Capabilities associated with the Role
	//
	// required: true
	Capabilities *[]string `json:"capabilities" db:"-"`
}

A Role is a definition of the permissions afforded to a user with that Role.

type RoleResponse

type RoleResponse struct {
	// in: body
	Response Role `json:"response"`
	Alerts
}

RoleResponse is a single Role response for Update and Create to depict what changed. swagger:response RoleResponse in: body

type RoleV11 deprecated

type RoleV11 struct {
	// ID of the Role
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// Name of the Role
	//
	// required: true
	Name *string `json:"name" db:"name"`

	// Description of the Role
	//
	// required: true
	Description *string `json:"description" db:"description"`

	// Priv Level of the Role
	//
	// required: true
	PrivLevel *int `json:"privLevel" db:"priv_level"`
}

RoleV11 is a representation of a Role as it appeared in version 1.1 of the Traffic Ops API.

Deprecated: Traffic Ops API version 1.1 no longer exists - the ONLY reason this structure still exists is because it is nested in newer structures - DO NOT USE THIS!

type RolesResponse

type RolesResponse struct {
	// in: body
	Response []Role `json:"response"`
	Alerts
}

RolesResponse is a list of Roles as a response. swagger:response RolesResponse in: body

type Routing

type Routing struct {
	StaticRoute       float64 `json:"staticRoute"`
	Geo               float64 `json:"geo"`
	Err               float64 `json:"err"`
	Fed               float64 `json:"fed"`
	CZ                float64 `json:"cz"`
	DeepCZ            float64 `json:"deepCz"`
	RegionalAlternate float64 `json:"regionalAlternate"`
	DSR               float64 `json:"dsr"`
	Miss              float64 `json:"miss"`
	RegionalDenied    float64 `json:"regionalDenied"`
}

Routing represents the aggregated routing percentages across CDNs or for a DS.

type SOA

type SOA struct {
	Admin              *string   `json:"admin,omitempty"`
	AdminTime          time.Time `json:"-"`
	ExpireSeconds      *string   `json:"expire,omitempty"`
	ExpireSecondsTime  time.Time `json:"-"`
	MinimumSeconds     *string   `json:"minimum,omitempty"`
	MinimumSecondsTime time.Time `json:"-"`
	RefreshSeconds     *string   `json:"refresh,omitempty"`
	RefreshSecondsTime time.Time `json:"-"`
	RetrySeconds       *string   `json:"retry,omitempty"`
	RetrySecondsTime   time.Time `json:"-"`
}

SOA (Start of Authority record) defines the SOA record for the CDN's top-level domain.

type SSLKeyRequestFields

type SSLKeyRequestFields struct {
	BusinessUnit *string `json:"businessUnit,omitempty"`
	City         *string `json:"city,omitempty"`
	Organization *string `json:"organization,omitempty"`
	HostName     *string `json:"hostname,omitempty"`
	Country      *string `json:"country,omitempty"`
	State        *string `json:"state,omitempty"`
	Version      *int    `json:"version,omitempty"`
}

SSLKeyRequestFields contain metadata information for generating SSL keys for Delivery Services through the Traffic Ops API. Specifically, they contain everything except the manner in which the generated certificates should be signed, information that can be extracted from the Delivery Service for which the request is being made, and any key/certificate pair being added rather than generated from this information.

type SSLKeysAddResponse

type SSLKeysAddResponse struct {
	Response string `json:"response"`
	Alerts
}

SSLKeysAddResponse is a struct to store the response of addition of ssl keys for a DS, along with any alert messages.

type Server deprecated

type Server struct {
	Cachegroup       string              `json:"cachegroup" db:"cachegroup"`
	CachegroupID     int                 `json:"cachegroupId" db:"cachegroup_id"`
	CDNID            int                 `json:"cdnId" db:"cdn_id"`
	CDNName          string              `json:"cdnName" db:"cdn_name"`
	DeliveryServices map[string][]string `json:"deliveryServices,omitempty"`
	DomainName       string              `json:"domainName" db:"domain_name"`
	FQDN             *string             `json:"fqdn,omitempty"`
	FqdnTime         time.Time           `json:"-"`
	GUID             string              `json:"guid" db:"guid"`
	HostName         string              `json:"hostName" db:"host_name"`
	HTTPSPort        int                 `json:"httpsPort" db:"https_port"`
	ID               int                 `json:"id" db:"id"`
	ILOIPAddress     string              `json:"iloIpAddress" db:"ilo_ip_address"`
	ILOIPGateway     string              `json:"iloIpGateway" db:"ilo_ip_gateway"`
	ILOIPNetmask     string              `json:"iloIpNetmask" db:"ilo_ip_netmask"`
	ILOPassword      string              `json:"iloPassword" db:"ilo_password"`
	ILOUsername      string              `json:"iloUsername" db:"ilo_username"`
	InterfaceMtu     int                 `json:"interfaceMtu" db:"interface_mtu"`
	InterfaceName    string              `json:"interfaceName" db:"interface_name"`
	IP6Address       string              `json:"ip6Address" db:"ip6_address"`
	IP6IsService     bool                `json:"ip6IsService" db:"ip6_address_is_service"`
	IP6Gateway       string              `json:"ip6Gateway" db:"ip6_gateway"`
	IPAddress        string              `json:"ipAddress" db:"ip_address"`
	IPIsService      bool                `json:"ipIsService" db:"ip_address_is_service"`
	IPGateway        string              `json:"ipGateway" db:"ip_gateway"`
	IPNetmask        string              `json:"ipNetmask" db:"ip_netmask"`
	LastUpdated      TimeNoMod           `json:"lastUpdated" db:"last_updated"`
	MgmtIPAddress    string              `json:"mgmtIpAddress" db:"mgmt_ip_address"`
	MgmtIPGateway    string              `json:"mgmtIpGateway" db:"mgmt_ip_gateway"`
	MgmtIPNetmask    string              `json:"mgmtIpNetmask" db:"mgmt_ip_netmask"`
	OfflineReason    string              `json:"offlineReason" db:"offline_reason"`
	PhysLocation     string              `json:"physLocation" db:"phys_location"`
	PhysLocationID   int                 `json:"physLocationId" db:"phys_location_id"`
	Profile          string              `json:"profile" db:"profile"`
	ProfileDesc      string              `json:"profileDesc" db:"profile_desc"`
	ProfileID        int                 `json:"profileId" db:"profile_id"`
	Rack             string              `json:"rack" db:"rack"`
	RevalPending     bool                `json:"revalPending" db:"reval_pending"`
	RouterHostName   string              `json:"routerHostName" db:"router_host_name"`
	RouterPortName   string              `json:"routerPortName" db:"router_port_name"`
	Status           string              `json:"status" db:"status"`
	StatusID         int                 `json:"statusId" db:"status_id"`
	TCPPort          int                 `json:"tcpPort" db:"tcp_port"`
	Type             string              `json:"type" db:"server_type"`
	TypeID           int                 `json:"typeId" db:"server_type_id"`
	UpdPending       bool                `json:"updPending" db:"upd_pending"`
	XMPPID           string              `json:"xmppId" db:"xmpp_id"`
	XMPPPasswd       string              `json:"xmppPasswd" db:"xmpp_passwd"`
}

Server is a non-"nullable" representation of a Server as it appeared in API version 2.0

Deprecated: Please use versioned and nullable structures from now on.

func (Server) ToNullable deprecated

func (s Server) ToNullable() ServerNullableV2

ToNullable converts the Server to an equivalent, "nullable" structure.

Note that "zero" values (e.g. the empty string "") are NOT coerced to actual null values. In particular, the only fields that will possibly be nil are FQDN - if the original server had a nil FQDN - and DeliveryServices - which will actually be a pointer to a nil map if the original server had a nil DeliveryServices map. Further note that this makes "shallow" copies of member properties; if reference types (map, slice, pointer etc.) are altered on the original after conversion, the changes WILL affect the nullable copy.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

type ServerCapabilitiesResponse

type ServerCapabilitiesResponse struct {
	Response []ServerCapability `json:"response"`
	Alerts
}

ServerCapabilitiesResponse contains the result data from a GET /server_capabilities request.

type ServerCapability

type ServerCapability struct {
	Name        string     `json:"name" db:"name"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
}

ServerCapability contains information about a given ServerCapability in Traffic Ops.

type ServerCapabilityDetailResponse

type ServerCapabilityDetailResponse struct {
	Response ServerCapability `json:"response"`
	Alerts
}

ServerCapabilityDetailResponse contains the result data from a POST /server_capabilities request.

type ServerCheckColumns

type ServerCheckColumns struct {
	// ID uniquely identifies a servercheck columns row.
	ID int `db:"id"`

	// Server is the ID of the server which is associated with these checks.
	Server int `db:"server"`

	AA *int `db:"aa"`
	AB *int `db:"ab"`
	AC *int `db:"ac"`
	AD *int `db:"ad"`
	AE *int `db:"ae"`
	AF *int `db:"af"`
	AG *int `db:"ag"`
	AH *int `db:"ah"`
	AI *int `db:"ai"`
	AJ *int `db:"aj"`
	AK *int `db:"ak"`
	AL *int `db:"al"`
	AM *int `db:"am"`
	AN *int `db:"an"`
	AO *int `db:"ao"`
	AP *int `db:"ap"`
	AQ *int `db:"aq"`
	AR *int `db:"ar"`
	AT *int `db:"at"`
	AU *int `db:"au"`
	AV *int `db:"av"`
	AW *int `db:"aw"`
	AX *int `db:"ax"`
	AY *int `db:"ay"`
	AZ *int `db:"az"`
	BA *int `db:"ba"`
	BB *int `db:"bb"`
	BC *int `db:"bc"`
	BD *int `db:"bd"`
	BE *int `db:"be"`
	BF *int `db:"bf"`
}

ServerCheckColumns is a collection of columns associated with a particular server's "checks". The meaning of the column names is unknown.

type ServerCheckExtensionID

type ServerCheckExtensionID struct {
	ID int `json:"id"`
}

A ServerCheckExtensionID contains an identified for a Servercheck Extension.

type ServerCheckExtensionNullable

type ServerCheckExtensionNullable struct {
	ID                    *int       `json:"id" db:"id"`
	Name                  *string    `json:"name" db:"name"`
	Version               *string    `json:"version" db:"version"`
	InfoURL               *string    `json:"info_url" db:"info_url"`
	ScriptFile            *string    `json:"script_file" db:"script_file"`
	IsActive              *int       `json:"isactive" db:"isactive"`
	AdditionConfigJSON    *string    `json:"additional_config_json" db:"additional_config_json"`
	Description           *string    `json:"description" db:"description"`
	ServercheckShortName  *string    `json:"servercheck_short_name" db:"servercheck_short_name"`
	ServercheckColumnName *string    `json:"-" db:"servercheck_column_name"`
	Type                  *string    `json:"type" db:"type_name"`
	TypeID                *int       `json:"-" db:"type"`
	LastUpdated           *TimeNoMod `json:"-" db:"last_updated"`
}

ServerCheckExtensionNullable represents a server check extension used by Traffic Ops.

func (*ServerCheckExtensionNullable) Validate

func (e *ServerCheckExtensionNullable) Validate(tx *sql.Tx) error

Validate ensures that the ServerCheckExtensionNullable request body is valid for creation.

type ServerCheckExtensionPostResponse

type ServerCheckExtensionPostResponse struct {
	Response ServerCheckExtensionID `json:"supplemental"`
	Alerts
}

ServerCheckExtensionPostResponse represents the response from Traffic Ops when creating ServerCheckExtension.

type ServerCheckExtensionResponse

type ServerCheckExtensionResponse struct {
	Response []ServerCheckExtensionNullable `json:"response"`
	Alerts
}

ServerCheckExtensionResponse represents the response from Traffic Ops when getting ServerCheckExtension.

type ServerDetail deprecated

type ServerDetail struct {
	CacheGroup         *string           `json:"cachegroup" db:"cachegroup"`
	CDNName            *string           `json:"cdnName" db:"cdn_name"`
	DeliveryServiceIDs []int64           `json:"deliveryservices,omitempty"`
	DomainName         *string           `json:"domainName" db:"domain_name"`
	GUID               *string           `json:"guid" db:"guid"`
	HardwareInfo       map[string]string `json:"hardwareInfo"`
	HostName           *string           `json:"hostName" db:"host_name"`
	HTTPSPort          *int              `json:"httpsPort" db:"https_port"`
	ID                 *int              `json:"id" db:"id"`
	ILOIPAddress       *string           `json:"iloIpAddress" db:"ilo_ip_address"`
	ILOIPGateway       *string           `json:"iloIpGateway" db:"ilo_ip_gateway"`
	ILOIPNetmask       *string           `json:"iloIpNetmask" db:"ilo_ip_netmask"`
	ILOPassword        *string           `json:"iloPassword" db:"ilo_password"`
	ILOUsername        *string           `json:"iloUsername" db:"ilo_username"`
	MgmtIPAddress      *string           `json:"mgmtIpAddress" db:"mgmt_ip_address"`
	MgmtIPGateway      *string           `json:"mgmtIpGateway" db:"mgmt_ip_gateway"`
	MgmtIPNetmask      *string           `json:"mgmtIpNetmask" db:"mgmt_ip_netmask"`
	OfflineReason      *string           `json:"offlineReason" db:"offline_reason"`
	PhysLocation       *string           `json:"physLocation" db:"phys_location"`
	Profile            *string           `json:"profile" db:"profile"`
	ProfileDesc        *string           `json:"profileDesc" db:"profile_desc"`
	Rack               *string           `json:"rack" db:"rack"`
	Status             *string           `json:"status" db:"status"`
	TCPPort            *int              `json:"tcpPort" db:"tcp_port"`
	Type               string            `json:"type" db:"server_type"`
	XMPPID             *string           `json:"xmppId" db:"xmpp_id"`
	XMPPPasswd         *string           `json:"xmppPasswd" db:"xmpp_passwd"`
}

ServerDetail is a type that contains a superset of the information available in a ServerNullable.

This should NOT be used in general, it's almost always better to use a proper server representation. However, this structure is not deprecated because it is embedded in structures still in use, and its future is unclear and undecided.

Deprecated: The API versions that use this representation have been deprecated, newer structures like ServerV4 should be used instead.

type ServerDetailV11

type ServerDetailV11 struct {
	ServerDetail
	LegacyInterfaceDetails
	RouterHostName *string `json:"routerHostName" db:"router_host_name"`
	RouterPortName *string `json:"routerPortName" db:"router_port_name"`
}

ServerDetailV11 is the type of each entry in the `response` array property of responses from Traffic Ops to GET requests made to its /servers/details API endpoint in API version 2.0.

The reason it's named with "V11" is because it was originally used to model the response in API version 1.1, and the structure simply hasn't changed between then and 2.0.

type ServerDetailV30

type ServerDetailV30 struct {
	ServerDetail
	ServerInterfaces *[]ServerInterfaceInfo `json:"interfaces"`
	RouterHostName   *string                `json:"routerHostName" db:"router_host_name"`
	RouterPortName   *string                `json:"routerPortName" db:"router_port_name"`
}

ServerDetailV30 is the details for a server for API v3.

type ServerDetailV40

type ServerDetailV40 struct {
	ServerDetail
	ServerInterfaces []ServerInterfaceInfoV40 `json:"interfaces"`
}

ServerDetailV40 is the details for a server for API v4.

type ServerIPAddress

type ServerIPAddress struct {
	Address        string  `json:"address" db:"address"`
	Gateway        *string `json:"gateway" db:"gateway"`
	ServiceAddress bool    `json:"serviceAddress" db:"service_address"`
}

ServerIPAddress is the data associated with a server's interface's IP address.

type ServerInfo

type ServerInfo struct {
	Cachegroup   string
	CachegroupID int
	CDNID        int
	DomainName   string
	HostName     string
	ID           int
	Status       string
	Type         string
}

ServerInfo is a stripped-down type containing a subset of information for a server.

This is primarily only useful internally in Traffic Ops for constructing/examining the relationships between servers and other ATC objects. That is to say, for most other purposes a ServerV4 would be better suited.

type ServerInterfaceInfo

type ServerInterfaceInfo struct {
	IPAddresses  []ServerIPAddress `json:"ipAddresses" db:"ip_addresses"`
	MaxBandwidth *uint64           `json:"maxBandwidth" db:"max_bandwidth"`
	Monitor      bool              `json:"monitor" db:"monitor"`
	MTU          *uint64           `json:"mtu" db:"mtu"`
	Name         string            `json:"name" db:"name"`
}

ServerInterfaceInfo is the data associated with a server's interface.

func GetVIPInterface

func GetVIPInterface(ts TrafficServer) ServerInterfaceInfo

GetVIPInterface returns the primary interface specified by the `Monitor` property of an Interface. First interface marked as `Monitor` is returned.

func V4InterfaceInfoToV3Interfaces

func V4InterfaceInfoToV3Interfaces(serverInterfaces []ServerInterfaceInfoV40) ([]ServerInterfaceInfo, error)

V4InterfaceInfoToV3Interfaces downgrades a set of ServerInterfaceInfoV40s to ServerInterfaceInfos.

func (*ServerInterfaceInfo) GetDefaultAddress

func (i *ServerInterfaceInfo) GetDefaultAddress() (string, string)

GetDefaultAddress returns the IPv4 and IPv6 service addresses of the interface.

func (*ServerInterfaceInfo) Scan

func (sii *ServerInterfaceInfo) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

This expects src to be a json.RawMessage and unmarshals it into the ServerInterfaceInfo.

func (*ServerInterfaceInfo) Value

func (sii *ServerInterfaceInfo) Value() (driver.Value, error)

Value implements the driver.Valuer interface marshals struct to json to pass back as a json.RawMessage.

type ServerInterfaceInfoV40

type ServerInterfaceInfoV40 struct {
	ServerInterfaceInfo
	RouterHostName string `json:"routerHostName" db:"router_host_name"`
	RouterPortName string `json:"routerPortName" db:"router_port_name"`
}

ServerInterfaceInfoV40 is the data associated with a V40 server's interface.

func ToInterfacesV4

func ToInterfacesV4(oldInterfaces []ServerInterfaceInfo, routerName, routerPort *string) ([]ServerInterfaceInfoV40, error)

ToInterfacesV4 upgrades server interfaces from their APIv3 representation to an APIv4 representation.

The passed routerName and routerPort can be nil, which will leave the upgradeded interfaces' RouterHostName and RouterPortName unset, or they can be pointers to string values to which ALL of the interfaces will have their RouterHostName and RouterPortName set.

type ServerNullable deprecated

type ServerNullable ServerV30

ServerNullable represents an ATC server, as returned by the TO API.

Deprecated: Traffic Ops API version 3 is deprecated, new code should use ServerV40 or newer structures.

func (*ServerNullable) ToServerV2

func (s *ServerNullable) ToServerV2() (ServerNullableV2, error)

ToServerV2 converts the server to an equivalent ServerNullableV2 structure, if possible. If the conversion could not be performed, an error is returned.

type ServerNullableV11

type ServerNullableV11 struct {
	LegacyInterfaceDetails
	CommonServerProperties
	RouterHostName *string `json:"routerHostName" db:"router_host_name"`
	RouterPortName *string `json:"routerPortName" db:"router_port_name"`
}

ServerNullableV11 is a server as it appeared in API version 1.1.

type ServerNullableV2 deprecated

type ServerNullableV2 struct {
	ServerNullableV11
	IPIsService  *bool `json:"ipIsService" db:"ip_address_is_service"`
	IP6IsService *bool `json:"ip6IsService" db:"ip6_address_is_service"`
}

ServerNullableV2 is a server as it appeared in API v2.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

func (ServerNullableV2) ToNonNullable deprecated

func (s ServerNullableV2) ToNonNullable() Server

ToNonNullable converts the ServerNullableV2 safely to a Server structure.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

func (ServerNullableV2) Upgrade deprecated

func (s ServerNullableV2) Upgrade() (ServerV30, error)

Upgrade upgrades the ServerNullableV2 to the new ServerNullable structure.

Note that this makes "shallow" copies of all underlying data, so changes to the original will affect the upgraded copy.

Deprecated: Traffic Ops API versions 2 and 3 are both deprecated, new code should use ServerV40 or newer structures.

func (ServerNullableV2) UpgradeToV40 deprecated

func (s ServerNullableV2) UpgradeToV40() (ServerV40, error)

UpgradeToV40 upgrades the ServerNullableV2 to a ServerV40.

This makes a "shallow" copy of the structure's properties.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

type ServerPutStatus

type ServerPutStatus struct {
	Status        util.JSONNameOrIDStr `json:"status"`
	OfflineReason *string              `json:"offlineReason"`
}

ServerPutStatus is a request to change the Status of a server, optionally with an explanation.

type ServerQueueUpdate

type ServerQueueUpdate struct {
	ServerID util.JSONIntStr `json:"serverId"`
	Action   string          `json:"action"`
}

ServerQueueUpdate decodes the update data from the POST servers/{{ID}}/queue_update endpoint.

type ServerQueueUpdateRequest

type ServerQueueUpdateRequest struct {
	Action string `json:"action"`
}

ServerQueueUpdateRequest encodes the request data for the POST servers/{{ID}}/queue_update endpoint.

type ServerQueueUpdateResponse

type ServerQueueUpdateResponse struct {
	Response ServerQueueUpdate `json:"response"`
	Alerts
}

ServerQueueUpdateResponse decodes the full response with alerts from the POST servers/{{ID}}/queue_update endpoint.

type ServerServerCapabilitiesResponse

type ServerServerCapabilitiesResponse struct {
	Response []ServerServerCapability `json:"response"`
	Alerts
}

ServerServerCapabilitiesResponse is the type of a response from Traffic Ops to a request made to its /server_server_capabilities.

type ServerServerCapability

type ServerServerCapability struct {
	LastUpdated      *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Server           *string    `json:"serverHostName,omitempty" db:"host_name"`
	ServerID         *int       `json:"serverId" db:"server"`
	ServerCapability *string    `json:"serverCapability" db:"server_capability"`
}

ServerServerCapability represents an association between a server capability and a server.

type ServerStats

type ServerStats struct {
	// Interfaces contains statistics specific to each monitored interface
	// of the cache server.
	Interfaces map[string]map[string][]ResultStatVal `json:"interfaces"`
	// Stats contains statistics regarding the cache server in general.
	Stats map[string][]ResultStatVal `json:"stats"`
}

ServerStats is a representation of cache server statistics as present in the TM API.

type ServerUpdateStatus

type ServerUpdateStatus struct {
	HostName           string `json:"host_name"`
	UpdatePending      bool   `json:"upd_pending"`
	RevalPending       bool   `json:"reval_pending"`
	UseRevalPending    bool   `json:"use_reval_pending"`
	HostId             int    `json:"host_id"`
	Status             string `json:"status"`
	ParentPending      bool   `json:"parent_pending"`
	ParentRevalPending bool   `json:"parent_reval_pending"`
}

ServerUpdateStatus is the type of each entry in the `response` property of the response from Traffic Ops to GET requests made to its /servers/{{host name}}/update_status API endpoint.

This is a subset of Server structure information mainly relating to what operations t3c has done/needs to do. For most purposes, using Server structures will be better - especially since the basic principle of this type is predicated on a lie: that server host names are unique.

type ServerUpdateStatusResponseV4

type ServerUpdateStatusResponseV4 = ServerUpdateStatusResponseV40

ServerUpdateStatusResponseV4 is the type of a response from the Traffic Ops API to a request to its /servers/{{host name}}/update_status endpoint in the latest minor version of API version 4.

type ServerUpdateStatusResponseV40

type ServerUpdateStatusResponseV40 struct {
	Response []ServerUpdateStatus `json:"response"`
	Alerts
}

ServerUpdateStatusResponseV40 is the type of a response from the Traffic Ops API to a request to its /servers/{{host name}}/update_status endpoint in API version 4.0.

type ServerV30

type ServerV30 struct {
	CommonServerProperties
	RouterHostName    *string               `json:"routerHostName" db:"router_host_name"`
	RouterPortName    *string               `json:"routerPortName" db:"router_port_name"`
	Interfaces        []ServerInterfaceInfo `json:"interfaces" db:"interfaces"`
	StatusLastUpdated *time.Time            `json:"statusLastUpdated" db:"status_last_updated"`
}

ServerV30 is the representation of a Server in version 3 of the Traffic Ops API.

func (*ServerV30) ToServerV2 deprecated

func (s *ServerV30) ToServerV2() (ServerNullableV2, error)

ToServerV2 converts the server to an equivalent ServerNullableV2 structure, if possible. If the conversion could not be performed, an error is returned.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

func (ServerV30) UpgradeToV40 deprecated

func (s ServerV30) UpgradeToV40() (ServerV40, error)

UpgradeToV40 upgrades the ServerV30 to a ServerV40.

This makes a "shallow" copy of the structure's properties.

Deprecated: Traffic Ops API version 3 is deprecated, new code should use ServerV40 or newer structures.

type ServerV4

type ServerV4 = ServerV40

ServerV4 is the representation of a Server in the latest minor version of version 4 of the Traffic Ops API.

type ServerV40

type ServerV40 struct {
	CommonServerProperties
	Interfaces        []ServerInterfaceInfoV40 `json:"interfaces" db:"interfaces"`
	StatusLastUpdated *time.Time               `json:"statusLastUpdated" db:"status_last_updated"`
}

ServerV40 is the representation of a Server in version 4.0 of the Traffic Ops API.

func (*ServerV40) ToServerV2FromV4 deprecated

func (s *ServerV40) ToServerV2FromV4() (ServerNullableV2, error)

ToServerV2FromV4 downgrades the ServerV40 to a ServerNullableV2.

This makes a "shallow" copy of most of the structure's properties.

Deprecated: Traffic Ops API version 2 is deprecated, new code should use ServerV40 or newer structures.

func (*ServerV40) ToServerV3FromV4 deprecated

func (s *ServerV40) ToServerV3FromV4() (ServerV30, error)

ToServerV3FromV4 downgrades the ServerV40 to a ServerV30.

This makes a "shallow" copy of most of the structure's properties.

Deprecated: Traffic Ops API version 3 is deprecated, new code should use ServerV40 or newer structures.

type Servercheck

type Servercheck struct {
	CommonCheckFields

	// Various check types
	Checks struct {

		// IPv4 production interface (legacy name)
		Iface10G int `json:"10G"`

		// IPv6 production interface (legacy name)
		Iface10G6 int `json:"10G6"`

		// Cache Disk Usage
		CDU int `json:"CDU"`

		// Cache Hit Ratio
		CHR int `json:"CHR"`

		// DSCP check
		DSCP int `json:"DSCP"`

		// DNS check
		FQDN int `json:"FQDN"`

		// Out-of-band (BMC) interface check
		ILO int `json:"ILO"`

		// IPv4 production interface (new name)
		IPv4 int `json:"IPv4"`

		// IPv6 production interface (new name)
		IPv6 int `json:"IPv6"`

		// MTU check
		MTU int `json:"MTU"`

		// ORT check
		ORT int `json:"ORT"`

		// Traffic Router status for checked server
		RTR int `json:"RTR"`
	} `json:"checks"`
}

Servercheck is a single Servercheck struct for GET response. swagger:model Servercheck

type ServercheckAPIResponse

type ServercheckAPIResponse struct {
	Response []GenericServerCheck `json:"response"`
	Alerts
}

ServercheckAPIResponse (not to be confused with ServerchecksResponse) is the type of a response from Traffic Ops to a request to its /servercheck endpoint (not to be confused with its /servers/checks endpoint).

type ServercheckPost

type ServercheckPost struct {

	// The Servercheck data to submit
	//
	// Name of the server check type
	//
	// required: true
	Name string `json:"servercheck_short_name"`

	// ID of the server
	//
	ID int `json:"id"`

	// Name of the server
	HostName string `json:"name" `

	// Value of the check result
	//
	// required: true
	Value int `json:"value"`
}

ServercheckPost is a single Servercheck struct for Update and Create to depict what changed.

type ServercheckPostResponse

type ServercheckPostResponse struct {
	Alerts []Alert `json:"alerts"`
}

ServercheckPostResponse is the response to a Servercheck POST request.

type ServercheckRequestNullable

type ServercheckRequestNullable struct {
	Name     *string `json:"servercheck_short_name"`
	ID       *int    `json:"id"`
	Value    *int    `json:"value"`
	HostName *string `json:"host_name"`
}

ServercheckRequestNullable is a single nullable Servercheck struct for Update and Create to depict what changed.

func (ServercheckRequestNullable) Validate

func (scp ServercheckRequestNullable) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidate interface.

type ServerchecksResponse

type ServerchecksResponse struct {
	// in: body
	Response []Servercheck `json:"response"`
	Alerts
}

ServerchecksResponse is a list of Serverchecks as a response. swagger:response ServerchecksResponse in: body

type ServersDetailResponse

type ServersDetailResponse struct {
	Response Server `json:"response"`
	Alerts
}

ServersDetailResponse is the JSON object returned for a single server.

type ServersResponse

type ServersResponse struct {
	Response []Server `json:"response"`
	Alerts
}

ServersResponse is a list of Servers as a response to an API v2 request. This can't change because it will break ORT. Unfortunately.

type ServersV1DetailResponse

type ServersV1DetailResponse struct {
	Response []ServerDetailV11 `json:"response"`
	Alerts
}

ServersV1DetailResponse is the JSON object returned for a single server for v1.

type ServersV3DetailResponse

type ServersV3DetailResponse struct {
	Response []ServerDetailV30 `json:"response"`
	Alerts
}

ServersV3DetailResponse is the JSON object returned for a single server for v3.

type ServersV3Response

type ServersV3Response struct {
	Response []ServerV30 `json:"response"`
	Summary  struct {
		Count uint64 `json:"count"`
	} `json:"summary"`
	Alerts
}

ServersV3Response is the format of a response to a GET request for /servers.

type ServersV4DetailResponse

type ServersV4DetailResponse struct {
	Response []ServerDetailV40 `json:"response"`
	Alerts
}

ServersV4DetailResponse is the JSON object returned for a single server for v4.

type ServersV4Response

type ServersV4Response struct {
	Response []ServerV40 `json:"response"`
	Summary  struct {
		Count uint64 `json:"count"`
	} `json:"summary"`
	Alerts
}

ServersV4Response is the format of a response to a GET request for API v4.x /servers.

type ServiceCategoriesResponse

type ServiceCategoriesResponse struct {
	Response []ServiceCategory `json:"response"`
	Alerts
}

ServiceCategoriesResponse is a list of Service Categories as a response.

type ServiceCategory

type ServiceCategory struct {
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        string    `json:"name" db:"name"`
}

ServiceCategory holds the name, id and associated tenant that comprise a service category.

type ServiceCategoryResponse

type ServiceCategoryResponse struct {
	Response ServiceCategory `json:"response"`
	Alerts
}

ServiceCategoryResponse is a single Service Category response for Update and Create to depict what changed.

type SnapshotResponse

type SnapshotResponse struct {
	Response CRConfig `json:"response"`
	Alerts
}

SnapshotResponse is the type of the response of Traffic Ops to requests for CDN Snapshots.

type StaticDNS

type StaticDNS struct {
	Value string `json:"value"`
	TTL   int    `json:"ttl"`
	Name  string `json:"name"`
	Type  string `json:"type"`
}

A StaticDNS is a somewhat arbitrary static DNS entry of some kind.

type StaticDNSEntriesResponse

type StaticDNSEntriesResponse struct {
	Response []StaticDNSEntry `json:"response"`
	Alerts
}

StaticDNSEntriesResponse is a list of StaticDNSEntry as a response.

type StaticDNSEntry

type StaticDNSEntry struct {

	// The static IP Address or fqdn of the static dns entry
	//
	// required: true
	Address string `json:"address" db:"address"`

	// The Cachegroup Name associated
	//
	CacheGroupName string `json:"cachegroup" db:"cachegroup"`

	// The Cachegroup ID associated
	//
	CacheGroupID int `json:"cachegroupId" db:"cachegroup_id"`

	// The DeliveryService associated
	//
	DeliveryService string `json:"deliveryservice" db:"dsname"`

	// The DeliveryService associated
	//
	// required: true
	DeliveryServiceID int `json:"deliveryserviceId" db:"deliveryservice_id"`

	// The host of the static dns entry
	//
	// required: true
	Host string `json:"host" db:"host"`

	// ID of the StaticDNSEntry
	//
	// required: true
	ID int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// The Time To Live for the static dns entry
	//
	// required: true
	TTL int64 `json:"ttl" db:"ttl"`

	// The type of the static DNS entry
	//
	// enum: ["A_RECORD", "AAAA_RECORD", "CNAME_RECORD"]
	Type string `json:"type"`

	// The type id of the static DNS entry
	//
	// required: true
	TypeID int `json:"typeId" db:"type_id"`
}

StaticDNSEntry holds information about a static DNS entry.

type StaticDNSEntryNullable

type StaticDNSEntryNullable struct {

	// The static IP Address or fqdn of the static dns entry
	//
	// required: true
	Address *string `json:"address" db:"address"`

	// The Cachegroup Name associated
	//
	CacheGroupName *string `json:"cachegroup" db:"cachegroup"`

	// The Cachegroup ID associated
	//
	CacheGroupID *int `json:"cachegroupId" db:"cachegroup_id"`

	// The DeliveryService Name associated
	//
	DeliveryService *string `json:"deliveryservice" db:"dsname"`

	// DeliveryService ID of the StaticDNSEntry
	//
	// required: true
	DeliveryServiceID *int `json:"deliveryserviceId" db:"deliveryservice_id"`

	// The host of the static dns entry
	//
	// required: true
	Host *string `json:"host" db:"host"`

	// ID of the StaticDNSEntry
	//
	// required: true
	ID *int `json:"id" db:"id"`

	// LastUpdated
	//
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// The Time To Live for the static dns entry
	//
	// required: true
	TTL *int64 `json:"ttl" db:"ttl"`

	// The type of the static DNS entry
	//
	// enum: ["A_RECORD", "AAAA_RECORD", "CNAME_RECORD"]
	Type *string `json:"type"`

	// The type id of the static DNS entry
	//
	// required: true
	TypeID int `json:"typeId" db:"type_id"`
}

StaticDNSEntryNullable holds information about a static DNS entry. Its fields are nullable.

type Stats

type Stats struct {
	CommonAPIData
	// Caches is a map of cache server hostnames to groupings of statistics
	// regarding each cache server and all of its separate network interfaces.
	Caches map[string]ServerStats `json:"caches"`
}

Stats is designed for returning via the API. It contains result history for each cache, as well as common API data.

func (*Stats) ToLegacy deprecated

func (s *Stats) ToLegacy(monitorConfig TrafficMonitorConfigMap) ([]string, LegacyStats)

ToLegacy converts a Stats to a LegacyStats.

This returns a list of descriptions of which - if any - cache servers were skipped in the conversion and why, as well as the converted LegacyStats.

This creates a "shallow" copy of most properties of the Stats.

Deprecated: LegacyStats is deprecated. New code should just use Stats instead.

type StatsSummary

type StatsSummary struct {
	CDNName         *string `json:"cdnName"  db:"cdn_name"`
	DeliveryService *string `json:"deliveryServiceName"  db:"deliveryservice_name"`
	// The name of the stat, which can be whatever the TO API client wants.
	StatName *string `json:"statName"  db:"stat_name"`
	// The value of the stat - this cannot actually be nil in a valid
	// StatsSummary.
	StatValue   *float64   `json:"statValue"  db:"stat_value"`
	SummaryTime time.Time  `json:"summaryTime"  db:"summary_time"`
	StatDate    *time.Time `json:"statDate"  db:"stat_date"`
}

StatsSummary is a summary of some kind of statistic for a CDN and/or Delivery Service.

func (StatsSummary) MarshalJSON

func (ss StatsSummary) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface with a customized encoding to force the date format on StatDate.

func (*StatsSummary) UnmarshalJSON

func (ss *StatsSummary) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface with a customized decoding to force the date format on StatDate.

func (StatsSummary) Validate

func (ss StatsSummary) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type StatsSummaryLastUpdated

type StatsSummaryLastUpdated struct {
	SummaryTime *time.Time `json:"summaryTime"  db:"summary_time"`
}

StatsSummaryLastUpdated is the type of the `response` property of a response from Traffic Ops to a GET request made to its /stats_summary endpoint when the 'lastSummaryDate' query string parameter is passed as 'true'.

func (StatsSummaryLastUpdated) MarshalJSON

func (ss StatsSummaryLastUpdated) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface with a customized encoding to force the date format on SummaryTime.

func (*StatsSummaryLastUpdated) UnmarshalJSON

func (ss *StatsSummaryLastUpdated) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface with a customized decoding to force the SummaryTime format.

type StatsSummaryLastUpdatedAPIResponse

type StatsSummaryLastUpdatedAPIResponse struct {
	Response StatsSummaryLastUpdated `json:"response"`
	Alerts
}

StatsSummaryLastUpdatedAPIResponse is the type of a response from Traffic Ops to a request to its /stats_summary endpoint with the 'lastSummaryDate' query string parameter set to 'true'.

type StatsSummaryLastUpdatedResponse deprecated

type StatsSummaryLastUpdatedResponse struct {
	// This field has unknown purpose and meaning - do not depend on its value
	// for anything.
	Version  string                  `json:"version"`
	Response StatsSummaryLastUpdated `json:"response"`
}

StatsSummaryLastUpdatedResponse is the type of a response from Traffic Ops to a GET request made to its /stats_summary endpoint when the 'lastSummaryDate' query string parameter is passed as 'true'.

Deprecated: This structure includes an unknown field and drops Alerts returned by the API - use StatsSummaryLastUpdatedAPIResponse instead.

type StatsSummaryResponse

type StatsSummaryResponse struct {
	Response []StatsSummary `json:"response"`
	Alerts
}

StatsSummaryResponse is the structure of a response from Traffic Ops to GET requests made to its /stats_summary API endpoint.

type Status

type Status struct {

	// The Statuses to retrieve
	//
	// description of the status type
	//
	Description string `json:"description" db:"description"`

	// ID of the Status
	//
	// required: true
	ID int `json:"id" db:"id"`

	// The Time / Date this server entry was last updated
	//
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`

	// enum: ["OFFLINE", "ONLINE", "ADMIN_DOWN", "REPORTED", "CCR_IGNORE", "PRE_PROD"]
	Name string `json:"name" db:"name"`
}

Status is a single Status response for Update and Create to depict what changed. swagger:model Statuses

type StatusChangeRequest

type StatusChangeRequest struct {
	// Status is the desired new status of the DSR.
	Status RequestStatus `json:"status"`
}

StatusChangeRequest is the form of a PUT request body to /deliveryservice_requests/{{ID}}/status.

func (*StatusChangeRequest) Validate

func (*StatusChangeRequest) Validate(*sql.Tx) error

Validate satisfies the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type StatusNullable

type StatusNullable struct {
	Description *string    `json:"description"`
	ID          *int       `json:"id" db:"id"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        *string    `json:"name" db:"name"`
}

StatusNullable is a nullable single Status response for Update and Create to depict what changed.

type StatusResponse

type StatusResponse struct {
	// in: body
	Response Status `json:"response"`
	Alerts
}

StatusResponse is a single Status response for Update and Create to depict what changed. swagger:response StatusResponse in: body

type StatusesResponse

type StatusesResponse struct {
	// in: body
	Response []Status `json:"response"`
	Alerts
}

StatusesResponse is a list of Statuses as a response that depicts the state of a server. swagger:response StatusesResponse

type Steering

type Steering struct {
	DeliveryService DeliveryServiceName      `json:"deliveryService"`
	ClientSteering  bool                     `json:"clientSteering"`
	Targets         []SteeringSteeringTarget `json:"targets"`
	Filters         []SteeringFilter         `json:"filters"`
}

Steering holds information about a steering delivery service.

type SteeringFilter

type SteeringFilter struct {
	DeliveryService DeliveryServiceName `json:"deliveryService"`
	Pattern         string              `json:"pattern"`
}

SteeringFilter is a filter for a target delivery service.

type SteeringResponse

type SteeringResponse struct {
	Response []Steering `json:"response"`
	Alerts
}

SteeringResponse is the type of a response from Traffic Ops to a request to its /steering endpoint.

type SteeringSteeringTarget

type SteeringSteeringTarget struct {
	Order           int32               `json:"order"`
	Weight          int32               `json:"weight"`
	DeliveryService DeliveryServiceName `json:"deliveryService"`
	GeoOrder        *int                `json:"geoOrder,omitempty"`
	Longitude       *float64            `json:"longitude,omitempty"`
	Latitude        *float64            `json:"latitude,omitempty"`
}

SteeringSteeringTarget is a target delivery service of a steering delivery service.

type SteeringTarget deprecated

type SteeringTarget struct {
	DeliveryService   DeliveryServiceName `json:"deliveryService" db:"deliveryservice_name"`
	DeliveryServiceID int                 `json:"deliveryServiceId" db:"deliveryservice"`
	Target            DeliveryServiceName `json:"target" db:"target_name"`
	TargetID          int                 `json:"targetId" db:"target"`
	Type              string              `json:"type" db:"type"`      // TODO enum?
	TypeID            int                 `json:"typeId" db:"type_id"` // TODO enum?
	Value             util.JSONIntStr     `json:"value" db:"value"`
}

A SteeringTarget is a relationship between a Steering Delivery Service and another Delivery Service which is one of its Targets.

Deprecated: As far as this author is aware, this structure has never served any purpose. Modelling the Steering Target/Delivery Service relationship is better accomplished by the SteeringTargetNullable type.

type SteeringTargetNullable

type SteeringTargetNullable struct {
	DeliveryService   *DeliveryServiceName `json:"deliveryService" db:"deliveryservice_name"`
	DeliveryServiceID *uint64              `json:"deliveryServiceId" db:"deliveryservice"`
	Target            *DeliveryServiceName `json:"target" db:"target_name"`
	TargetID          *uint64              `json:"targetId" db:"target"`
	Type              *string              `json:"type" db:"type_name"` // TODO enum?
	TypeID            *int                 `json:"typeId" db:"type_id"` // TODO enum?
	Value             *util.JSONIntStr     `json:"value" db:"value"`
}

A SteeringTargetNullable is a relationship between a Steering Delivery Service and another Delivery Service which is one of its Targets.

func (SteeringTargetNullable) Validate

func (st SteeringTargetNullable) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type SteeringTargetsResponse

type SteeringTargetsResponse struct {
	Response []SteeringTargetNullable `json:"response"`
	Alerts
}

SteeringTargetsResponse is the type of a response from Traffic Ops to its /steering/{{ID}}/targets endpoint.

type SteeringType

type SteeringType string

A SteeringType is the Name of the Type of a Steering Target.

const (
	SteeringTypeOrder     SteeringType = "STEERING_ORDER"
	SteeringTypeWeight    SteeringType = "STEERING_WEIGHT"
	SteeringTypeGeoOrder  SteeringType = "STEERING_GEO_ORDER"
	SteeringTypeGeoWeight SteeringType = "STEERING_GEO_WEIGHT"
	SteeringTypeInvalid   SteeringType = ""
)

These are the allowable values of a SteeringType.

Note that, in general, there is no guarantee that a Type by any of these Names exists in Traffic Ops at any given time, nor that any such Types - should they exist - will have any particular UseInTable value, nor that the Types assigned to Steering Target relationships will be representable by these values.

func SteeringTypeFromString

func SteeringTypeFromString(s string) SteeringType

SteeringTypeFromString parses a string to return the corresponding SteeringType.

Warning: This is cAsE-iNsEnSiTiVe, but some components of Traffic Ops may compare the Names of Steering Target Types in case-sensitive ways, so this may obscure values that will be later detected as invalid, depending on how it's used.

func (SteeringType) String

func (t SteeringType) String() string

String returns a string representation of this SteeringType, implementing the fmt.Stringer interface.

type SystemInfo

type SystemInfo struct {
	ParametersNullable map[string]string `json:"parameters"`
}

SystemInfo can hold arbitrary system information (e.g., as a Traffic Ops API response).

type TMCacheGroup

type TMCacheGroup struct {
	Name        string                `json:"name"`
	Coordinates MonitoringCoordinates `json:"coordinates"`
}

TMCacheGroup contains all of the information about a Cache Group necessary for Traffic Monitor to do its job of monitoring health and statistics.

type TMConfigResponse

type TMConfigResponse struct {
	Response TrafficMonitorConfig `json:"response"`
	Alerts
}

TMConfigResponse is the response to requests made to the cdns/{{Name}}/configs/monitoring endpoint of the Traffic Ops API.

type TMDeliveryService

type TMDeliveryService struct {
	XMLID              string `json:"xmlId"`
	TotalTPSThreshold  int64  `json:"TotalTpsThreshold"`
	ServerStatus       string `json:"status"`
	TotalKbpsThreshold int64  `json:"TotalKbpsThreshold"`
}

TMDeliveryService is all of the information about a Delivery Service necessary for Traffic Monitor to do its job of monitoring health and statistics.

type TMParameters

type TMParameters struct {
	HealthConnectionTimeout int    `json:"health.connection.timeout"`
	HealthPollingURL        string `json:"health.polling.url"`
	HealthPollingFormat     string `json:"health.polling.format"`
	HealthPollingType       string `json:"health.polling.type"`
	HistoryCount            int    `json:"history.count"`
	MinFreeKbps             int64
	// HealthThresholdJSONParameters contains the Parameters contained in the
	// Thresholds field, formatted as individual string Parameters, rather than as
	// a JSON object.
	Thresholds map[string]HealthThreshold `json:"health_threshold,omitempty"`
	HealthThresholdJSONParameters
}

TMParameters is a structure containing all of the Parameters with special meaning to Traffic Monitor.

For specifics regarding each Parameter, refer to the official documentation.

TODO change TO to return this struct, so a custom UnmarshalJSON isn't necessary.

func (*TMParameters) UnmarshalJSON

func (params *TMParameters) UnmarshalJSON(bytes []byte) (err error)

UnmarshalJSON implements the encoding/json.Unmarshaler interface.

Example
const data = `{
		"health.connection.timeout": 5,
		"health.polling.url": "https://example.com/",
		"health.polling.format": "stats_over_http",
		"history.count": 1,
		"health.threshold.bandwidth": ">50",
		"health.threshold.foo": "<=500"
	}`

var params TMParameters
if err := json.Unmarshal([]byte(data), &params); err != nil {
	fmt.Printf("Failed to unmarshal: %v\n", err)
	return
}
fmt.Printf("timeout: %d\n", params.HealthConnectionTimeout)
fmt.Printf("url: %s\n", params.HealthPollingURL)
fmt.Printf("format: %s\n", params.HealthPollingFormat)
fmt.Printf("history: %d\n", params.HistoryCount)
fmt.Printf("# of Thresholds: %d - foo: %s, bandwidth: %s\n", len(params.Thresholds), params.Thresholds["foo"], params.Thresholds["bandwidth"])
Output:

timeout: 5
url: https://example.com/
format: stats_over_http
history: 1
# of Thresholds: 2 - foo: <=500.000000, bandwidth: >50.000000

type TMProfile

type TMProfile struct {
	Parameters TMParameters `json:"parameters"`
	Name       string       `json:"name"`
	Type       string       `json:"type"`
}

TMProfile is primarily a collection of the Parameters with special meaning to Traffic Monitor for a Profile of one of the monitored cache servers and/or other Traffic Monitors, along with some identifying information for the Profile.

type TOExtensionID

type TOExtensionID struct {
	ID int `json:"id"`
}

A TOExtensionID contains an identifier for a particular Traffic Ops extension.

type TOExtensionNullable

type TOExtensionNullable struct {
	ID                    *int       `json:"id" db:"id"`
	Name                  *string    `json:"name" db:"name"`
	Version               *string    `json:"version" db:"version"`
	InfoURL               *string    `json:"info_url" db:"info_url"`
	ScriptFile            *string    `json:"script_file" db:"script_file"`
	IsActive              *int       `json:"isactive" db:"isactive"`
	AdditionConfigJSON    *string    `json:"additional_config_json" db:"additional_config_json"`
	Description           *string    `json:"description" db:"description"`
	ServercheckShortName  *string    `json:"servercheck_short_name" db:"servercheck_short_name"`
	ServercheckColumnName *string    `json:"-" db:"servercheck_column_name"`
	Type                  *string    `json:"type" db:"type_name"`
	TypeID                *int       `json:"-" db:"type"`
	LastUpdated           *TimeNoMod `json:"-" db:"last_updated"`
}

TOExtensionNullable represents a TO extension used by Traffic Ops.

func (*TOExtensionNullable) Validate

func (e *TOExtensionNullable) Validate(tx *sql.Tx) error

Validate ensures that the TOExtensionNullable request body is valid for creation.

type TOExtensionPostResponse

type TOExtensionPostResponse struct {
	Response TOExtensionID `json:"supplemental"`
	Alerts
}

TOExtensionPostResponse represents the response from Traffic Ops when creating TOExtension.

type TOExtensionResponse

type TOExtensionResponse struct {
	Response []TOExtensionNullable `json:"response"`
	Alerts
}

TOExtensionResponse represents the response from Traffic Ops when getting TOExtension.

type TRDeliveryService

type TRDeliveryService struct {
	XMLID             string            `json:"xmlId"`
	Domains           []string          `json:"domains"`
	RoutingName       string            `json:"routingName"`
	MissLocation      MissLocation      `json:"missCoordinates"`
	CoverageZoneOnly  bool              `json:"coverageZoneOnly"`
	MatchSets         []MatchSet        `json:"matchSets"`
	TTL               int               `json:"ttl"`
	TTLs              TTLS              `json:"ttls"`
	BypassDestination BypassDestination `json:"bypassDestination"`
	StatcDNSEntries   []StaticDNS       `json:"statitDnsEntries"`
	Soa               SOA               `json:"soa"`
}

TRDeliveryService structures contain all the information about a Delivery Service that are important to Traffic Routers.

type TTLS

type TTLS struct {
	Arecord    int `json:"A"`
	SoaRecord  int `json:"SOA"`
	NsRecord   int `json:"NS"`
	AaaaRecord int `json:"AAAA"`
}

TTLS is a structure that contains Time-To-Live values for different types of DNS records (in seconds).

type Tenant

type Tenant struct {
	Active      bool      `json:"active"`
	ID          int       `json:"id"`
	LastUpdated TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        string    `json:"name"`
	ParentID    int       `json:"parentId"`
	ParentName  string    `json:"parentName,omitempty" db:"parent_name"`
}

A Tenant is a scope that can be applied to groups of users to limit their Delivery Service-related actions to specific sets of similarly "Tenanted" Delivery Services.

type TenantAlert deprecated

type TenantAlert struct {
	Level string `json:"level"`
	Text  string `json:"text"`
}

TenantAlert is an unnecessary and less type-safe duplicate of Alert.

Deprecated: Use Alert instead.

type TenantNullable

type TenantNullable struct {
	ID          *int       `json:"id" db:"id"`
	Name        *string    `json:"name" db:"name"`
	Active      *bool      `json:"active" db:"active"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	ParentID    *int       `json:"parentId" db:"parent_id"`
	ParentName  *string    `json:"parentName,omitempty" db:"parent_name"`
}

TenantNullable is identical to Tenant, but its fields are reference values, which allows them to be nil.

type TenantResponse

type TenantResponse struct {
	Response Tenant `json:"response"`
	Alerts
}

TenantResponse is the type of a response from Traffic Ops to a PUT, POST, or DELETE request made to its /tenants.

type Time

type Time struct {
	time.Time
	Valid bool
}

Time wraps standard time.Time to allow indication of invalid times.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

Time structures marshal in the format defined by TimeLayout.

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements the database/sql Scanner interface.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements the json.Unmarshaller interface

Time structures accept both RFC3339-compliant date/time strings as well as the format defined by TimeLayout and Unix(-ish) timestamps. Timestamps are expected to be integer numbers that represent milliseconds since Jan 1, 1970 00:00:00.000 UTC.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type TimeNoMod deprecated

type TimeNoMod Time

TimeNoMod supports JSON marshalling, but suppresses JSON unmarshalling.

Deprecated: As TimeNoMod only supports the deprecated TimeLayout format for date/times, new code should just use time.Time instead (which defaults to the appropriate RFC3339), or Time to support Unix timestamps and backwards compatibility with this format.

func NewTimeNoMod deprecated

func NewTimeNoMod() *TimeNoMod

NewTimeNoMod returns the address of a TimeNoMod with a Time value of the current time.

Deprecated: TimeNoMod is deprecated.

func TimeNoModFromTime deprecated

func TimeNoModFromTime(t time.Time) *TimeNoMod

TimeNoModFromTime returns a reference to a TimeNoMod with the given Time value.

Deprecated: TimeNoMod is deprecated.

func (TimeNoMod) MarshalJSON

func (t TimeNoMod) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (*TimeNoMod) Scan

func (t *TimeNoMod) Scan(value interface{}) error

Scan implements the database/sql Scanner interface.

func (*TimeNoMod) UnmarshalJSON

func (t *TimeNoMod) UnmarshalJSON([]byte) (err error)

UnmarshalJSON for TimeNoMod suppresses unmarshalling.

func (TimeNoMod) Value

func (t TimeNoMod) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type TimeStamp deprecated

type TimeStamp time.Time

TimeStamp holds the current time with nanosecond precision. It is unused.

Deprecated: This is unused, so it will be removed in the future.

type TopologiesQueueUpdate

type TopologiesQueueUpdate struct {
	Action   string       `json:"action"`
	CDNID    int64        `json:"cdnId"`
	Topology TopologyName `json:"topology"`
}

TopologiesQueueUpdate decodes the update data from the POST topologies/{{name}}/queue_update endpoint.

type TopologiesQueueUpdateRequest

type TopologiesQueueUpdateRequest struct {
	Action string `json:"action"`
	CDNID  int64  `json:"cdnId"`
}

TopologiesQueueUpdateRequest encodes the request data for the POST topologies/{{name}}/queue_update endpoint.

type TopologiesQueueUpdateResponse

type TopologiesQueueUpdateResponse struct {
	TopologiesQueueUpdate `json:"response"`
	Alerts
}

TopologiesQueueUpdateResponse encodes the response data for the POST topologies/{{name}}/queue_update endpoint.

type TopologiesResponse

type TopologiesResponse struct {
	Response []Topology `json:"response"`
	Alerts
}

TopologiesResponse models the JSON object returned for a list of topologies in a response.

type Topology

type Topology struct {
	Description string         `json:"description" db:"description"`
	Name        string         `json:"name" db:"name"`
	Nodes       []TopologyNode `json:"nodes"`
	LastUpdated *TimeNoMod     `json:"lastUpdated" db:"last_updated"`
}

Topology holds the name and set of TopologyNodes that comprise a flexible topology.

type TopologyName

type TopologyName string

TopologyName is the name of a Topology.

type TopologyNode

type TopologyNode struct {
	Id          int        `json:"-" db:"id"`
	Cachegroup  string     `json:"cachegroup" db:"cachegroup"`
	Parents     []int      `json:"parents"`
	LastUpdated *TimeNoMod `json:"-" db:"last_updated"`
}

TopologyNode holds a reference to a cachegroup and the indices of up to 2 parent nodes in the same topology's array of nodes.

type TopologyResponse

type TopologyResponse struct {
	Response Topology `json:"response"`
	Alerts
}

TopologyResponse models the JSON object returned for a single Topology in a response from the Traffic Ops API.

type TrafficCacheStatsConfig

type TrafficCacheStatsConfig struct {
	CDN string
	TrafficStatsConfig
}

TrafficCacheStatsConfig represents the configuration of a request made to Traffic Stats for cache server stats.

type TrafficDSStatsConfig

type TrafficDSStatsConfig struct {
	DeliveryService string
	TrafficStatsConfig
}

TrafficDSStatsConfig represents the configuration of a request made to Traffic Stats for Delivery Service stats.

type TrafficDSStatsResponse

type TrafficDSStatsResponse struct {
	// Series holds the actual data - it is NOT in general the same as a github.com/influxdata/influxdb1-client/models.Row
	Series *TrafficStatsSeries `json:"series,omitempty"`
	// Summary contains summary statistics of the data in Series
	Summary *TrafficDSStatsSummary `json:"summary,omitempty"`
}

TrafficDSStatsResponse represents a response from the /deliveryservice_stats "Traffic Stats" endpoints.

type TrafficDSStatsSummary

type TrafficDSStatsSummary struct {
	TrafficStatsSummary
	// TotalKiloBytes is the total number of kilobytes served when the "metric type" requested is "kbps"
	// (or actually just contains "kbps"). If this is not nil, TotalTransactions *should* always be
	// nil.
	TotalKiloBytes *float64 `json:"totalKiloBytes"`
	// Totaltransactions is the total number of transactions within the requested window. Whenever
	// the requested metric doesn't contain "kbps", it assumed to be some kind of transactions
	// measurement. In that case, this will not be nil - otherwise it will be nil. If this not nil,
	// TotalBytes *should* always be nil.
	TotalTransactions *float64 `json:"totalTransactions"`
}

TrafficDSStatsSummary contains summary statistics for a data series for deliveryservice stats.

type TrafficMonitor

type TrafficMonitor struct {
	// Port is the port on which the Traffic Monitor listens for HTTP requests.
	Port int `json:"port"`
	// IP6 is the Traffic Monitor's IPv6 address.
	IP6 string `json:"ip6"`
	// IP is the Traffic Monitor's IPv4 address.
	IP string `json:"ip"`
	// HostName is the Traffic Monitor's hostname.
	HostName string `json:"hostName"`
	// FQDN is the Fully Qualified Domain Name of the Traffic Monitor server.
	FQDN string `json:"fqdn"`
	// Profile is the Name of the Profile used by the Traffic Monitor.
	Profile string `json:"profile"`
	// Location is the Name of the Cache Group to which the Traffic Monitor
	// belongs - called "Location" for legacy reasons.
	Location string `json:"location"`
	// ServerStatus is the Name of the Status of the Traffic Monitor.
	ServerStatus string `json:"status"`
}

TrafficMonitor is a structure containing enough information about a Traffic Monitor instance for another Traffic Monitor to use it for quorums and peer polling.

type TrafficMonitorConfig

type TrafficMonitorConfig struct {
	// TrafficServers is the set of all Cache Servers which should be monitored
	// by the Traffic Monitor.
	TrafficServers []TrafficServer `json:"trafficServers,omitempty"`
	// CacheGroups is a collection of Cache Group Names associated with their
	// geographic coordinates, for use in determining Cache Group availability.
	CacheGroups []TMCacheGroup `json:"cacheGroups,omitempty"`
	// Config is a mapping of arbitrary configuration parameters to their
	// respective values. While there is no defined structure to this map,
	// certain configuration parameters have specifically defined semantics
	// which may be found in the Traffic Monitor documentation.
	Config map[string]interface{} `json:"config,omitempty"`
	// TrafficMonitors is the set of ALL Traffic Monitors (including whatever
	// Traffic Monitor requested the endpoint (if indeed one did)) which is
	// used to determine quorum and peer polling behavior.
	TrafficMonitors []TrafficMonitor `json:"trafficMonitors,omitempty"`
	// DeliveryServices is the set of all Delivery Services within the
	// monitored CDN, which are used to determine Delivery Service-level
	// statistics.
	DeliveryServices []TMDeliveryService `json:"deliveryServices,omitempty"`
	// Profiles is the set of Profiles in use by any and all monitored cache
	// servers (those given in TrafficServers), which are stored here to
	// avoid potentially lengthy reiteration.
	Profiles []TMProfile `json:"profiles,omitempty"`
}

TrafficMonitorConfig is the full set of information needed by Traffic Monitor to do its job of monitoring health and statistics of cache servers.

func (*TrafficMonitorConfig) ToLegacyConfig deprecated

func (tmc *TrafficMonitorConfig) ToLegacyConfig() LegacyTrafficMonitorConfig

ToLegacyConfig converts TrafficMonitorConfig to LegacyTrafficMonitorConfig.

Deprecated: LegacyTrafficMonitoryConfig is deprecated. New code should just use TrafficMonitorConfig instead.

type TrafficMonitorConfigMap

type TrafficMonitorConfigMap struct {
	// TrafficServer is a map of cache server hostnames to TrafficServer
	// objects.
	//
	// WARNING: Cache server hostnames are NOT guaranteed to be unique, so when
	// more than one cache server with the same hostname exists, the two CANNOT
	// coexist within this structure; only one will appear and, when
	// constructed using TrafficMonitorTransformToMap, which cache server does
	// exist in the generated map is undefined.
	TrafficServer map[string]TrafficServer
	// CacheGroup is a map of Cache Group Names to TMCacheGroup objects.
	CacheGroup map[string]TMCacheGroup
	// Config is a mapping of arbitrary configuration parameters to their
	// respective values. While there is no defined structure to this map,
	// certain configuration parameters have specifically defined semantics
	// which may be found in the Traffic Monitor documentation.
	Config map[string]interface{}
	// TrafficMonitor is a map of Traffic Monitor hostnames to TrafficMonitor
	// objects.
	//
	// WARNING: Traffic Monitor hostnames are NOT guaranteed to be unique, so
	// when more than one cache server with the same hostname exists, the two
	// CANNOT coexist within this structure; only one will appear and, when
	// constructed using TrafficMonitorTransformToMap, which Traffic Monitor
	// does exist in the generated map is undefined.
	TrafficMonitor map[string]TrafficMonitor
	// DeliveryService is a map of Delivery Service XMLIDs to TMDeliveryService
	// objects.
	DeliveryService map[string]TMDeliveryService
	// Profile is a map of Profile Names to TMProfile objects.
	Profile map[string]TMProfile
}

TrafficMonitorConfigMap is a representation of a TrafficMonitorConfig using unique values as map keys.

func TrafficMonitorTransformToMap

func TrafficMonitorTransformToMap(tmConfig *TrafficMonitorConfig) (*TrafficMonitorConfigMap, error)

TrafficMonitorTransformToMap converts the given TrafficMonitorConfig to a TrafficMonitorConfigMap.

This also implicitly calls Valid on the TrafficMonitorConfigMap before returning it, and gives back whatever value that returns as the error return value.

func (*TrafficMonitorConfigMap) Valid

func (cfg *TrafficMonitorConfigMap) Valid() error

Valid returns a non-nil error if the configuration map is invalid.

A configuration map is considered invalid if:

- it is nil,

- it has no CacheGroups,

- it has no Profiles,

- it has no Traffic Monitors,

- it has no Traffic Servers,

- the Config mapping has no 'peers.polling.interval' key,

- or the Config mapping has no 'health.polling.interval' key.

Example
mc := &TrafficMonitorConfigMap{
	CacheGroup: map[string]TMCacheGroup{"a": {}},
	Config: map[string]interface{}{
		"peers.polling.interval":  0.0,
		"health.polling.interval": 0.0,
	},
	DeliveryService: map[string]TMDeliveryService{"a": {}},
	Profile:         map[string]TMProfile{"a": {}},
	TrafficMonitor:  map[string]TrafficMonitor{"a": {}},
	TrafficServer:   map[string]TrafficServer{"a": {}},
}

fmt.Printf("Validity error: %v", mc.Valid())
Output:

Validity error: <nil>

type TrafficMonitorName

type TrafficMonitorName string

TrafficMonitorName is the (short) hostname of a Traffic Monitor peer.

func (TrafficMonitorName) String

func (t TrafficMonitorName) String() string

String implements the fmt.Stringer interface.

type TrafficRouter

type TrafficRouter struct {
	Port         int    `json:"port"`
	IP6          string `json:"ip6"`
	IP           string `json:"ip"`
	FQDN         string `json:"fqdn"`
	Profile      string `json:"profile"`
	Location     string `json:"location"`
	ServerStatus string `json:"status"`
	APIPort      int    `json:"apiPort"`
}

TrafficRouter is a subset of a server that contains all the information a Traffic Router instance may need to know about one of its peers.

type TrafficRouterConfig

type TrafficRouterConfig struct {
	TrafficServers   []TrafficServer        `json:"trafficServers,omitempty"`
	TrafficMonitors  []TrafficMonitor       `json:"trafficMonitors,omitempty"`
	TrafficRouters   []TrafficRouter        `json:"trafficRouters,omitempty"`
	CacheGroups      []TMCacheGroup         `json:"cacheGroups,omitempty"`
	DeliveryServices []TRDeliveryService    `json:"deliveryServices,omitempty"`
	Stats            map[string]interface{} `json:"stats,omitempty"`
	Config           map[string]interface{} `json:"config,omitempty"`
}

TrafficRouterConfig is the json unmarshalled without any changes note all structs are local to this file _except_ the TrafficRouterConfig struct.

type TrafficRouterConfigMap

type TrafficRouterConfigMap struct {
	TrafficServer   map[string]TrafficServer
	TrafficMonitor  map[string]TrafficMonitor
	TrafficRouter   map[string]TrafficRouter
	CacheGroup      map[string]TMCacheGroup
	DeliveryService map[string]TRDeliveryService
	Config          map[string]interface{}
	Stat            map[string]interface{}
}

TrafficRouterConfigMap is a set of mappings of various objects important to Traffic Router to the structural data a Traffic Router needs to know about them.

In general, the objects herein contained do not strictly correspond to other structures that represent the same concept defined in this package - Traffic Router only gets exactly what information it needs, as keeping the size of this structure low is important for performance.

TODO: Why isn't this used instead of legacy-named things like CRConfig?

type TrafficServer

type TrafficServer struct {
	CacheGroup       string                `json:"cacheGroup"`
	DeliveryServices []tsdeliveryService   `json:"deliveryServices,omitempty"` // the deliveryServices key does not exist on mids
	FQDN             string                `json:"fqdn"`
	HashID           string                `json:"hashId"`
	HostName         string                `json:"hostName"`
	HTTPSPort        int                   `json:"httpsPort,omitempty"`
	Interfaces       []ServerInterfaceInfo `json:"interfaces"`
	Port             int                   `json:"port"`
	Profile          string                `json:"profile"`
	ServerStatus     string                `json:"status"`
	Type             string                `json:"type"`
}

TrafficServer represents a cache server for use by Traffic Monitor and Traffic Router instances.

func (*TrafficServer) IPv4

func (ts *TrafficServer) IPv4() string

IPv4 gets the server's IPv4 address if one exists, otherwise an empty string.

Note: This swallows errors from the legacy data conversion process.

Example
server := TrafficServer{
	Interfaces: []ServerInterfaceInfo{
		{
			IPAddresses: []ServerIPAddress{
				{
					Address:        "192.0.2.1",
					ServiceAddress: true,
				},
				{
					Address:        "192.0.2.2",
					ServiceAddress: false,
				},
			},
			Monitor: true,
		},
		{
			IPAddresses: []ServerIPAddress{
				{
					Address:        "192.0.2.3",
					ServiceAddress: false,
				},
			},
			Monitor: true,
		},
	},
}

fmt.Println(server.IPv4())
Output:

192.0.2.1

func (*TrafficServer) IPv6

func (ts *TrafficServer) IPv6() string

IPv6 gets the server's IPv6 address if one exists, otherwise an empty string.

Note: This swallows errors from the legacy data conversion process.

Example
server := TrafficServer{
	Interfaces: []ServerInterfaceInfo{
		{
			IPAddresses: []ServerIPAddress{
				{
					Address:        "2001:DB8::1",
					ServiceAddress: false,
				},
				{
					Address:        "2001:DB8::2",
					ServiceAddress: false,
				},
			},
			Monitor: true,
		},
		{
			IPAddresses: []ServerIPAddress{
				{
					Address:        "2001:DB8::3",
					ServiceAddress: true,
				},
			},
			Monitor: true,
		},
	},
}

fmt.Println(server.IPv6())
Output:

2001:DB8::3

func (*TrafficServer) ToLegacyServer deprecated

func (ts *TrafficServer) ToLegacyServer() LegacyTrafficServer

ToLegacyServer converts a TrafficServer to LegacyTrafficServer.

Deprecated: LegacyTrafficServer is deprecated.

type TrafficStatsCDNStats

type TrafficStatsCDNStats struct {
	Bandwidth    *float64 `json:"bandwidth"`
	Capacity     *float64 `json:"capacity"`
	CDN          string   `json:"cdn"`
	Connnections *float64 `json:"connections"`
}

TrafficStatsCDNStats contains summary statistics for a given CDN.

type TrafficStatsCDNStatsResponse

type TrafficStatsCDNStatsResponse struct {
	Response []TrafficStatsCDNsStats `json:"response"`
	Alerts
}

TrafficStatsCDNStatsResponse contains response for getting current stats.

type TrafficStatsCDNsStats

type TrafficStatsCDNsStats struct {
	Stats []TrafficStatsCDNStats `json:"currentStats"`
}

TrafficStatsCDNsStats contains a list of CDN summary statistics.

type TrafficStatsConfig

type TrafficStatsConfig struct {
	End            time.Time
	ExcludeSeries  bool
	ExcludeSummary bool
	Interval       string
	Limit          *uint64
	MetricType     string
	Offset         *uint64
	OrderBy        *TrafficStatsOrderable
	Start          time.Time
	Unix           bool
}

TrafficStatsConfig represents the configuration of a request made to Traffic Stats. This is typically constructed by parsing a request body submitted to Traffic Ops.

func (*TrafficStatsConfig) OffsetString

func (c *TrafficStatsConfig) OffsetString() string

OffsetString is a stupid, dirty hack to try to convince Influx to not give back data that's outside of the range in a WHERE clause. It doesn't work, but it helps. (https://github.com/influxdata/influxdb/issues/8010)

type TrafficStatsExclude

type TrafficStatsExclude string

TrafficStatsExclude encodes what parts of a response to a request to a "Traffic Stats" endpoint of the TO API may be omitted.

const (
	// ExcludeSeries can be used to omit the data series from a response.
	ExcludeSeries TrafficStatsExclude = "series"

	// ExcludeSummary can be used to omit the summary series from a response.
	ExcludeSummary TrafficStatsExclude = "summary"

	// ExcludeInvalid can be used if the the key that you want to exclude fails
	// validation.
	ExcludeInvalid TrafficStatsExclude = "INVALID"
)

func ExcludeFromString

func ExcludeFromString(v string) TrafficStatsExclude

ExcludeFromString parses the passed string and returns the corresponding value as a TrafficStatsExclude.

type TrafficStatsOrderable

type TrafficStatsOrderable string

TrafficStatsOrderable encodes what columns by which the data returned from a Traffic Stats query may be ordered.

const TimeOrder TrafficStatsOrderable = "time"

TimeOrder indicates an ordering by time at which the measurement was taken.

func OrderableFromString

func OrderableFromString(v string) *TrafficStatsOrderable

OrderableFromString parses the passed string and returns the corresponding value as a pointer to a TrafficStatsOrderable - or nil if the value was invalid.

type TrafficStatsResponse

type TrafficStatsResponse struct {
	// Series holds the actual data - it is NOT in general the same as a github.com/influxdata/influxdb1-client/models.Row
	Series *TrafficStatsSeries `json:"series,omitempty"`
	// Summary contains summary statistics of the data in Series
	Summary *TrafficStatsSummary `json:"summary,omitempty"`
}

TrafficStatsResponse represents the generic response from one of the "Traffic Stats endpoints" of the Traffic Ops API, e.g. `/cache_stats`.

type TrafficStatsSeries

type TrafficStatsSeries struct {
	// Columns is a list of column names. Each "row" in Values is ordered to match up with these
	// column names.
	Columns []string `json:"columns"`
	// Count is the total number of returned data points. Should be the same as len(Values)
	Count uint `json:"count"`
	// Name is the name of the InfluxDB database from which the data was retrieved
	Name string `json:"name"`
	// Tags is a set of InfluxDB tags associated with the requested database.
	Tags map[string]string `json:"tags"`
	// Values is an array of rows of arbitrary data that can only really be interpreted by
	// inspecting Columns, in general. In practice, however, each element is nearly always a
	// slice where the first element is an RFC3339 timestamp (as a string) and the second/final
	// element is a floating point number (or nil) indicating the value at that time.
	Values [][]interface{} `json:"values"`
}

TrafficStatsSeries is the actual data returned by a request to a "Traffic Stats endpoint".

func (TrafficStatsSeries) FormatTimestamps

func (s TrafficStatsSeries) FormatTimestamps() error

FormatTimestamps formats the timestamps contained in the Values array as RFC3339 strings. This returns an error if the data is not in the expected format.

type TrafficStatsSummary

type TrafficStatsSummary struct {
	// Average is calculated as an arithmetic mean
	Average float64 `json:"average"`
	// Count is the total number of data points _except_ for any values that would appear as 'nil'
	// in the corresponding series
	Count                  uint    `json:"count"`
	FifthPercentile        float64 `json:"fifthPercentile"`
	Max                    float64 `json:"max"`
	Min                    float64 `json:"min"`
	NinetyEighthPercentile float64 `json:"ninetyEighthPercentile"`
	NinetyFifthPercentile  float64 `json:"ninetyFifthPercentile"`
}

TrafficStatsSummary contains summary statistics for a data series.

type TrafficStatsTotalStats

type TrafficStatsTotalStats struct {
	Bandwidth    *float64 `json:"bandwidth"`
	CDN          string   `json:"cdn"`
	Connnections *float64 `json:"connections"`
}

TrafficStatsTotalStats contains summary statistics across CDNs.

This differs from TrafficStatsCDNStats in that it omits Capacity.

type TrafficVaultPing

type TrafficVaultPing struct {
	Status string `json:"status"`
	Server string `json:"server"`
}

TrafficVaultPing represents the status of a given Traffic Vault server.

type TrafficVaultPingResponse

type TrafficVaultPingResponse struct {
	Response TrafficVaultPing `json:"response"`
	Alerts
}

TrafficVaultPingResponse represents the JSON HTTP response returned by the /vault/ping route.

type Type

type Type struct {
	ID          int       `json:"id"`
	LastUpdated TimeNoMod `json:"lastUpdated"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	UseInTable  string    `json:"useInTable"`
}

Type contains information about a given Type in Traffic Ops.

type TypeNullable

type TypeNullable struct {
	ID          *int       `json:"id" db:"id"`
	LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
	Name        *string    `json:"name" db:"name"`
	Description *string    `json:"description" db:"description"`
	UseInTable  *string    `json:"useInTable" db:"use_in_table"`
}

TypeNullable contains information about a given Type in Traffic Ops.

type TypesResponse

type TypesResponse struct {
	Response []Type `json:"response"`
	Alerts
}

TypesResponse is the type of a response from Traffic Ops to a GET request made to its /types API endpoint.

type URLSigKeys

type URLSigKeys map[string]string

URLSigKeys is the type of the `response` property of responses from Traffic Ops to GET requests made to the /deliverservices/xmlId/{{XML ID}}/urlkeys endpoint of its API.

type URLSignatureKeysResponse

type URLSignatureKeysResponse struct {
	Response URLSigKeys `json:"response"`
	Alerts
}

URLSignatureKeysResponse is the type of a response from Traffic Ops to a request for the URL Signing keys of a Delivery Service - in API version 4.0.

type UpdateCDNFederationResponse

type UpdateCDNFederationResponse struct {
	Response CDNFederation `json:"response"`
	Alerts
}

UpdateCDNFederationResponse represents a Traffic Ops API response to a request to replace a Federation of a CDN with the one provided in the request body.

type UpdateDeliveryServiceNullableResponse deprecated

type UpdateDeliveryServiceNullableResponse struct {
	Response []DeliveryServiceNullable `json:"response"`
	Alerts
}

UpdateDeliveryServiceNullableResponse oughly models the structure of responses from Traffic Ops to PUT requests made to its /deliveryservices/{{ID}} API endpoint.

"Roughly" because although that's what it's used for, this type cannot actually represent those accurately, because its representation is tied to a version of the API that no longer exists - DO NOT USE THIS, it WILL drop data that the API returns.

Deprecated: Please only use the versioned structures.

type UpdateUserResponse

type UpdateUserResponse struct {
	Response User `json:"response"`
	Alerts
}

UpdateUserResponse can hold a Traffic Ops API response to a PUT request to update a user.

type User

type User struct {
	Username             *string    `json:"username" db:"username"`
	RegistrationSent     *TimeNoMod `json:"registrationSent" db:"registration_sent"`
	LocalPassword        *string    `json:"localPasswd,omitempty" db:"local_passwd"`
	ConfirmLocalPassword *string    `json:"confirmLocalPasswd,omitempty" db:"confirm_local_passwd"`
	// NOTE: RoleName db:"-" tag is required due to clashing with the DB query here:
	// https://github.com/apache/trafficcontrol/blob/3b5dd406bf1a0bb456c062b0f6a465ec0617d8ef/traffic_ops/traffic_ops_golang/user/user.go#L197
	// It's done that way in order to maintain "rolename" vs "roleName" JSON field capitalization for the different users APIs.
	// TODO: make the breaking API change to make all user APIs use "roleName" consistently.
	RoleName *string `json:"roleName,omitempty" db:"-"`
	// contains filtered or unexported fields
}

User represents a user of Traffic Ops.

type UserCredentials

type UserCredentials struct {
	Username string `json:"u"`
	Password string `json:"p"`
}

UserCredentials contains Traffic Ops login credentials.

type UserCurrent

type UserCurrent struct {
	UserName  *string `json:"username"`
	LocalUser *bool   `json:"localUser"`
	RoleName  *string `json:"roleName"`
	// contains filtered or unexported fields
}

UserCurrent represents the profile for the authenticated user.

type UserCurrentResponse

type UserCurrentResponse struct {
	Response UserCurrent `json:"response"`
	Alerts
}

UserCurrentResponse can hold a Traffic Ops API response to a request to get or update the current user.

type UserCurrentResponseV40

type UserCurrentResponseV40 struct {
	Response UserCurrentV40 `json:"response"`
	Alerts
}

UserCurrentResponseV40 is the Traffic Ops API version 4.0 variant of UserResponse.

type UserCurrentV40

type UserCurrentV40 struct {
	UserCurrent
	LastAuthenticated *time.Time `json:"lastAuthenticated" db:"last_authenticated"`
}

UserCurrentV40 contains LastAuthenticated field.

type UserDeliveryServiceDeleteResponse

type UserDeliveryServiceDeleteResponse struct {
	Alerts
}

UserDeliveryServiceDeleteResponse can hold a Traffic Ops API response to a request to remove a delivery service from a user.

type UserDeliveryServicePostResponse deprecated

type UserDeliveryServicePostResponse struct {
	Alerts   []Alert                 `json:"alerts"`
	Response DeliveryServiceUserPost `json:"response"`
}

UserDeliveryServicePostResponse represents a legacy concept that no longer exists in Apache Traffic Control.

DO NOT USE THIS - it ONLY still exists because it is still in use by Traffic Ops's Go client for API versions 2 and 3, despite that those API versions do not include the concepts and functionality for which this structure was created.

Deprecated: All Go clients for API versions that still erroneously link to this symbol are deprecated, and this structure serves no known purpose.

type UserInvalidationJob

type UserInvalidationJob struct {

	// Agent is unused, and developers should never count on it containing or meaning anything.
	Agent    *uint   `json:"agent"`
	AssetURL *string `json:"assetUrl"`

	// AssetType is unused, and developers should never count on it containing or meaning anything.
	AssetType       *string `json:"assetType"`
	DeliveryService *string `json:"deliveryService"`
	EnteredTime     *Time   `json:"enteredTime"`
	ID              *uint   `json:"id"`
	Keyword         *string `json:"keyword"`

	// ObjectName is unused, and developers should never count on it containing or meaning anything.
	ObjectName *string `json:"objectName"`

	// ObjectType is unused, and developers should never count on it containing or meaning anything.
	ObjectType *string `json:"objectType"`
	Parameters *string `json:"parameters"`
	Username   *string `json:"username"`
}

UserInvalidationJob is a full representation of content invalidation jobs as stored in the database, including several unused fields.

type UserInvalidationJobInput

type UserInvalidationJobInput struct {
	DSID  *uint   `json:"dsId"`
	Regex *string `json:"regex"`

	// StartTime is the time at which the job will come into effect. Must be in the future, but will
	// fail to Validate if it is further in the future than two days.
	StartTime *Time   `json:"startTime"`
	TTL       *uint64 `json:"ttl"`
	Urgent    *bool   `json:"urgent"`
}

UserInvalidationJobInput Represents legacy-style user input to the /user/current/jobs API endpoint. This is much less flexible than InvalidationJobInput, which should be used instead when possible.

func (*UserInvalidationJobInput) Validate

func (job *UserInvalidationJobInput) Validate(tx *sql.Tx) error

Validate validates that the user input is correct, given a transaction connected to the Traffic Ops database.

This requires a database transaction to check that the DSID is a valid identifier for an existing Delivery Service.

Returns an error describing any and all problematic fields encountered during validation.

type UserPasswordResetRequest

type UserPasswordResetRequest struct {
	Email rfc.EmailAddress `json:"email"`
}

UserPasswordResetRequest can hold Traffic Ops API request to reset a user's password.

type UserRegistrationRequest

type UserRegistrationRequest struct {
	Email rfc.EmailAddress `json:"email"`
	// Role - despite being named "Role" - is actually merely the *ID* of a Role to give the new user.
	Role     uint `json:"role"`
	TenantID uint `json:"tenantId"`
}

UserRegistrationRequest is the request submitted by operators when they want to register a new user.

func (*UserRegistrationRequest) Validate

func (urr *UserRegistrationRequest) Validate(tx *sql.Tx) error

Validate implements the github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.ParseValidator interface.

type UserToken

type UserToken struct {
	Token string `json:"t"`
}

UserToken represents a request payload containing a UUID token for authentication.

type UserV40

type UserV40 struct {
	User
	ChangeLogCount    *int       `json:"changeLogCount" db:"change_log_count"`
	LastAuthenticated *time.Time `json:"lastAuthenticated" db:"last_authenticated"`
}

UserV40 contains ChangeLogCount field.

type UsersResponse

type UsersResponse struct {
	Response []User `json:"response"`
	Alerts
}

UsersResponse can hold a Traffic Ops API response to a request to get a list of users.

type UsersResponseV40

type UsersResponseV40 struct {
	Response []UserV40 `json:"response"`
	Alerts
}

UsersResponseV40 is the Traffic Ops API version 4.0 variant of UserResponse.

Directories

Path Synopsis
Package tovalidate contains helpful utility functions and ozzo-validator-compatible rules and rule generators for validating data in the Traffic Ops API.
Package tovalidate contains helpful utility functions and ozzo-validator-compatible rules and rule generators for validating data in the Traffic Ops API.

Jump to

Keyboard shortcuts

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