Skip to content
Open
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
12 changes: 12 additions & 0 deletions events/s3_batch_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

package events

// S3BatchJobResultCode represents the result of an S3BatchJobTask (i.e.
// succeeded, permanent failure, or temmporary failure)
type S3BatchJobResultCode string

// 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.

S3BatchJobResultCodeTemporaryFailure S3BatchJobResultCode = "TemporaryFailure"
S3BatchJobResultCodePermanentFailure S3BatchJobResultCode = "PermanentFailure"
)

// S3BatchJobEvent encapsulates the detail of a s3 batch job
type S3BatchJobEvent struct {
InvocationSchemaVersion string `json:"invocationSchemaVersion"`
Expand Down