You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ro...@apache.org on 2018/06/18 22:16:44 UTC
[trafficcontrol] branch master updated (386a9b1 -> 8d2de9b)
This is an automated email from the ASF dual-hosted git repository.
rob pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.
from 386a9b1 Fix TO Go logging unauthenticated endpoints
new 06e464d added anonymous_blocking_enabled field to deliveryservice queries
new a5eb9ed moved anonymousBlockingEnabled field to V13 struct; updated test cases to use V13 struct
new 396e3f8 restored anonymousBlockingEnabled in DeliveryServiceV12 structs
new 8d2de9b resolving dsv13 merge conflicts
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
lib/go-tc/deliveryservices.go | 246 ++++++++++-----------
traffic_ops/client/v13/deliveryservice.go | 16 +-
.../testing/api/v13/deliveryservices_test.go | 6 +-
traffic_ops/testing/api/v13/traffic_control.go | 2 +-
.../deliveryservice/deliveryservicesv13.go | 15 +-
5 files changed, 144 insertions(+), 141 deletions(-)
[trafficcontrol] 01/04: added anonymous_blocking_enabled field to
deliveryservice queries
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 06e464db01f4b2593acdd64264924b2644497e85
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Wed Jun 13 08:26:19 2018 -0600
added anonymous_blocking_enabled field to deliveryservice queries
---
lib/go-tc/deliveryservices.go | 244 ++++++++++-----------
.../experimental/server/api/deliveryservices.go | 3 +
.../deliveryservice/deliveryservicesv13.go | 14 +-
3 files changed, 134 insertions(+), 127 deletions(-)
diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index e7e8614..114d97e 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -60,59 +60,60 @@ type DeleteDeliveryServiceResponse struct {
// DeliveryService ...
// TODO move contents to DeliveryServiceV12, fix references, and remove
type DeliveryService struct {
- Active bool `json:"active"`
- 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"`
- FQPacingRate int `json:"fqPacingRate"`
- 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"`
- SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
- TypeID int `json:"typeId"`
- Type DSType `json:"type"`
- TRResponseHeaders string `json:"trResponseHeaders"`
- TenantID int `json:"tenantId,omitempty"`
- XMLID string `json:"xmlId"`
+ 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"`
+ FQPacingRate int `json:"fqPacingRate"`
+ 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"`
+ SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
+ TypeID int `json:"typeId"`
+ Type DSType `json:"type"`
+ TRResponseHeaders string `json:"trResponseHeaders"`
+ TenantID int `json:"tenantId,omitempty"`
+ XMLID string `json:"xmlId"`
}
type DeliveryServiceV12 struct {
@@ -121,13 +122,12 @@ type DeliveryServiceV12 struct {
type DeliveryServiceV13 struct {
DeliveryServiceV12
- AnonymousBlockingEnabled bool `json:"anonymousBlockingEnabled"`
- DeepCachingType DeepCachingType `json:"deepCachingType"`
- FQPacingRate int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
- TenantName string `json:"tenantName,omitempty"`
- TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
- TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
+ DeepCachingType DeepCachingType `json:"deepCachingType"`
+ FQPacingRate int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
+ TenantName string `json:"tenantName,omitempty"`
+ TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
+ TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
}
// DeliveryServiceNullable - a version of the deliveryservice that allows for all fields to be null
@@ -135,61 +135,62 @@ type DeliveryServiceV13 struct {
type DeliveryServiceNullable struct {
// NOTE: the db: struct tags are used for testing to map to their equivalent database column (if there is one)
//
- Active *bool `json:"active" db:"active"`
- CacheURL *string `json:"cacheurl" db:"cacheurl"`
- CCRDNSTTL *int `json:"ccrDnsTtl" db:"ccr_dns_ttl"`
- CDNID *int `json:"cdnId" db:"cdn_id"`
- CDNName *string `json:"cdnName"`
- CheckPath *string `json:"checkPath" db:"check_path"`
- DisplayName *string `json:"displayName" db:"display_name"`
- DNSBypassCNAME *string `json:"dnsBypassCname" db:"dns_bypass_cname"`
- DNSBypassIP *string `json:"dnsBypassIp" db:"dns_bypass_ip"`
- DNSBypassIP6 *string `json:"dnsBypassIp6" db:"dns_bypass_ip6"`
- DNSBypassTTL *int `json:"dnsBypassTtl" db:"dns_bypass_ttl"`
- DSCP *int `json:"dscp" db:"dscp"`
- EdgeHeaderRewrite *string `json:"edgeHeaderRewrite" db:"edge_header_rewrite"`
- FQPacingRate *int `json:"fqPacingRate" db:"fq_pacing_rate"`
- GeoLimit *int `json:"geoLimit" db:"geo_limit"`
- GeoLimitCountries *string `json:"geoLimitCountries" db:"geo_limit_countries"`
- GeoLimitRedirectURL *string `json:"geoLimitRedirectURL" db:"geolimit_redirect_url"`
- GeoProvider *int `json:"geoProvider" db:"geo_provider"`
- GlobalMaxMBPS *int `json:"globalMaxMbps" db:"global_max_mbps"`
- GlobalMaxTPS *int `json:"globalMaxTps" db:"global_max_tps"`
- HTTPBypassFQDN *string `json:"httpBypassFqdn" db:"http_bypass_fqdn"`
- ID *int `json:"id" db:"id"`
- InfoURL *string `json:"infoUrl" db:"info_url"`
- InitialDispersion *int `json:"initialDispersion" db:"initial_dispersion"`
- IPV6RoutingEnabled *bool `json:"ipv6RoutingEnabled" db:"ipv6_routing_enabled"`
- LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
- LogsEnabled *bool `json:"logsEnabled" db:"logs_enabled"`
- LongDesc *string `json:"longDesc" db:"long_desc"`
- LongDesc1 *string `json:"longDesc1" db:"long_desc_1"`
- LongDesc2 *string `json:"longDesc2" db:"long_desc_2"`
- MatchList *[]DeliveryServiceMatch `json:"matchList"`
- MaxDNSAnswers *int `json:"maxDnsAnswers" db:"max_dns_answers"`
- MidHeaderRewrite *string `json:"midHeaderRewrite" db:"mid_header_rewrite"`
- MissLat *float64 `json:"missLat" db:"miss_lat"`
- MissLong *float64 `json:"missLong" db:"miss_long"`
- MultiSiteOrigin *bool `json:"multiSiteOrigin" db:"multi_site_origin"`
- OriginShield *string `json:"originShield" db:"origin_shield"`
- OrgServerFQDN *string `json:"orgServerFqdn" db:"org_server_fqdn"`
- ProfileDesc *string `json:"profileDescription"`
- ProfileID *int `json:"profileId" db:"profile"`
- ProfileName *string `json:"profileName"`
- Protocol *int `json:"protocol" db:"protocol"`
- QStringIgnore *int `json:"qstringIgnore" db:"qstring_ignore"`
- RangeRequestHandling *int `json:"rangeRequestHandling" db:"range_request_handling"`
- RegexRemap *string `json:"regexRemap" db:"regex_remap"`
- RegionalGeoBlocking *bool `json:"regionalGeoBlocking" db:"regional_geo_blocking"`
- RemapText *string `json:"remapText" db:"remap_text"`
- RoutingName *string `json:"routingName" db:"routing_name"`
- Signed bool `json:"signed"`
- SSLKeyVersion *int `json:"sslKeyVersion" db:"ssl_key_version"`
- TenantID *int `json:"tenantId" db:"tenant_id"`
- Type *DSType `json:"type"`
- TypeID *int `json:"typeId" db:"type"`
- XMLID *string `json:"xmlId" db:"xml_id"`
- ExampleURLs []string `json:"exampleURLs"`
+ Active *bool `json:"active" db:"active"`
+ AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
+ CacheURL *string `json:"cacheurl" db:"cacheurl"`
+ CCRDNSTTL *int `json:"ccrDnsTtl" db:"ccr_dns_ttl"`
+ CDNID *int `json:"cdnId" db:"cdn_id"`
+ CDNName *string `json:"cdnName"`
+ CheckPath *string `json:"checkPath" db:"check_path"`
+ DisplayName *string `json:"displayName" db:"display_name"`
+ DNSBypassCNAME *string `json:"dnsBypassCname" db:"dns_bypass_cname"`
+ DNSBypassIP *string `json:"dnsBypassIp" db:"dns_bypass_ip"`
+ DNSBypassIP6 *string `json:"dnsBypassIp6" db:"dns_bypass_ip6"`
+ DNSBypassTTL *int `json:"dnsBypassTtl" db:"dns_bypass_ttl"`
+ DSCP *int `json:"dscp" db:"dscp"`
+ EdgeHeaderRewrite *string `json:"edgeHeaderRewrite" db:"edge_header_rewrite"`
+ FQPacingRate *int `json:"fqPacingRate" db:"fq_pacing_rate"`
+ GeoLimit *int `json:"geoLimit" db:"geo_limit"`
+ GeoLimitCountries *string `json:"geoLimitCountries" db:"geo_limit_countries"`
+ GeoLimitRedirectURL *string `json:"geoLimitRedirectURL" db:"geolimit_redirect_url"`
+ GeoProvider *int `json:"geoProvider" db:"geo_provider"`
+ GlobalMaxMBPS *int `json:"globalMaxMbps" db:"global_max_mbps"`
+ GlobalMaxTPS *int `json:"globalMaxTps" db:"global_max_tps"`
+ HTTPBypassFQDN *string `json:"httpBypassFqdn" db:"http_bypass_fqdn"`
+ ID *int `json:"id" db:"id"`
+ InfoURL *string `json:"infoUrl" db:"info_url"`
+ InitialDispersion *int `json:"initialDispersion" db:"initial_dispersion"`
+ IPV6RoutingEnabled *bool `json:"ipv6RoutingEnabled" db:"ipv6_routing_enabled"`
+ LastUpdated *TimeNoMod `json:"lastUpdated" db:"last_updated"`
+ LogsEnabled *bool `json:"logsEnabled" db:"logs_enabled"`
+ LongDesc *string `json:"longDesc" db:"long_desc"`
+ LongDesc1 *string `json:"longDesc1" db:"long_desc_1"`
+ LongDesc2 *string `json:"longDesc2" db:"long_desc_2"`
+ MatchList *[]DeliveryServiceMatch `json:"matchList"`
+ MaxDNSAnswers *int `json:"maxDnsAnswers" db:"max_dns_answers"`
+ MidHeaderRewrite *string `json:"midHeaderRewrite" db:"mid_header_rewrite"`
+ MissLat *float64 `json:"missLat" db:"miss_lat"`
+ MissLong *float64 `json:"missLong" db:"miss_long"`
+ MultiSiteOrigin *bool `json:"multiSiteOrigin" db:"multi_site_origin"`
+ OriginShield *string `json:"originShield" db:"origin_shield"`
+ OrgServerFQDN *string `json:"orgServerFqdn" db:"org_server_fqdn"`
+ ProfileDesc *string `json:"profileDescription"`
+ ProfileID *int `json:"profileId" db:"profile"`
+ ProfileName *string `json:"profileName"`
+ Protocol *int `json:"protocol" db:"protocol"`
+ QStringIgnore *int `json:"qstringIgnore" db:"qstring_ignore"`
+ RangeRequestHandling *int `json:"rangeRequestHandling" db:"range_request_handling"`
+ RegexRemap *string `json:"regexRemap" db:"regex_remap"`
+ RegionalGeoBlocking *bool `json:"regionalGeoBlocking" db:"regional_geo_blocking"`
+ RemapText *string `json:"remapText" db:"remap_text"`
+ RoutingName *string `json:"routingName" db:"routing_name"`
+ Signed bool `json:"signed"`
+ SSLKeyVersion *int `json:"sslKeyVersion" db:"ssl_key_version"`
+ TenantID *int `json:"tenantId" db:"tenant_id"`
+ Type *DSType `json:"type"`
+ TypeID *int `json:"typeId" db:"type"`
+ XMLID *string `json:"xmlId" db:"xml_id"`
+ ExampleURLs []string `json:"exampleURLs"`
}
type DeliveryServiceNullableV12 struct {
@@ -198,13 +199,12 @@ type DeliveryServiceNullableV12 struct {
type DeliveryServiceNullableV13 struct {
DeliveryServiceNullableV12
- AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
- DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
- FQPacingRate *int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
- Tenant *string `json:"tenant,omitempty"`
- TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
- TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
+ DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
+ FQPacingRate *int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
+ Tenant *string `json:"tenant,omitempty"`
+ TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
+ TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
}
// Value implements the driver.Valuer interface
diff --git a/traffic_ops/experimental/server/api/deliveryservices.go b/traffic_ops/experimental/server/api/deliveryservices.go
index 05e21e6..297c7ec 100644
--- a/traffic_ops/experimental/server/api/deliveryservices.go
+++ b/traffic_ops/experimental/server/api/deliveryservices.go
@@ -179,6 +179,7 @@ func postDeliveryservice(payload []byte, db *sqlx.DB) (interface{}, error) {
sqlString += ",dns_bypass_cname"
sqlString += ",tr_request_headers"
sqlString += ",created_at"
+ sqlString += ",anonymous_blocking_enabled"
sqlString += ") VALUES ("
sqlString += ":name"
sqlString += ",:display_name"
@@ -221,6 +222,7 @@ func postDeliveryservice(payload []byte, db *sqlx.DB) (interface{}, error) {
sqlString += ",:dns_bypass_cname"
sqlString += ",:tr_request_headers"
sqlString += ",:created_at"
+ sqlString += ",:anonymous_blocking_enabled"
sqlString += ")"
result, err := db.NamedExec(sqlString, v)
if err != nil {
@@ -288,6 +290,7 @@ func putDeliveryservice(name string, payload []byte, db *sqlx.DB) (interface{},
sqlString += ",dns_bypass_cname = :dns_bypass_cname"
sqlString += ",tr_request_headers = :tr_request_headers"
sqlString += ",created_at = :created_at"
+ sqlString += ",anonymous_blocking_enabled = :anonymous_blocking_enabled"
sqlString += " WHERE name=:name"
result, err := db.NamedExec(sqlString, arg)
if err != nil {
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
index a11b6c1..80d675f 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
@@ -192,7 +192,7 @@ func create(db *sql.DB, cfg config.Config, user *auth.CurrentUser, ds tc.Deliver
commitTx := false
defer dbhelpers.FinishTx(tx, &commitTx)
- resultRows, err := tx.Query(insertQuery(), &ds.Active, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CheckPath, &deepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnabled, &ds.LogsEnabled, &ds.LongD [...]
+ resultRows, err := tx.Query(insertQuery(), &ds.Active, &ds.AnonymousBlockingEnabled, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CheckPath, &deepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnabl [...]
if err != nil {
if pqerr, ok := err.(*pq.Error); ok {
@@ -533,7 +533,7 @@ func update(db *sql.DB, cfg config.Config, user auth.CurrentUser, ds *tc.Deliver
deepCachingType = ds.DeepCachingType.String() // necessary, because DeepCachingType's default needs to insert the string, not "", and Query doesn't call .String().
}
- resultRows, err := tx.Query(updateDSQuery(), &ds.Active, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CheckPath, &deepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnabled, &ds.LogsEnabled, &ds.Lon [...]
+ resultRows, err := tx.Query(updateDSQuery(), &ds.Active, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CheckPath, &deepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnabled, &ds.LogsEnabled, &ds.Lon [...]
if err != nil {
if err, ok := err.(*pq.Error); ok {
@@ -793,7 +793,7 @@ func readGetDeliveryServices(params map[string]string, db *sqlx.DB, user auth.Cu
for rows.Next() {
ds := tc.DeliveryServiceNullableV13{}
cdnDomain := ""
- err := rows.Scan(&ds.Active, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CDNName, &ds.CheckPath, &ds.DeepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.ID, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnabled, &ds.LastUpdated, &ds.LogsEn [...]
+ err := rows.Scan(&ds.Active, &ds.AnonymousBlockingEnabled, &ds.CacheURL, &ds.CCRDNSTTL, &ds.CDNID, &ds.CDNName, &ds.CheckPath, &ds.DeepCachingType, &ds.DisplayName, &ds.DNSBypassCNAME, &ds.DNSBypassIP, &ds.DNSBypassIP6, &ds.DNSBypassTTL, &ds.DSCP, &ds.EdgeHeaderRewrite, &ds.GeoLimitRedirectURL, &ds.GeoLimit, &ds.GeoLimitCountries, &ds.GeoProvider, &ds.GlobalMaxMBPS, &ds.GlobalMaxTPS, &ds.FQPacingRate, &ds.HTTPBypassFQDN, &ds.ID, &ds.InfoURL, &ds.InitialDispersion, &ds.IPV6RoutingEnable [...]
if err != nil {
return nil, []error{fmt.Errorf("getting delivery services: %v", err)}, tc.SystemError
}
@@ -1105,6 +1105,7 @@ func selectQuery() string {
return `
SELECT
ds.active,
+ds.anonymous_blocking_enabled,
ds.cacheurl,
ds.ccr_dns_ttl,
ds.cdn_id,
@@ -1225,8 +1226,9 @@ tenant_id=$45,
tr_request_headers=$46,
tr_response_headers=$47,
type=$48,
-xml_id=$49
-WHERE id=$50
+xml_id=$49,
+anonymous_blocking_enabled=$50
+WHERE id=$51
RETURNING last_updated
`
}
@@ -1235,6 +1237,7 @@ func insertQuery() string {
return `
INSERT INTO deliveryservice (
active,
+anonymous_blocking_enabled,
cacheurl,
ccr_dns_ttl,
cdn_id,
@@ -1285,6 +1288,7 @@ type,
xml_id
)
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49)
+VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50)
RETURNING id, last_updated
`
}
[trafficcontrol] 02/04: moved anonymousBlockingEnabled field to V13
struct; updated test cases to use V13 struct
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit a5eb9ed21141d694aff5954bd6aca6ba94642dee
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Wed Jun 13 16:40:46 2018 -0600
moved anonymousBlockingEnabled field to V13 struct; updated test cases to use V13 struct
---
lib/go-tc/deliveryservices.go | 30 +++++++++++-----------
traffic_ops/client/v13/deliveryservice.go | 16 ++++++------
.../experimental/server/api/deliveryservices.go | 3 ---
.../testing/api/v13/deliveryservices_test.go | 6 ++---
traffic_ops/testing/api/v13/traffic_control.go | 2 +-
5 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index 114d97e..86b1e35 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -26,7 +26,7 @@ const DefaultRoutingName = "cdn"
//
// GetDeliveryServiceResponse is deprecated use DeliveryServicesResponse...
type GetDeliveryServiceResponse struct {
- Response []DeliveryService `json:"response"`
+ Response []DeliveryServiceV13 `json:"response"`
}
// DeliveryServicesResponse ...
@@ -61,7 +61,6 @@ type DeleteDeliveryServiceResponse struct {
// TODO move contents to DeliveryServiceV12, fix references, and remove
type DeliveryService struct {
Active bool `json:"active"`
- AnonymousBlockingEnabled bool `json:"anonymousBlockingEnabled"`
CacheURL string `json:"cacheurl"`
CCRDNSTTL int `json:"ccrDnsTtl"`
CDNID int `json:"cdnId"`
@@ -122,12 +121,13 @@ type DeliveryServiceV12 struct {
type DeliveryServiceV13 struct {
DeliveryServiceV12
- DeepCachingType DeepCachingType `json:"deepCachingType"`
- FQPacingRate int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
- TenantName string `json:"tenantName,omitempty"`
- TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
- TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
+ AnonymousBlockingEnabled bool `json:"anonymousBlockingEnabled"`
+ DeepCachingType DeepCachingType `json:"deepCachingType"`
+ FQPacingRate int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
+ TenantName string `json:"tenantName,omitempty"`
+ TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
+ TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
}
// DeliveryServiceNullable - a version of the deliveryservice that allows for all fields to be null
@@ -136,7 +136,6 @@ type DeliveryServiceNullable struct {
// NOTE: the db: struct tags are used for testing to map to their equivalent database column (if there is one)
//
Active *bool `json:"active" db:"active"`
- AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
CacheURL *string `json:"cacheurl" db:"cacheurl"`
CCRDNSTTL *int `json:"ccrDnsTtl" db:"ccr_dns_ttl"`
CDNID *int `json:"cdnId" db:"cdn_id"`
@@ -199,12 +198,13 @@ type DeliveryServiceNullableV12 struct {
type DeliveryServiceNullableV13 struct {
DeliveryServiceNullableV12
- DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
- FQPacingRate *int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
- Tenant *string `json:"tenant,omitempty"`
- TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
- TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
+ AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
+ DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
+ FQPacingRate *int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
+ Tenant *string `json:"tenant,omitempty"`
+ TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
+ TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
}
// Value implements the driver.Valuer interface
diff --git a/traffic_ops/client/v13/deliveryservice.go b/traffic_ops/client/v13/deliveryservice.go
index 9e5e901..3791f66 100644
--- a/traffic_ops/client/v13/deliveryservice.go
+++ b/traffic_ops/client/v13/deliveryservice.go
@@ -24,12 +24,12 @@ import (
// DeliveryServices gets an array of DeliveryServices
// Deprecated: use GetDeliveryServices
-func (to *Session) DeliveryServices() ([]tc.DeliveryService, error) {
+func (to *Session) DeliveryServices() ([]tc.DeliveryServiceV13, error) {
dses, _, err := to.GetDeliveryServices()
return dses, err
}
-func (to *Session) GetDeliveryServices() ([]tc.DeliveryService, ReqInf, error) {
+func (to *Session) GetDeliveryServices() ([]tc.DeliveryServiceV13, ReqInf, error) {
var data tc.GetDeliveryServiceResponse
reqInf, err := get(to, deliveryServicesEp(), &data)
if err != nil {
@@ -41,12 +41,12 @@ func (to *Session) GetDeliveryServices() ([]tc.DeliveryService, ReqInf, error) {
// DeliveryServicesByServer gets an array of all DeliveryServices with the given server ID assigend.
// Deprecated: use GetDeliveryServicesByServer
-func (to *Session) DeliveryServicesByServer(id int) ([]tc.DeliveryService, error) {
+func (to *Session) DeliveryServicesByServer(id int) ([]tc.DeliveryServiceV13, error) {
dses, _, err := to.GetDeliveryServicesByServer(id)
return dses, err
}
-func (to *Session) GetDeliveryServicesByServer(id int) ([]tc.DeliveryService, ReqInf, error) {
+func (to *Session) GetDeliveryServicesByServer(id int) ([]tc.DeliveryServiceV13, ReqInf, error) {
var data tc.GetDeliveryServiceResponse
reqInf, err := get(to, deliveryServicesByServerEp(strconv.Itoa(id)), &data)
if err != nil {
@@ -58,12 +58,12 @@ func (to *Session) GetDeliveryServicesByServer(id int) ([]tc.DeliveryService, Re
// DeliveryService gets the DeliveryService for the ID it's passed
// Deprecated: use GetDeliveryService
-func (to *Session) DeliveryService(id string) (*tc.DeliveryService, error) {
+func (to *Session) DeliveryService(id string) (*tc.DeliveryServiceV13, error) {
ds, _, err := to.GetDeliveryService(id)
return ds, err
}
-func (to *Session) GetDeliveryService(id string) (*tc.DeliveryService, ReqInf, error) {
+func (to *Session) GetDeliveryService(id string) (*tc.DeliveryServiceV13, ReqInf, error) {
var data tc.GetDeliveryServiceResponse
reqInf, err := get(to, deliveryServiceEp(id), &data)
if err != nil {
@@ -76,7 +76,7 @@ func (to *Session) GetDeliveryService(id string) (*tc.DeliveryService, ReqInf, e
}
// CreateDeliveryService creates the DeliveryService it's passed
-func (to *Session) CreateDeliveryService(ds *tc.DeliveryService) (*tc.CreateDeliveryServiceResponse, error) {
+func (to *Session) CreateDeliveryService(ds *tc.DeliveryServiceV13) (*tc.CreateDeliveryServiceResponse, error) {
var data tc.CreateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
@@ -92,7 +92,7 @@ func (to *Session) CreateDeliveryService(ds *tc.DeliveryService) (*tc.CreateDeli
// UpdateDeliveryService updates the DeliveryService matching the ID it's passed with
// the DeliveryService it is passed
-func (to *Session) UpdateDeliveryService(id string, ds *tc.DeliveryService) (*tc.UpdateDeliveryServiceResponse, error) {
+func (to *Session) UpdateDeliveryService(id string, ds *tc.DeliveryServiceV13) (*tc.UpdateDeliveryServiceResponse, error) {
var data tc.UpdateDeliveryServiceResponse
jsonReq, err := json.Marshal(ds)
if err != nil {
diff --git a/traffic_ops/experimental/server/api/deliveryservices.go b/traffic_ops/experimental/server/api/deliveryservices.go
index 297c7ec..05e21e6 100644
--- a/traffic_ops/experimental/server/api/deliveryservices.go
+++ b/traffic_ops/experimental/server/api/deliveryservices.go
@@ -179,7 +179,6 @@ func postDeliveryservice(payload []byte, db *sqlx.DB) (interface{}, error) {
sqlString += ",dns_bypass_cname"
sqlString += ",tr_request_headers"
sqlString += ",created_at"
- sqlString += ",anonymous_blocking_enabled"
sqlString += ") VALUES ("
sqlString += ":name"
sqlString += ",:display_name"
@@ -222,7 +221,6 @@ func postDeliveryservice(payload []byte, db *sqlx.DB) (interface{}, error) {
sqlString += ",:dns_bypass_cname"
sqlString += ",:tr_request_headers"
sqlString += ",:created_at"
- sqlString += ",:anonymous_blocking_enabled"
sqlString += ")"
result, err := db.NamedExec(sqlString, v)
if err != nil {
@@ -290,7 +288,6 @@ func putDeliveryservice(name string, payload []byte, db *sqlx.DB) (interface{},
sqlString += ",dns_bypass_cname = :dns_bypass_cname"
sqlString += ",tr_request_headers = :tr_request_headers"
sqlString += ",created_at = :created_at"
- sqlString += ",anonymous_blocking_enabled = :anonymous_blocking_enabled"
sqlString += " WHERE name=:name"
result, err := db.NamedExec(sqlString, arg)
if err != nil {
diff --git a/traffic_ops/testing/api/v13/deliveryservices_test.go b/traffic_ops/testing/api/v13/deliveryservices_test.go
index d28da8e..32e43d0 100644
--- a/traffic_ops/testing/api/v13/deliveryservices_test.go
+++ b/traffic_ops/testing/api/v13/deliveryservices_test.go
@@ -113,7 +113,7 @@ func GetTestDeliveryServices(t *testing.T) {
t.Fatalf("cannot GET DeliveryServices: %v - %v\n", err, actualDSes)
failed = true
}
- actualDSMap := map[string]tc.DeliveryService{}
+ actualDSMap := map[string]tc.DeliveryServiceV13{}
for _, ds := range actualDSes {
actualDSMap[ds.XMLID] = ds
}
@@ -138,7 +138,7 @@ func UpdateTestDeliveryServices(t *testing.T) {
t.Fatalf("cannot GET Delivery Services: %v\n", err)
}
- remoteDS := tc.DeliveryService{}
+ remoteDS := tc.DeliveryServiceV13{}
found := false
for _, ds := range dses {
if ds.XMLID == firstDS.XMLID {
@@ -190,7 +190,7 @@ func DeleteTestDeliveryServices(t *testing.T) {
t.Fatalf("cannot GET Servers: %v\n", err)
}
for _, testDS := range testData.DeliveryServices {
- ds := tc.DeliveryService{}
+ ds := tc.DeliveryServiceV13{}
found := false
for _, realDS := range dses {
if realDS.XMLID == testDS.XMLID {
diff --git a/traffic_ops/testing/api/v13/traffic_control.go b/traffic_ops/testing/api/v13/traffic_control.go
index e456597..8395998 100644
--- a/traffic_ops/testing/api/v13/traffic_control.go
+++ b/traffic_ops/testing/api/v13/traffic_control.go
@@ -27,7 +27,7 @@ type TrafficControl struct {
CacheGroups []v13.CacheGroup `json:"cachegroups"`
DeliveryServiceRequests []v12.DeliveryServiceRequest `json:"deliveryServiceRequests"`
DeliveryServiceRequestComments []v12.DeliveryServiceRequestComment `json:"deliveryServiceRequestComments"`
- DeliveryServices []v12.DeliveryService `json:"deliveryservices"`
+ DeliveryServices []v12.DeliveryServiceV13 `json:"deliveryservices"`
Divisions []v12.Division `json:"divisions"`
Coordinates []v13.Coordinate `json:"coordinates"`
Origins []v13.Origin `json:"origins"`
[trafficcontrol] 04/04: resolving dsv13 merge conflicts
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 8d2de9b43fed2696108743bead8ca3882b7bcecf
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Thu Jun 14 13:18:46 2018 -0600
resolving dsv13 merge conflicts
---
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go | 1 -
1 file changed, 1 deletion(-)
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
index 80d675f..81707c8 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
@@ -1287,7 +1287,6 @@ tr_response_headers,
type,
xml_id
)
-VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49)
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50)
RETURNING id, last_updated
`
[trafficcontrol] 03/04: restored anonymousBlockingEnabled in
DeliveryServiceV12 structs
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 396e3f8d6fd8a66ee0badad7da93d1bc3a2f141f
Author: Jesse Rivas <je...@comcast.com>
AuthorDate: Thu Jun 14 11:18:23 2018 -0600
restored anonymousBlockingEnabled in DeliveryServiceV12 structs
---
lib/go-tc/deliveryservices.go | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/go-tc/deliveryservices.go b/lib/go-tc/deliveryservices.go
index 86b1e35..8b556e9 100644
--- a/lib/go-tc/deliveryservices.go
+++ b/lib/go-tc/deliveryservices.go
@@ -61,6 +61,7 @@ type DeleteDeliveryServiceResponse struct {
// TODO move contents to DeliveryServiceV12, fix references, and remove
type DeliveryService struct {
Active bool `json:"active"`
+ AnonymousBlockingEnabled bool `json:"anonymousBlockingEnabled"`
CacheURL string `json:"cacheurl"`
CCRDNSTTL int `json:"ccrDnsTtl"`
CDNID int `json:"cdnId"`
@@ -121,13 +122,12 @@ type DeliveryServiceV12 struct {
type DeliveryServiceV13 struct {
DeliveryServiceV12
- AnonymousBlockingEnabled bool `json:"anonymousBlockingEnabled"`
- DeepCachingType DeepCachingType `json:"deepCachingType"`
- FQPacingRate int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
- TenantName string `json:"tenantName,omitempty"`
- TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
- TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
+ DeepCachingType DeepCachingType `json:"deepCachingType"`
+ FQPacingRate int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm string `json:"signingAlgorithm" db:"signing_algorithm"`
+ TenantName string `json:"tenantName,omitempty"`
+ TRRequestHeaders string `json:"trRequestHeaders,omitempty"`
+ TRResponseHeaders string `json:"trResponseHeaders,omitempty"`
}
// DeliveryServiceNullable - a version of the deliveryservice that allows for all fields to be null
@@ -136,6 +136,7 @@ type DeliveryServiceNullable struct {
// NOTE: the db: struct tags are used for testing to map to their equivalent database column (if there is one)
//
Active *bool `json:"active" db:"active"`
+ AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
CacheURL *string `json:"cacheurl" db:"cacheurl"`
CCRDNSTTL *int `json:"ccrDnsTtl" db:"ccr_dns_ttl"`
CDNID *int `json:"cdnId" db:"cdn_id"`
@@ -198,13 +199,12 @@ type DeliveryServiceNullableV12 struct {
type DeliveryServiceNullableV13 struct {
DeliveryServiceNullableV12
- AnonymousBlockingEnabled *bool `json:"anonymousBlockingEnabled" db:"anonymous_blocking_enabled"`
- DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
- FQPacingRate *int `json:"fqPacingRate,omitempty"`
- SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
- Tenant *string `json:"tenant,omitempty"`
- TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
- TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
+ DeepCachingType *DeepCachingType `json:"deepCachingType" db:"deep_caching_type"`
+ FQPacingRate *int `json:"fqPacingRate,omitempty"`
+ SigningAlgorithm *string `json:"signingAlgorithm" db:"signing_algorithm"`
+ Tenant *string `json:"tenant,omitempty"`
+ TRResponseHeaders *string `json:"trResponseHeaders,omitempty"`
+ TRRequestHeaders *string `json:"trRequestHeaders,omitempty"`
}
// Value implements the driver.Valuer interface