8000 Add support for file_max_bytes configuration for azure logging endpoint by kellymclaughlin · Pull Request #251 · fastly/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for file_max_bytes configuration for azure logging endpoint #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
4 changes: 4 additions & 0 deletions pkg/app/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2430,6 +2430,8 @@ COMMANDS
--public-key=PUBLIC-KEY A PGP public key that Fastly will use to
encrypt your log files before writing them to
disk
--file-max-bytes=FILE-MAX-BYTES
The maximum size of a log file in bytes

logging azureblob list --version=VERSION [<flags>]
List Azure Blob Storage logging endpoints on a Fastly service version
Expand Down Expand Up @@ -2491,6 +2493,8 @@ COMMANDS
--public-key=PUBLIC-KEY A PGP public key that Fastly will use to
encrypt your log files before writing them to
disk
--file-max-bytes=FILE-MAX-BYTES
The maximum size of a log file in bytes

logging azureblob delete --version=VERSION --name=NAME [<flags>]
Delete an Azure Blob Storage logging endpoint on a Fastly service version
Expand Down
3 changes: 3 additions & 0 deletions pkg/logging/azureblob/azureblob_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ Version: 1
Timestamp format: %Y-%m-%dT%H:%M:%S.000
Placement: none
Public key: `+pgpPublicKey()+`
File max bytes: 0
BlobStorage 2/2
Service ID: 123
Version: 1
Expand All @@ -364,6 +365,7 @@ Version: 1
Timestamp format: %Y-%m-%dT%H:%M:%S.000
Placement: none
Public key: `+pgpPublicKey()+`
File max bytes: 0
`) + "\n\n"

func getBlobStorageOK(i *fastly.GetBlobStorageInput) (*fastly.BlobStorage, error) {
Expand Down Expand Up @@ -408,6 +410,7 @@ Message type: classic
Timestamp format: %Y-%m-%dT%H:%M:%S.000
Placement: none
Public key: `+pgpPublicKey()+`
File max bytes: 0
`) + "\n"

func updateBlobStorageOK(i *fastly.UpdateBlobStorageInput) (*fastly.BlobStorage, error) {
Expand Down
6 changes: 6 additions & 0 deletions pkg/logging/azureblob/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type CreateCommand struct {
TimestampFormat common.OptionalString
Placement common.OptionalString
PublicKey common.OptionalString
FileMaxBytes common.OptionalUint
}

// NewCreateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -61,6 +62,7 @@ func NewCreateCommand(parent common.Registerer, globals *config.Data) *CreateCom
c.CmdClause.Flag("timestamp-format", `strftime specified timestamp formatting (default "%Y-%m-%dT%H:%M:%S.000")`).Action(c.TimestampFormat.Set).StringVar(&c.TimestampFormat.Value)
c.CmdClause.Flag("placement", "Where in the generated VCL the logging call should be placed, overriding any format_version default. Can be none or waf_debug").Action(c.Placement.Set).StringVar(&c.Placement.Value)
c.CmdClause.Flag("public-key", "A PGP public key that Fastly will use to encrypt your log files before writing them to disk").Action(c.PublicKey.Set).StringVar(&c.PublicKey.Value)
c.CmdClause.Flag("file-max-bytes", "The maximum size of a log file in bytes").Action(c.FileMaxBytes.Set).UintVar(&c.FileMaxBytes.Value)

return &c
}
Expand Down Expand Up @@ -121,6 +123,10 @@ func (c *CreateCommand) createInput() (*fastly.CreateBlobStorageInput, error) {
input.PublicKey = c.PublicKey.Value
}

if c.FileMaxBytes.WasSet {
input.FileMaxBytes = c.FileMaxBytes.Value
}

return &input, nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/logging/azureblob/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error {
fmt.Fprintf(out, "Timestamp format: %s\n", azureblob.TimestampFormat)
fmt.Fprintf(out, "Placement: %s\n", azureblob.Placement)
fmt.Fprintf(out, "Public key: %s\n", azureblob.PublicKey)
fmt.Fprintf(out, "File max bytes: %d\n", azureblob.FileMaxBytes)

return nil
}
1 change: 1 addition & 0 deletions pkg/logging/azureblob/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (c *ListCommand) Exec(in io.Reader, out io.Writer) error {
fmt.Fprintf(out, "\t\tTimestamp format: %s\n", azureblob.TimestampFormat)
fmt.Fprintf(out, "\t\tPlacement: %s\n", azureblob.Placement)
fmt.Fprintf(out, "\t\tPublic key: %s\n", azureblob.PublicKey)
fmt.Fprintf(out, "\t\tFile max bytes: %d\n", azureblob.FileMaxBytes)
}
fmt.Fprintln(out)

Expand Down
7 changes: 7 additions & 0 deletions pkg/logging/azureblob/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type UpdateCommand struct {
TimestampFormat common.OptionalString
Placement common.OptionalString
PublicKey common.OptionalString
FileMaxBytes common.OptionalUint
}

// NewUpdateCommand returns a usable command registered under the parent.
Expand Down Expand Up @@ -64,6 +65,7 @@ func NewUpdateCommand(parent common.Registerer, globals *config.Data) *UpdateCom
c.CmdClause.Flag("timestamp-format", `strftime specified timestamp formatting (default "%Y-%m-%dT%H:%M:%S.000")`).Action(c.TimestampFormat.Set).StringVar(&c.TimestampFormat.Value)
c.CmdClause.Flag("placement", "Where in the generated VCL the logging call should be placed, overriding any format_version default. Can be none or waf_debug").Action(c.Placement.Set).StringVar(&c.Placement.Value)
c.CmdClause.Flag("public-key", "A PGP public key that Fastly will use to encrypt your log files before writing them to disk").Action(c.PublicKey.Set).StringVar(&c.PublicKey.Value)
c.CmdClause.Flag("file-max-bytes", "The maximum size of a log file in bytes").Action(c.FileMaxBytes.Set).UintVar(&c.FileMaxBytes.Value)

return &c
}
Expand All @@ -81,6 +83,7 @@ func (c *UpdateCommand) createInput() (*fastly.UpdateBlobStorageInput, error) {
Name: c.EndpointName,
}

// Set new values if set by user.
if c.NewName.WasSet {
input.NewName = fastly.String(c.NewName.Value)
}
Expand Down Expand Up @@ -137,6 +140,10 @@ func (c *UpdateCommand) createInput() (*fastly.UpdateBlobStorageInput, error) {
input.PublicKey = fastly.String(c.PublicKey.Value)
}

if c.FileMaxBytes.WasSet {
input.FileMaxBytes = fastly.Uint(c.FileMaxBytes.Value)
}

return &input, nil
}

Expand Down
0