Skip to content

Commit

Permalink
Move deprecated constants back, as the staticcheck does not approve
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Klijn <[email protected]>
  • Loading branch information
peterklijn committed Aug 13, 2021
1 parent 9cc68a1 commit 8d2e3c0
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 21 deletions.
7 changes: 6 additions & 1 deletion filters/accesslog/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import (
"github.com/zalando/skipper/filters"
)

const (
// Deprecated: use DisableAccessLogName or EnableAccessLogName
AccessLogDisabledName = "accessLogDisabled"
)

type accessLogDisabled struct {
disabled bool
}
Expand All @@ -16,7 +21,7 @@ func NewAccessLogDisabled() filters.Spec {
return &accessLogDisabled{}
}

func (*accessLogDisabled) Name() string { return filters.AccessLogDisabledName }
func (*accessLogDisabled) Name() string { return AccessLogDisabledName }

func (*accessLogDisabled) CreateFilter(args []interface{}) (filters.Filter, error) {
if len(args) != 1 {
Expand Down
11 changes: 11 additions & 0 deletions filters/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ import (
"github.com/zalando/skipper/script"
)

const (
// Deprecated: use setRequestHeader or appendRequestHeader
RequestHeaderName = "requestHeader"

// Deprecated: use setResponseHeader or appendResponseHeader
ResponseHeaderName = "responseHeader"

// Deprecated: use redirectTo
RedirectName = "redirect"
)

// Returns a Registry object initialized with the default set of filter
// specifications found in the filters package. (including the builtin
// and the flowid subdirectories.)
Expand Down
4 changes: 2 additions & 2 deletions filters/builtin/headerfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ func (spec *headerFilter) Name() string {
case dropResponseHeader:
return filters.DropResponseHeaderName
case depRequestHeader:
return filters.RequestHeaderName
return RequestHeaderName
case depResponseHeader:
return filters.ResponseHeaderName
return ResponseHeaderName
case setContextRequestHeader:
return filters.SetContextRequestHeaderName
case appendContextRequestHeader:
Expand Down
2 changes: 1 addition & 1 deletion filters/builtin/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewRedirectLower() filters.Spec { return &redirect{typ: redToLower} }
func (spec *redirect) Name() string {
switch spec.typ {
case redDeprecated:
return filters.RedirectName
return RedirectName
case redToLower:
return filters.RedirectToLowerName
default:
Expand Down
2 changes: 1 addition & 1 deletion filters/builtin/redirect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestRedirect(t *testing.T) {
name string
}{{
"deprecated",
filters.RedirectName,
RedirectName,
}, {
"not deprecated",
filters.RedirectToName,
Expand Down
13 changes: 0 additions & 13 deletions filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,6 @@ const (
ConsistentHashKeyName = "consistentHashKey"
ConsistentHashBalanceFactorName = "consistentHashBalanceFactor"

// Deprecated: use setRequestHeader or appendRequestHeader
RequestHeaderName = "requestHeader"
// Deprecated: use setResponseHeader or appendResponseHeader
ResponseHeaderName = "responseHeader"
// Deprecated: use redirectTo
RedirectName = "redirect"
// Deprecated: use ClientRatelimitName instead
LocalRatelimitName = "localRatelimit"
// Deprecated: use DisableAccessLogName or EnableAccessLogName
AccessLogDisabledName = "accessLogDisabled"
// Deprecated: use TeeName
DeprecatedTeeName = "Tee"

// Undocumented filters
HealthCheckName = "healthcheck"
SetFastCgiFilenameName = "setFastCgiFilename"
Expand Down
2 changes: 1 addition & 1 deletion filters/ratelimit/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewRatelimitProvider(registry *ratelimit.Registry) RatelimitProvider {

// NewLocalRatelimit is *DEPRECATED*, use NewClientRatelimit, instead
func NewLocalRatelimit(provider RatelimitProvider) filters.Spec {
return &spec{typ: ratelimit.LocalRatelimit, provider: provider, filterName: filters.LocalRatelimitName}
return &spec{typ: ratelimit.LocalRatelimit, provider: provider, filterName: ratelimit.LocalRatelimitName}
}

// NewClientRatelimit creates a instance based client rate limit. If
Expand Down
7 changes: 6 additions & 1 deletion filters/tee/tee.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
"github.com/zalando/skipper/filters"
)

const (
// Deprecated: use TeeName
DeprecatedTeeName = "Tee"
)

const defaultTeeTimeout = time.Second

type teeSpec struct {
Expand Down Expand Up @@ -269,7 +274,7 @@ func (spec *teeSpec) CreateFilter(config []interface{}) (filters.Filter, error)

func (spec *teeSpec) Name() string {
if spec.deprecated {
return filters.DeprecatedTeeName
return DeprecatedTeeName
}
if spec.options.NoFollow {
return filters.TeenfName
Expand Down
5 changes: 4 additions & 1 deletion ratelimit/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const (
// RetryHeader is name of the header which will be used to indicate how
// long a client should wait before making a new request
RetryAfterHeader = "Retry-After"

// LocalRatelimitName *DEPRECATED*, use ClientRatelimitName instead
LocalRatelimitName = "localRatelimit"
)

// RatelimitType defines the type of the used ratelimit
Expand Down Expand Up @@ -117,7 +120,7 @@ func (rt RatelimitType) String() string {
case ClusterServiceRatelimit:
return filters.ClusterRatelimitName
case LocalRatelimit:
return filters.LocalRatelimitName
return LocalRatelimitName
case ServiceRatelimit:
return filters.RatelimitName
default:
Expand Down

0 comments on commit 8d2e3c0

Please sign in to comment.