Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kellymclaughlin
Copy link
Contributor

No description provided.

@Integralist Integralist added the enhancement New feature or request label Jun 15, 2023
@Integralist Integralist changed the title Add support for file_max_bytes field to s3 logging endpoint feat(logging/s3): add --file-max-bytes flag Jun 15, 2023
input.Domain = &c.Domain.Value
}

if c.FileMaxBytes.WasSet {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the related Terraform PR: is this safe to send 0 to the API?

If yes, then nothing more to do here.

If no, then we could either add && c.FileMaxBytes.Value > 0 to the condition, or check the value is == 0 within the if block and return an error notifying the user that the input was unexpected.

lines := text.Lines{
"Bucket": o.BucketName,
"Compression codec": o.CompressionCodec,
"File max bytes": o.FileMaxBytes,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the API always return the file_max_bytes field?

If no, then I'm wondering if the go-fastly implementation will cause a zero value (i.e. 0) to be set on the FileMaxBytes response field. In that case we don't want to show File max bytes: 0 in the CLI output (as demonstrated in your test file changes) because that's misleading the user into thinking something has gone wrong and that they won't be able to have any logs uploaded to S3.

So in that case I think we should only print the values here (and in the list file below) if the value is > 0.

This value could be 0 because the API didn't return the field

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my comment. Based on your feedback in the associated Terraform PR it seems the API understands 0 to mean "no size limit" and that's fine as I'm going to presume the API will always send a value for this if it was set and if it's not set it would default to zero.

@Integralist Integralist merged commit ca84b38 into fastly:main Jun 15, 2023
@kellymclaughlin kellymclaughlin deleted the kellym/LOG-1803 branch June 15, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants