From 8dcc3b224f7f61fc145f5d19d748082c34a873a7 Mon Sep 17 00:00:00 2001 From: Integralist Date: Fri, 31 Mar 2023 17:27:32 +0100 Subject: [PATCH 1/2] build(dependencies): bump go-fastly to latest v7.5.5 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 36eabf98d..2b53c7611 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( ) require ( - github.com/fastly/go-fastly/v7 v7.5.2 + github.com/fastly/go-fastly/v7 v7.5.5 github.com/kennygrant/sanitize v1.2.4 github.com/mholt/archiver v3.1.1+incompatible github.com/otiai10/copy v1.9.0 diff --git a/go.sum b/go.sum index 74a7e5a41..26ffd382b 100644 --- a/go.sum +++ b/go.sum @@ -18,8 +18,8 @@ github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj6 github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 h1:90Ly+6UfUypEF6vvvW5rQIv9opIL8CbmW9FT20LDQoY= github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0/go.mod h1:V+Qd57rJe8gd4eiGzZyg4h54VLHmYVVw54iMnlAMrF8= -github.com/fastly/go-fastly/v7 v7.5.2 h1:6TfHEScwdP3ErhAZRcsh7VC55W1ssBML/nwvKWvOMOc= -github.com/fastly/go-fastly/v7 v7.5.2/go.mod h1:/Z2GD7NuxV3vVMAyrtckg1WvZVnCuM2Z8ok/z70XTEQ= +github.com/fastly/go-fastly/v7 v7.5.5 h1:M3ePbU6a8BTPZzjaPoU4+O+pQspiBalF5HgVNomHlJI= +github.com/fastly/go-fastly/v7 v7.5.5/go.mod h1:/Z2GD7NuxV3vVMAyrtckg1WvZVnCuM2Z8ok/z70XTEQ= github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:FhrXlfhgGCS+uc6YwyiFUt04alnjpoX7vgDKJxS6Qbk= github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c= github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= From c2d2219e86c3f8934dc1a20f2a93c231cfaeeae4 Mon Sep 17 00:00:00 2001 From: Integralist Date: Fri, 31 Mar 2023 17:47:16 +0100 Subject: [PATCH 2/2] feat(ratelimiter): add uri-dict-name flag --- pkg/commands/ratelimit/create.go | 6 ++++++ pkg/commands/ratelimit/update.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/commands/ratelimit/create.go b/pkg/commands/ratelimit/create.go index 8108906d5..48938244d 100644 --- a/pkg/commands/ratelimit/create.go +++ b/pkg/commands/ratelimit/create.go @@ -91,6 +91,7 @@ func NewCreateCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *C Description: cmd.FlagServiceDesc, Dst: &c.serviceName.Value, }) + c.CmdClause.Flag("uri-dict-name", "The name of an Edge Dictionary containing URIs as keys").StringVar(&c.uriDictName) c.CmdClause.Flag("window-size", "Number of seconds during which the RPS limit must be exceeded in order to trigger a violation").HintOptions(rateLimitWindowSizeFlagOpts...).EnumVar(&c.windowSize, rateLimitWindowSizeFlagOpts...) return &c @@ -117,6 +118,7 @@ type CreateCommand struct { rpsLimit int serviceName cmd.OptionalServiceNameID serviceVersion cmd.OptionalServiceVersion + uriDictName string windowSize string } @@ -236,6 +238,10 @@ func (c *CreateCommand) constructInput() *fastly.CreateERLInput { input.RpsLimit = fastly.Int(c.rpsLimit) } + if c.uriDictName != "" { + input.URIDictionaryName = fastly.String(c.uriDictName) + } + if c.windowSize != "" { for _, w := range fastly.ERLWindowSizes { if c.windowSize == fmt.Sprint(w) { diff --git a/pkg/commands/ratelimit/update.go b/pkg/commands/ratelimit/update.go index 5dd0e9659..1c4325a1d 100644 --- a/pkg/commands/ratelimit/update.go +++ b/pkg/commands/ratelimit/update.go @@ -43,6 +43,7 @@ func NewUpdateCommand(parent cmd.Registerer, g *global.Data, m manifest.Data) *U c.CmdClause.Flag("response-object-name", "Name of existing response object. Required if action is response_object").StringVar(&c.responseObjectName) c.CmdClause.Flag("response-status", "HTTP response status code (e.g. 429)").IntVar(&c.responseStatus) c.CmdClause.Flag("rps-limit", "Upper limit of requests per second allowed by the rate limiter").IntVar(&c.rpsLimit) + c.CmdClause.Flag("uri-dict-name", "The name of an Edge Dictionary containing URIs as keys").StringVar(&c.uriDictName) c.CmdClause.Flag("window-size", "Number of seconds during which the RPS limit must be exceeded in order to trigger a violation").HintOptions(rateLimitWindowSizeFlagOpts...).EnumVar(&c.windowSize, rateLimitWindowSizeFlagOpts...) return &c @@ -67,6 +68,7 @@ type UpdateCommand struct { responseObjectName string responseStatus int rpsLimit int + uriDictName string windowSize string } @@ -167,6 +169,10 @@ func (c *UpdateCommand) constructInput() *fastly.UpdateERLInput { input.RpsLimit = fastly.Int(c.rpsLimit) } + if c.uriDictName != "" { + input.URIDictionaryName = fastly.String(c.uriDictName) + } + // NOTE: rateLimitWindowSizes is defined in ./create.go if c.windowSize != "" { for _, w := range fastly.ERLWindowSizes {