Skip to content
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

feat: add s3 batch result code constants #302

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

moofish32
Copy link

This adds constants and a type for S3 Batch Result Codes similar to what
is available for CodeBuild results

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2020

Codecov Report

Merging #302 into master will decrease coverage by 2.14%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #302      +/-   ##
==========================================
- Coverage   74.60%   72.46%   -2.15%     
==========================================
  Files          13       18       +5     
  Lines         638      730      +92     
==========================================
+ Hits          476      529      +53     
- Misses        123      136      +13     
- Partials       39       65      +26     
Impacted Files Coverage Δ
events/epoch_time.go 77.77% <0.00%> (-4.05%) ⬇️
events/cloudwatch_logs.go 60.00% <0.00%> (-3.64%) ⬇️
events/attributevalue.go 80.32% <0.00%> (-2.44%) ⬇️
lambda/panic.go 87.87% <0.00%> (-2.13%) ⬇️
events/duration.go 42.85% <0.00%> (-1.59%) ⬇️
events/code_commit.go 26.08% <0.00%> (-1.50%) ⬇️
events/codebuild.go 44.44% <0.00%> (-1.02%) ⬇️
lambda/handler.go 96.92% <0.00%> (-0.22%) ⬇️
events/lex.go 0.00% <0.00%> (ø)
lambda/rpc.go 55.55% <0.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26aa364...9e771cc. Read the comment docs.

ResultCode string `json:"resultCode"`
ResultString string `json:"resultString"`
TaskID string `json:"taskId"`
ResultCode S3BatchJobResultCode `json:"resultCode"`
Copy link
Collaborator

@bmoffatt bmoffatt Oct 3, 2020

Choose a reason for hiding this comment

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

I think adding the type creates a breaking change. Assignment to a string will require a type cast

ex: https://play.golang.org/p/T5G1eKtbBor

I think leaving the type as string is fine

// S3BatchJobResultCode represents the result of an S3BatchJobTask (i.e.
// succeeded, permanent failure, or temmporary failure)
const (
S3BatchJobResultCodeSucceeded S3BatchJobResultCode = "Succeeded"
Copy link
Collaborator

Choose a reason for hiding this comment

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

downside of changing S3BatchJobResult.ResultCode type back to string, is that comparisons against this new type require a cast!

if inputEvent.Results[0].ResultCode == S3BatchJobResultCodeSucceeded {
  // ..
}

->

Invalid operation: inputEvent.Results[0].ResultCode == S3BatchJobResultCodeSucceeded (mismatched types string and S3BatchJobResultCode)

Instead, go back to having S3BatchJobResult being a S3BatchJobResultCode. It is useful for self documentation purposes. But also change the type to be a type alias eg: type S3BatchJobResultCoce = string - this will preserve backwards compatibility.

@bmoffatt bmoffatt added the type/events issue or feature request related to the events package label Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/events issue or feature request related to the events package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants