deliveryservice

package
v8.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 45 Imported by: 0

Documentation

Overview

Package deliveryservice contains logic and handlers for /deliveryservices and related sub-routes (e.g. /deliveryservices/{{ID}}/servers).

Index

Constants

View Source
const API_ACME_AUTORENEW = "acme_autorenew"
View Source
const API_ACME_GENERATE_LE = "/deliveryservices/sslkeys/generate/acme"
View Source
const AcmeTimeout = time.Minute * 20
View Source
const GetRequiredCapabilitiesQuery = `
SELECT ds.required_capabilities
FROM deliveryservice ds
WHERE ds.id = $1
`
View Source
const NewCertValidDuration = time.Hour * 24 * 365
View Source
const (
	PemCertEndMarker = "-----END CERTIFICATE-----"
)
View Source
const SelectDeliveryServicesQuery = `
SELECT
ds.active,
	ds.anonymous_blocking_enabled,
	ds.ccr_dns_ttl,
	ds.cdn_id,
	cdn.name AS cdnName,
	ds.check_path,
	ds.consistent_hash_regex,
	CAST(ds.deep_caching_type AS text) AS deep_caching_type,
	ds.display_name,
	ds.dns_bypass_cname,
	ds.dns_bypass_ip,
	ds.dns_bypass_ip6,
	ds.dns_bypass_ttl,
	ds.dscp,
	ds.ecs_enabled,
	ds.edge_header_rewrite,
	ds.first_header_rewrite,
	ds.geolimit_redirect_url,
	ds.geo_limit,
	ds.geo_limit_countries,
	ds.geo_provider,
	ds.global_max_mbps,
	ds.global_max_tps,
	ds.fq_pacing_rate,
	ds.http_bypass_fqdn,
	ds.id,
	ds.info_url,
	ds.initial_dispersion,
	ds.inner_header_rewrite,
	ds.ipv6_routing_enabled,
	ds.last_header_rewrite,
	ds.last_updated,
	ds.logs_enabled,
	COALESCE(ds.long_desc, '') AS long_desc,
	ds.long_desc_1,
	ds.long_desc_2,
	ds.max_dns_answers,
	ds.max_origin_connections,
	ds.max_request_header_bytes,
	ds.mid_header_rewrite,
	COALESCE(ds.miss_lat, 0.0),
	COALESCE(ds.miss_long, 0.0),
	ds.multi_site_origin,
	(SELECT o.protocol::::text || ':://' || o.fqdn || rtrim(concat('::', o.port::::text), '::')
		FROM origin o
		WHERE o.deliveryservice = ds.id
		AND o.is_primary) AS org_server_fqdn,
	ds.origin_shield,
	ds.profile AS profileID,
	profile.name AS profile_name,
	profile.description  AS profile_description,
	ds.protocol,
	ds.qstring_ignore,
	(SELECT ARRAY_AGG(name ORDER BY name)
		FROM deliveryservice_consistent_hash_query_param
				WHERE deliveryservice_id = ds.id) AS query_keys,
	ds.range_request_handling,
	ds.regex_remap,
	ds.regional,
	ds.regional_geo_blocking,
	ds.remap_text,
	COALESCE(ds.required_capabilities, '{}'),
	ds.routing_name,
	ds.service_category,
	ds.signing_algorithm,
	ds.range_slice_block_size,
	ds.ssl_key_version,
	ds.tenant_id,
	tenant.name,
	(` + baseTLSVersionsQuery + ` WHERE deliveryservice = ds.id) AS tls_versions,
	ds.topology,
	ds.tr_request_headers,
	ds.tr_response_headers,
	type.name,
	ds.type AS type_id,
	ds.xml_id,
	cdn.domain_name AS cdn_domain
FROM deliveryservice AS ds
JOIN type ON ds.type = type.id
JOIN cdn ON ds.cdn_id = cdn.id
LEFT JOIN profile ON ds.profile = profile.id
LEFT JOIN tenant ON ds.tenant_id = tenant.id
`

SelectDeliveryServicesQuery is a PostgreSQL query used to fetch Delivery Services from the Traffic Ops Database.

Variables

This section is empty.

Functions

func AddSSLKeys

func AddSSLKeys(w http.ResponseWriter, r *http.Request)

AddSSLKeys adds the given ssl keys to the given delivery service.

func AlertExpiringCerts

func AlertExpiringCerts(certsFound ExpirationSummary, config config.Config) (int, error, error)

func Base64DecodeCertificate

func Base64DecodeCertificate(cert *tc.DeliveryServiceSSLKeysCertificate) error

func ConvertPrivateKeyToKeyPem

func ConvertPrivateKeyToKeyPem(userPrivateKey *rsa.PrivateKey) ([]byte, error)

ConvertPrivateKeyToKeyPem converts an rsa.PrivateKey to be PEM encoded.

func CopyURLKeys

func CopyURLKeys(w http.ResponseWriter, r *http.Request)

CopyURLKeys copies the URL sig keys from a delivery service in the 'copy-name' path parameter to the delivery service in the 'name' path parameter.

func CreateDNSSECKeys

func CreateDNSSECKeys(exampleURLs []string, cdnKeys tc.DNSSECKeySetV11, kskExpiration time.Duration, zskExpiration time.Duration, ttl time.Duration, overrideTTL bool) (tc.DNSSECKeySetV11, error)

CreateDNSSECKeys creates DNSSEC keys for the given delivery service, updating existing keys if they exist. The overrideTTL parameter determines whether to reuse existing key TTLs if they exist, or to override existing TTLs with the ttl parameter's value.

func CreateV30

func CreateV30(w http.ResponseWriter, r *http.Request)

CreateV30 is used to handle POST requests to create a Delivery Service at version 3.0 of the Traffic Ops API.

func CreateV31

func CreateV31(w http.ResponseWriter, r *http.Request)

CreateV31 is used to handle POST requests to create a Delivery Service at version 3.1 of the Traffic Ops API.

func CreateV40

func CreateV40(w http.ResponseWriter, r *http.Request)

CreateV40 is used to handle POST requests to create a Delivery Service at version 4.0 of the Traffic Ops API (and isomorphic API versions thereof, with respect to Delivery Service representations).

func CreateV41

func CreateV41(w http.ResponseWriter, r *http.Request)

CreateV41 is a handler for POST requests to create Delivery Services in version 4.1 of the Traffic Ops API.

func CreateV50

func CreateV50(w http.ResponseWriter, r *http.Request)

CreateV50 is used to handle POST requests to create a Delivery Service at version 5.0 of the Traffic Ops API.

func DeleteOldCerts

func DeleteOldCerts(db *sql.DB, tx *sql.Tx, cfg *config.Config, cdn tc.CDNName, tv trafficvault.TrafficVault) error

DeleteOldCerts asynchronously deletes HTTPS certificates in Riak which have no corresponding delivery service in the database.

Note the delivery service may still be in the CRConfig! Therefore, this should only be called immediately after a CRConfig Snapshot.

This creates a goroutine, and immediately returns. It returns an error if there was an error preparing the delete routine, such as an error creating a db transaction.

Note because it is asynchronous, this may return a nil error, but the asynchronous goroutine may error when fetching or deleting the certificates. If such an error occurs, it will be logged to the error log.

If certificate deletion is already being processed by a goroutine, another delete will be queued, and this immediately returns nil. Only one delete will ever be queued.

func DeleteSSLKeys

func DeleteSSLKeys(w http.ResponseWriter, r *http.Request)

DeleteSSLKeys deletes a Delivery Service's sslkeys via a DELETE method

func DeleteURLKeysByID

func DeleteURLKeysByID(w http.ResponseWriter, r *http.Request)

DeleteURLKeysByID deletes the URL sig keys for the delivery service identified by the id in the path parameter.

func DeleteURLKeysByName

func DeleteURLKeysByName(w http.ResponseWriter, r *http.Request)

DeleteURLKeysByName deletes the URL sig keys for the delivery service identified by the xmlId in the path parameter.

func EncodePEMToLegacyPerlRiakFormat

func EncodePEMToLegacyPerlRiakFormat(pem []byte) []byte

EncodePEMToLegacyPerlRiakFormat takes a PEM-encoded byte (typically a certificate, csr, or key) and returns the format Perl Traffic Ops used to send to Riak.

func EnsureCacheURLParams

func EnsureCacheURLParams(tx *sql.Tx, dsID int, xmlID string, cacheURL *string) error

EnsureCacheURLParams ensures the given delivery service's cachrurl parameters exist on profiles of servers assigned to the delivery service.

func EnsureParams

func EnsureParams(tx *sql.Tx, dsID int, xmlID string, edgeHeaderRewrite *string, midHeaderRewrite *string, regexRemap *string, signingAlgorithm *string, dsType tc.DSType, maxOriginConns *int) error

EnsureParams ensures the given delivery service's necessary parameters exist on profiles of servers assigned to the delivery service. Note the edgeHeaderRewrite, midHeaderRewrite, regexRemap may be nil, if the delivery service does not have those values.

func EnsureTopologyBasedRequiredCapabilities

func EnsureTopologyBasedRequiredCapabilities(tx *sql.Tx, dsID int, topology string, requiredCapabilities []string) (error, error, int)

EnsureTopologyBasedRequiredCapabilities ensures that at least one server per cachegroup in this delivery service's topology has this delivery service's required capabilities.

func GenerateAcmeCertificates

func GenerateAcmeCertificates(w http.ResponseWriter, r *http.Request)

GenerateAcmeCertificates gets and saves certificates using ACME protocol from a give ACME provider.

func GenerateCert

func GenerateCert(host, country, city, state, org, unit string) ([]byte, []byte, []byte, error)

GenerateCert generates a key and certificate for serving HTTPS. The generated key is 2048-bit RSA, to match the old Perl code. The certificate will be valid for NewCertValidDuration time after now. Returns PEM-encoded certificate signing request (csr), certificate (crt), and key; or any error.

func GenerateLetsEncryptCertificates

func GenerateLetsEncryptCertificates(w http.ResponseWriter, r *http.Request)

GenerateLetsEncryptCertificates gets and saves new certificates from Let's Encrypt.

func GeneratePlaceholderSelfSignedCert

func GeneratePlaceholderSelfSignedCert(ds tc.DeliveryServiceV5, inf *api.Info, context context.Context) (error, int)

GeneratePlaceholderSelfSignedCert generates a self-signed SSL certificate as a placeholder when a new HTTPS delivery service is created or an HTTP delivery service is updated to use HTTPS.

func GenerateSSLKeys

func GenerateSSLKeys(w http.ResponseWriter, r *http.Request)

GenerateSSLKeys generates a new private key, certificate signing request and certificate based on the values submitted. It then stores these values in TrafficVault and updates the SSL key version.

func GenerateURLKeys

func GenerateURLKeys(w http.ResponseWriter, r *http.Request)

GenerateURLKeys generates new URL sig keys for the delivery service identified by the xmlId in the path parameter.

func GenerateURLSigKeys

func GenerateURLSigKeys() (tc.URLSigKeys, error)

GenerateURLSigKeys generates new URL sig keys.

func GetAcmeAccountConfig

func GetAcmeAccountConfig(cfg *config.Config, acmeProvider string) *config.ConfigAcmeAccount

GetAcmeAccountConfig returns the ACME account information from cdn.conf for a given provider.

func GetAcmeCertificates

func GetAcmeCertificates(cfg *config.Config, req tc.DeliveryServiceAcmeSSLKeysReq, ctx context.Context, cancelTx context.CancelFunc, shouldCancelTx bool, currentUser *auth.CurrentUser, asyncStatusId int, tv trafficvault.TrafficVault) error

GetAcmeCertificates gets or creates an ACME account based on the provider, then gets new certificates for the delivery service requested and saves them to Vault.

func GetAcmeClient

func GetAcmeClient(acmeAccount *config.ConfigAcmeAccount, userTx *sql.Tx, db *sqlx.DB, xmlId *string) (*lego.Client, error)

GetAcmeClient uses the ACME account information in either cdn.conf or the database to create and register an ACME client.

func GetCapacity

func GetCapacity(w http.ResponseWriter, r *http.Request)

func GetDNSSECKeysV11

func GetDNSSECKeysV11(keyType string, dsName string, ttl time.Duration, inception time.Time, expiration time.Time, status string, effectiveDate time.Time, tld bool) (tc.DNSSECKeyV11, error)

func GetDSDomainName

func GetDSDomainName(dsExampleURLs []string) (string, error)

func GetDSTLSVersions

func GetDSTLSVersions(dsID int, tx *sql.Tx) ([]string, error)

GetDSTLSVersions retrieves the TLS versions explicitly supported by a Delivery Service identified by dsID. This will panic if handed a nil transaction.

func GetDeliveryServicesMatchLists

func GetDeliveryServicesMatchLists(dses []string, tx *sql.Tx) (map[string][]tc.DeliveryServiceMatch, error)

GetDeliveryServicesMatchLists retrieves "Match Lists" for each of the Delivery Services having the provided XMLID(s). The error return value is not safe to return to clients.

func GetDnsChallengeRecords

func GetDnsChallengeRecords(w http.ResponseWriter, r *http.Request)

func GetHealth

func GetHealth(w http.ResponseWriter, r *http.Request)

func GetInvalidCachegroupsForRequiredCapabilities

func GetInvalidCachegroupsForRequiredCapabilities(
	cachegroupServers map[string][]int,
	serverCapabilities map[int]map[string]struct{},
	requiredCapabilities []string,
) []string

GetInvalidCachegroupsForRequiredCapabilities returns the cachegroups that are invalid w.r.t. the given `requiredCapabilities` of a delivery service. `cachegroupServers` is a map of cachegroup names to server IDs that belong to the delivery service's CDN. `serverCapabilities` is a map of those server IDs to their set of capabilities.

func GetSSLKeysByXMLID

func GetSSLKeysByXMLID(w http.ResponseWriter, r *http.Request)

GetSSLKeysByXMLID fetches the deliveryservice ssl keys by the specified xmlID. V15 includes expiration date.

func GetSSlKeyExpirationInformation

func GetSSlKeyExpirationInformation(w http.ResponseWriter, r *http.Request)

GetSSlKeyExpirationInformation gets expiration information for all SSL certificates.

func GetServersEligible

func GetServersEligible(w http.ResponseWriter, r *http.Request)

func GetURLKeysByID

func GetURLKeysByID(w http.ResponseWriter, r *http.Request)

GetURLKeysByID returns the URL sig keys for a delivery service identified by the id in the path parameter.

func GetURLKeysByName

func GetURLKeysByName(w http.ResponseWriter, r *http.Request)

GetURLKeysByName returns the URL sig keys for a delivery service identified by the xmlId in the path parameter.

func GetXMLID

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

GetXMLID loads the DeliveryService's xml_id from the database, from the ID. Returns whether the delivery service was found, and any error.

func MakeDNSSECKeysFromTrafficVaultKeys

func MakeDNSSECKeysFromTrafficVaultKeys(riakKeys tc.DNSSECKeysTrafficVault, dsTTL time.Duration) (tc.DNSSECKeys, error)

MakeDNSSECKeySetFromRiakKeySet creates a DNSSECKeySet (as served by Traffic Ops) from a DNSSECKeysRiak (as stored in Riak), adding any computed data. Notably, this adds the full DS Record text to CDN KSKs

func MakeDSRecordText

func MakeDSRecordText(ksk tc.DNSSECKeyV11, ttl time.Duration) (string, error)

func MakeExampleURLs

func MakeExampleURLs(protocol *int, dsType tc.DSType, routingName string, matchList []tc.DeliveryServiceMatch, cdnDomain string) []string

MakeExampleURLs creates the example URLs for a delivery service. The dsProtocol may be nil, if the delivery service type doesn't have a protocol (e.g. ANY_MAP).

func ParseExpirationAndSansFromCert

func ParseExpirationAndSansFromCert(cert []byte, commonName string) (time.Time, []string, error)

ParseExpirationAndSansFromCert returns the expiration and SANs from a certificate.

func PutDNSSecKeys

func PutDNSSecKeys(tx *sql.Tx, xmlID string, cdnName string, exampleURLs []string, tv trafficvault.TrafficVault, ctx context.Context) (error, error, int)

func RenewAcmeCertificate

func RenewAcmeCertificate(w http.ResponseWriter, r *http.Request)

RenewAcmeCertificate renews the SSL certificate for a delivery service if possible through ACME protocol.

func RenewCertificates

func RenewCertificates(w http.ResponseWriter, r *http.Request)

RenewCertificates renews all SSL certificates that are expiring within a certain time limit. This will renew Let's Encrypt and ACME certificates.

func RenewCertificatesDeprecated

func RenewCertificatesDeprecated(w http.ResponseWriter, r *http.Request)

RenewCertificatesDeprecated renews all SSL certificates that are expiring within a certain time limit with a deprecation alert. // This will renew Let's Encrypt and ACME certificates.

func RunAutorenewal

func RunAutorenewal(existingCerts []ExistingCerts, cfg *config.Config, ctx context.Context, cancelTx context.CancelFunc, currentUser *auth.CurrentUser, asyncStatusId int, tv trafficvault.TrafficVault)

func UpdateSafe

func UpdateSafe(w http.ResponseWriter, r *http.Request)

UpdateSafe is the handler for PUT requests to /deliveryservices/{{ID}}/safe.

The only fields which are "safe" to modify are the displayName, infoURL, longDesc, and longDesc1.

func UpdateV30

func UpdateV30(w http.ResponseWriter, r *http.Request)

UpdateV30 is used to handle PUT requests to update a Delivery Service in version 3.0 of the Traffic Ops API.

func UpdateV31

func UpdateV31(w http.ResponseWriter, r *http.Request)

UpdateV31 is used to handle PUT requests to update a Delivery Service in version 3.1 of the Traffic Ops API.

func UpdateV40

func UpdateV40(w http.ResponseWriter, r *http.Request)

UpdateV40 is used to handle PUT requests to update a Delivery Service in version 4.0 of the Traffic Ops API (and isomorphic API versions thereof, with respect to Delivery Service representations).

func UpdateV41

func UpdateV41(w http.ResponseWriter, r *http.Request)

UpdateV41 is used to handle PUT requests to update a Delivery Service in version 4.1 of the Traffic Ops API (and isomorphic API versions thereof, with respect to Delivery Service representations).

func UpdateV50

func UpdateV50(w http.ResponseWriter, r *http.Request)

UpdateV50 is used to handle PUT requests to update a Delivery Service in version 5.0 of the Traffic Ops API (and isomorphic API versions thereof, with respect to Delivery Service representations).

func Validate

func Validate(tx *sql.Tx, ds *tc.DeliveryServiceV5) (error, error)

Validate checks that the given Delivery Service is valid according to various criteria. *It also modifies the given DS under certain circumstances, providing default values to some properties when they are zero-valued or nil references*. This will panic if either argument is nil. The error returned is safe for clients to see.

Types

type AcmeInfo

type AcmeInfo struct {
	Email      string `db:"email"`
	Key        string `db:"private_key"`
	URI        string `db:"uri"`
	PrivateKey rsa.PrivateKey
}

AcmeInfo contains the information that will be stored for an ACME account.

type CapData

type CapData struct {
	Available   float64
	Unavailable float64
	Maintenance float64
	Capacity    float64
}

type CapacityResp

type CapacityResp struct {
	AvailablePercent   float64 `json:"availablePercent"`
	UnavailablePercent float64 `json:"unavailablePercent"`
	UtilizedPercent    float64 `json:"utilizedPercent"`
	MaintenancePercent float64 `json:"maintenancePercent"`
}

type DNSProviderTrafficRouter

type DNSProviderTrafficRouter struct {
	// contains filtered or unexported fields
}

DNSProviderTrafficRouter is used in the lego library and contains a database in order to store the DNS challenges for ACME protocol.

func NewDNSProviderTrafficRouter

func NewDNSProviderTrafficRouter() *DNSProviderTrafficRouter

NewDNSProviderTrafficRouter returns a new DNSProviderTrafficRouter object.

func (*DNSProviderTrafficRouter) CleanUp

func (d *DNSProviderTrafficRouter) CleanUp(domain, token, keyAuth string) error

CleanUp removes the DNS challenge record from the database after the challenge has completed. This is used in the lego library.

func (*DNSProviderTrafficRouter) Present

func (d *DNSProviderTrafficRouter) Present(domain, token, keyAuth string) error

Present inserts the DNS challenge record into the database to be used by Traffic Router. This is used in the lego library.

func (*DNSProviderTrafficRouter) Timeout

func (d *DNSProviderTrafficRouter) Timeout() (timeout, interval time.Duration)

Timeout returns timeout information for the lego library including the timeout duration and the interval between checks.

type DSWithLegacyFields

type DSWithLegacyFields struct {
	DS        tc.DeliveryServiceV5
	LongDesc1 *string
	LongDesc2 *string
}

DSWithLegacyFields contains a Delivery Service along with associated fields that have been removed from its representation(s).

func GetDeliveryServices

func GetDeliveryServices(query string, queryValues map[string]interface{}, tx *sqlx.Tx) ([]DSWithLegacyFields, error, error, int)

GetDeliveryServices can be used with a valid query and map of values to retrieve Delivery Services from the database. Note that Tenancy must be built into the query already. The returned Delivery Services come with accompanying information about fields that have been removed from the model, in case a legacy handler needs that information.

type DnsRecord

type DnsRecord struct {
	Fqdn   *string `json:"fqdn" db:"fqdn"`
	Record *string `json:"record" db:"record"`
	XmlId  *string `json:"xmlId" db:"xml_id"`
}

type DsExpirationInfo

type DsExpirationInfo struct {
	XmlId      string
	Version    util.JSONIntStr
	Expiration time.Time
	AuthType   string
	Error      error
}

type DsKey

type DsKey struct {
	XmlId   string
	Version sql.NullInt64
}

type ExistingCerts

type ExistingCerts struct {
	Version sql.NullInt64
	XmlId   string
}

type ExpirationSummary

type ExpirationSummary struct {
	LetsEncryptExpirations []DsExpirationInfo
	SelfSignedExpirations  []DsExpirationInfo
	AcmeExpirations        []DsExpirationInfo
	OtherExpirations       []DsExpirationInfo
}

type MyUser

type MyUser struct {
	Email        string
	Registration *registration.Resource
	// contains filtered or unexported fields
}

MyUser stores the user's information for use in ACME protocol.

func (*MyUser) GetEmail

func (u *MyUser) GetEmail() string

GetEmail returns a user's email for use in ACME protocol.

func (*MyUser) GetPrivateKey

func (u *MyUser) GetPrivateKey() crypto.PrivateKey

GetPrivateKey returns a user's private key for use in ACME protocol.

func (MyUser) GetRegistration

func (u MyUser) GetRegistration() *registration.Resource

GetRegistration returns a user's registration for use in ACME protocol.

type OldCertDeleter

type OldCertDeleter struct {
	Start chan struct{}
	Die   chan struct{}
	Once  sync.Once
}

type OldCertDeleters

type OldCertDeleters struct {
	D map[tc.CDNName]*OldCertDeleter
	M sync.Mutex
}

type RequiredCapability

type RequiredCapability struct {
	api.APIInfoImpl `json:"-"`
	tc.DeliveryServicesRequiredCapability
}

RequiredCapability provides a type to define methods on.

func (*RequiredCapability) Create

func (rc *RequiredCapability) Create() (error, error, int)

Create implements the api.CRUDer interface.

func (*RequiredCapability) Delete

func (rc *RequiredCapability) Delete() (error, error, int)

Delete implements the api.CRUDer interface.

func (*RequiredCapability) DeleteQuery

func (rc *RequiredCapability) DeleteQuery() string

DeleteQuery implements the api.GenericDeleter interface.

func (*RequiredCapability) GetAuditName

func (rc *RequiredCapability) GetAuditName() string

GetAuditName implements the api.Identifier interface and returns the name of the object.

func (RequiredCapability) GetKeyFieldsInfo

func (rc RequiredCapability) GetKeyFieldsInfo() []api.KeyFieldInfo

GetKeyFieldsInfo implements the api.Identifier interface.

func (RequiredCapability) GetKeys

func (rc RequiredCapability) GetKeys() (map[string]interface{}, bool)

GetKeys implements the api.Identifier interface and is not needed because Update is not available.

func (*RequiredCapability) GetType

func (rc *RequiredCapability) GetType() string

GetType implements the api.Identifier interface and returns the name of the struct.

func (*RequiredCapability) NewReadObj

func (rc *RequiredCapability) NewReadObj() interface{}

NewReadObj implements the api.GenericReader interfaces.

func (*RequiredCapability) ParamColumns

func (rc *RequiredCapability) ParamColumns() map[string]dbhelpers.WhereColumnInfo

ParamColumns implements the api.GenericReader interface.

func (*RequiredCapability) Read

func (rc *RequiredCapability) Read(h http.Header, useIMS bool) ([]interface{}, error, error, int, *time.Time)

Read implements the api.CRUDer interface.

func (*RequiredCapability) SelectQuery

func (rc *RequiredCapability) SelectQuery() string

SelectQuery implements the api.GenericReader interface.

func (*RequiredCapability) SetKeys

func (rc *RequiredCapability) SetKeys(keys map[string]interface{})

SetKeys implements the api.Identifier interface and allows the create handler to assign deliveryServiceID and requiredCapability.

func (*RequiredCapability) SetLastUpdated

func (rc *RequiredCapability) SetLastUpdated(t tc.TimeNoMod)

SetLastUpdated implements the api.GenericCreator interfaces and sets the timestamp on insert.

func (*RequiredCapability) Update

func (rc *RequiredCapability) Update(http.Header) (error, error, int)

Update implements the api.CRUDer interface.

func (RequiredCapability) Validate

func (rc RequiredCapability) Validate() (error, error)

Validate implements the api.Validator interface.

type TODeliveryService

type TODeliveryService struct {
	api.APIInfoImpl
	tc.DeliveryServiceV5
}

TODeliveryService is a CRUDder implementation for Delivery Services; it's only used for GET and DELETE requests.

func (*TODeliveryService) APIInfo

func (ds *TODeliveryService) APIInfo() *api.Info

APIInfo implements github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.APIInfoer.

func (*TODeliveryService) Delete

func (ds *TODeliveryService) Delete() (error, error, int)

Delete implements the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Deleter interface (given that the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.APIInfoer and github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interfaces are already implemented).

func (*TODeliveryService) DeleteQuery

func (*TODeliveryService) DeleteQuery() string

DeleteQuery implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.GenericDeleter interface.

func (*TODeliveryService) GetAuditName

func (ds *TODeliveryService) GetAuditName() string

GetAuditName implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interface.

func (TODeliveryService) GetKeyFieldsInfo

func (ds TODeliveryService) GetKeyFieldsInfo() []api.KeyFieldInfo

GetKeyFieldsInfo implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interface.

func (TODeliveryService) GetKeys

func (ds TODeliveryService) GetKeys() (map[string]interface{}, bool)

GetKeys implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interface.

func (*TODeliveryService) GetType

func (ds *TODeliveryService) GetType() string

GetType implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interface.

func (*TODeliveryService) IsTenantAuthorized

func (ds *TODeliveryService) IsTenantAuthorized(user *auth.CurrentUser) (bool, error)

IsTenantAuthorized implements the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Tenantable interface.

func (TODeliveryService) MarshalJSON

func (ds TODeliveryService) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler.

func (*TODeliveryService) Read

func (ds *TODeliveryService) Read(h http.Header, useIMS bool) ([]interface{}, error, error, int, *time.Time)

Read implements the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Reader interface (given that github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.APIInfoer is already implemented).

func (*TODeliveryService) SetKeys

func (ds *TODeliveryService) SetKeys(keys map[string]interface{})

SetKeys implements part of the github.com/apache/trafficcontrol/v8/traffic_ops/traffic_ops_golang/api.Identifier interface.

func (*TODeliveryService) UnmarshalJSON

func (ds *TODeliveryService) UnmarshalJSON(data []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler.

type TODeliveryServiceOldDetails

type TODeliveryServiceOldDetails struct {
	OldOrgServerFQDN *string
	OldCDNName       string
	OldCDNID         int
	OldRoutingName   string
	OldSSLKeyVersion *int
}

TODeliveryServiceOldDetails is used to store the "old" details while updating a DS.

Directories

Path Synopsis
Package request contains logic and handlers for API routes dealing with Delivery Service Requests (DSRs).
Package request contains logic and handlers for API routes dealing with Delivery Service Requests (DSRs).

Jump to

Keyboard shortcuts

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