Skip to content
Draft
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
10 changes: 10 additions & 0 deletions pkg/commands/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ var listBackendsJSONOutput = strings.TrimSpace(`
"Hostname": null,
"KeepAliveTime": null,
"MaxConn": null,
"MaxUse": null,
"MaxLifetime": null,
"MaxTLSVersion": null,
"MinTLSVersion": null,
"Name": "test.com",
Expand Down Expand Up @@ -535,6 +537,8 @@ var listBackendsJSONOutput = strings.TrimSpace(`
"Hostname": null,
"KeepAliveTime": null,
"MaxConn": null,
"MaxUse": null,
"MaxLifetime": null,
"MaxTLSVersion": null,
"MinTLSVersion": null,
"Name": "example.com",
Expand Down Expand Up @@ -585,6 +589,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 @@ -614,6 +620,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 @@ -663,6 +671,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/backend/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 @@ -90,6 +92,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 times an HTTP keepalive connection can be used").Action(c.maxUse.Set).IntVar(&c.maxUse.Value)
c.CmdClause.Flag("max-lifetime", "Upper bound in milliseconds for how long an HTTP keepalive connection can be open before it is no longer used").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 @@ -181,6 +185,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/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
12 changes: 12 additions & 0 deletions pkg/commands/backend/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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 @@ -88,6 +90,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 times an HTTP keepalive connection can be used").Action(c.maxUse.Set).IntVar(&c.maxUse.Value)
c.CmdClause.Flag("max-lifetime", "Upper bound in milliseconds for how long an HTTP keepalive connection can be open before it is no longer used").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 @@ -198,6 +202,14 @@ 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 @@
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))

Check failure on line 25 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / lint

b.MaxUse undefined (type *fastly.Backend has no field or method MaxUse)

Check failure on line 25 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, windows-latest)

b.MaxUse undefined (type *fastly.Backend has no field or method MaxUse)

Check failure on line 25 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, ubuntu-latest)

b.MaxUse undefined (type *fastly.Backend has no field or method MaxUse)

Check failure on line 25 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, macos-latest)

b.MaxUse undefined (type *fastly.Backend has no field or method MaxUse)

Check failure on line 25 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / lint-latest (informational)

b.MaxUse undefined (type *fastly.Backend has no field or method MaxUse)
fmt.Fprintf(out, "Max connection lifetime: %v\n", fastly.ToValue(b.MaxLifetime))

Check failure on line 26 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / lint

b.MaxLifetime undefined (type *fastly.Backend has no field or method MaxLifetime) (typecheck)

Check failure on line 26 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, windows-latest)

b.MaxLifetime undefined (type *fastly.Backend has no field or method MaxLifetime)

Check failure on line 26 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, ubuntu-latest)

b.MaxLifetime undefined (type *fastly.Backend has no field or method MaxLifetime)

Check failure on line 26 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / test (0.31.2, 1.24.x, 18, macos-latest)

b.MaxLifetime undefined (type *fastly.Backend has no field or method MaxLifetime)

Check failure on line 26 in pkg/text/backend.go

View workflow job for this annotation

GitHub Actions / lint-latest (informational)

b.MaxLifetime undefined (type *fastly.Backend has no field or method MaxLifetime) (typecheck)
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