Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

### Enhancements:

- feat(service/backend): add support for the `max_use` and `max_lifetime` parameters ([#1779](https://github.com/fastly/cli/pull/1779))

### Dependencies:
- build(deps): `golang.org/x/term` from 0.41.0 to 0.42.0 ([#1726](https://github.com/fastly/cli/pull/1726))
- build(deps): `golang.org/x/crypto` from 0.49.0 to 0.50.0 ([#1726](https://github.com/fastly/cli/pull/1726))
Expand Down
6 changes: 6 additions & 0 deletions pkg/commands/service/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ var listBackendsVerboseOutput = strings.Join([]string{
" Override host: ",
" Connect timeout: 0",
" Max connections: 0",
" Max connection use: 0",
" Max connection lifetime: 0",
" First byte timeout: 0",
" Between bytes timeout: 0",
" Auto loadbalance: false",
Expand Down Expand Up @@ -619,6 +621,8 @@ var listBackendsVerboseOutput = strings.Join([]string{
" Override host: ",
" Connect timeout: 0",
" Max connections: 0",
" Max connection use: 0",
" Max connection lifetime: 0",
" First byte timeout: 0",
" Between bytes timeout: 0",
" Auto loadbalance: false",
Expand Down Expand Up @@ -668,6 +672,8 @@ var describeBackendOutput = strings.Join([]string{
"Override host: ",
"Connect timeout: 0",
"Max connections: 0",
"Max connection use: 0",
"Max connection lifetime: 0",
"First byte timeout: 0",
"Between bytes timeout: 0",
"Auto loadbalance: false",
Expand Down
10 changes: 10 additions & 0 deletions pkg/commands/service/backend/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type CreateCommand struct {
firstByteTimeout argparser.OptionalInt
healthCheck argparser.OptionalString
maxConn argparser.OptionalInt
maxUse argparser.OptionalInt
maxLifetime argparser.OptionalInt
maxTLSVersion argparser.OptionalString
minTLSVersion argparser.OptionalString
name argparser.OptionalString
Expand Down Expand Up @@ -89,6 +91,8 @@ func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateComman
c.CmdClause.Flag("first-byte-timeout", "How long to wait for the first bytes in milliseconds").Action(c.firstByteTimeout.Set).IntVar(&c.firstByteTimeout.Value)
c.CmdClause.Flag("healthcheck", "The name of the healthcheck to use with this backend").Action(c.healthCheck.Set).StringVar(&c.healthCheck.Value)
c.CmdClause.Flag("max-conn", "Maximum number of connections").Action(c.maxConn.Set).IntVar(&c.maxConn.Value)
c.CmdClause.Flag("max-use", "Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited.").Action(c.maxUse.Set).IntVar(&c.maxUse.Value)
c.CmdClause.Flag("max-lifetime", "Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited.").Action(c.maxLifetime.Set).IntVar(&c.maxLifetime.Value)
c.CmdClause.Flag("max-tls-version", "Maximum allowed TLS version on SSL connections to this backend").Action(c.maxTLSVersion.Set).StringVar(&c.maxTLSVersion.Value)
c.CmdClause.Flag("min-tls-version", "Minimum allowed TLS version on SSL connections to this backend").Action(c.minTLSVersion.Set).StringVar(&c.minTLSVersion.Value)
c.CmdClause.Flag("name", "Backend name").Short('n').Action(c.name.Set).StringVar(&c.name.Value)
Expand Down Expand Up @@ -180,6 +184,12 @@ func (c *CreateCommand) Exec(_ io.Reader, out io.Writer) error {
if c.maxConn.WasSet {
input.MaxConn = &c.maxConn.Value
}
if c.maxUse.WasSet {
input.MaxUse = &c.maxUse.Value
}
if c.maxLifetime.WasSet {
input.MaxLifetime = &c.maxLifetime.Value
}
if c.maxTLSVersion.WasSet {
input.MaxTLSVersion = &c.maxTLSVersion.Value
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/commands/service/backend/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (c *DescribeCommand) print(out io.Writer, b *fastly.Backend) error {
fmt.Fprintf(out, "Override host: %v\n", fastly.ToValue(b.OverrideHost))
fmt.Fprintf(out, "Connect timeout: %v\n", fastly.ToValue(b.ConnectTimeout))
fmt.Fprintf(out, "Max connections: %v\n", fastly.ToValue(b.MaxConn))
fmt.Fprintf(out, "Max connection use: %v\n", fastly.ToValue(b.MaxUse))
fmt.Fprintf(out, "Max connection lifetime: %v\n", fastly.ToValue(b.MaxLifetime))
fmt.Fprintf(out, "First byte timeout: %v\n", fastly.ToValue(b.FirstByteTimeout))
fmt.Fprintf(out, "Between bytes timeout: %v\n", fastly.ToValue(b.BetweenBytesTimeout))
fmt.Fprintf(out, "Auto loadbalance: %v\n", fastly.ToValue(b.AutoLoadbalance))
Expand Down
11 changes: 11 additions & 0 deletions pkg/commands/service/backend/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type UpdateCommand struct {
HealthCheck argparser.OptionalString
Hostname argparser.OptionalString
MaxConn argparser.OptionalInt
MaxUse argparser.OptionalInt
MaxLifetime argparser.OptionalInt
MaxTLSVersion argparser.OptionalString
MinTLSVersion argparser.OptionalString
NewName argparser.OptionalString
Expand Down Expand Up @@ -87,6 +89,8 @@ func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateComman
c.CmdClause.Flag("first-byte-timeout", "How long to wait for the first bytes in milliseconds").Action(c.FirstByteTimeout.Set).IntVar(&c.FirstByteTimeout.Value)
c.CmdClause.Flag("healthcheck", "The name of the healthcheck to use with this backend").Action(c.HealthCheck.Set).StringVar(&c.HealthCheck.Value)
c.CmdClause.Flag("max-conn", "Maximum number of connections").Action(c.MaxConn.Set).IntVar(&c.MaxConn.Value)
c.CmdClause.Flag("max-use", "Maximum number of requests allowed over a single, pooled HTTP keepalive connection to this backend; 0 is treated as unlimited.").Action(c.MaxUse.Set).IntVar(&c.MaxUse.Value)
c.CmdClause.Flag("max-lifetime", "Maximum time from creation (in milliseconds) that a pooled HTTP keepalive connection will be eligible for reuse; 0 is treated as unlimited.").Action(c.MaxLifetime.Set).IntVar(&c.MaxLifetime.Value)
c.CmdClause.Flag("max-tls-version", "Maximum allowed TLS version on SSL connections to this backend").Action(c.MaxTLSVersion.Set).StringVar(&c.MaxTLSVersion.Value)
c.CmdClause.Flag("min-tls-version", "Minimum allowed TLS version on SSL connections to this backend").Action(c.MinTLSVersion.Set).StringVar(&c.MinTLSVersion.Value)
c.CmdClause.Flag("new-name", "New backend name").Action(c.NewName.Set).StringVar(&c.NewName.Value)
Expand Down Expand Up @@ -189,6 +193,13 @@ func (c *UpdateCommand) Exec(_ io.Reader, out io.Writer) error {
input.MaxConn = &c.MaxConn.Value
}

if c.MaxUse.WasSet {
input.MaxUse = &c.MaxUse.Value
}
if c.MaxLifetime.WasSet {
input.MaxLifetime = &c.MaxLifetime.Value
}

if c.FirstByteTimeout.WasSet {
input.FirstByteTimeout = &c.FirstByteTimeout.Value
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/text/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func PrintBackend(out io.Writer, prefix string, b *fastly.Backend) {
fmt.Fprintf(out, "Override host: %v\n", fastly.ToValue(b.OverrideHost))
fmt.Fprintf(out, "Connect timeout: %v\n", fastly.ToValue(b.ConnectTimeout))
fmt.Fprintf(out, "Max connections: %v\n", fastly.ToValue(b.MaxConn))
fmt.Fprintf(out, "Max connection use: %v\n", fastly.ToValue(b.MaxUse))
fmt.Fprintf(out, "Max connection lifetime: %v\n", fastly.ToValue(b.MaxLifetime))
fmt.Fprintf(out, "First byte timeout: %v\n", fastly.ToValue(b.FirstByteTimeout))
fmt.Fprintf(out, "Between bytes timeout: %v\n", fastly.ToValue(b.BetweenBytesTimeout))
fmt.Fprintf(out, "Auto loadbalance: %v\n", fastly.ToValue(b.AutoLoadbalance))
Expand Down
Loading