From 527f5d301d2993af078be6d0b63372786b3fc18f Mon Sep 17 00:00:00 2001 From: Stanislas Nanchen <240862+stanislas@users.noreply.github.com> Date: Sun, 20 Jan 2019 00:36:28 +0100 Subject: [PATCH] add a CustomData field to the CodeCommitRecord structure. (#160) --- events/code_commit.go | 5 +++-- events/code_commit_test.go | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/events/code_commit.go b/events/code_commit.go index 47eefa66..e8672ba3 100644 --- a/events/code_commit.go +++ b/events/code_commit.go @@ -58,6 +58,7 @@ type CodeCommitRecord struct { EventSource string `json:"eventSource"` AWSRegion string `json:"awsRegion"` EventTotalParts uint64 `json:"eventTotalParts"` + CustomData string `json:"customData,omitempty"` } // String returns a string representation of this object. @@ -67,11 +68,11 @@ func (r CodeCommitRecord) String() string { "{eventId: %v, eventVersion: %v, eventTime: %v, eventTriggerName: %v, "+ "eventPartNumber: %v, codeCommit: %v, eventName: %v, "+ "eventTriggerConfigId: %v, eventSourceARN: %v, userIdentityARN: %v, "+ - "eventSource: %v, awsRegion: %v, eventTotalParts: %v}", + "eventSource: %v, awsRegion: %v, eventTotalParts: %v, customData: %v}", r.EventID, r.EventVersion, r.EventTime, r.EventTriggerName, r.EventPartNumber, r.CodeCommit, r.EventName, r.EventTriggerConfigId, r.EventSourceARN, r.UserIdentityARN, - r.EventSource, r.AWSRegion, r.EventTotalParts) + r.EventSource, r.AWSRegion, r.EventTotalParts, r.CustomData) } // CodeCommitCodeCommit represents a CodeCommit object in a record diff --git a/events/code_commit_test.go b/events/code_commit_test.go index eedfa068..6945dcbb 100644 --- a/events/code_commit_test.go +++ b/events/code_commit_test.go @@ -100,6 +100,29 @@ func TestCodeCommitRecord(t *testing.T) { "awsRegion": "us-east-1", "eventTotalParts": 1 } + `), + }, + { + Name: "CodeCommitRecord", + Input: []byte(` + { + "eventId": "5a824061-17ca-46a9-bbf9-114edeadbeee", + "eventVersion": "1.0", + "eventTime": "2018-01-22T15:58:33.475+0000", + "eventTriggerName": "my-trigger", + "eventPartNumber": 1, + "codecommit": { + "references": [] + }, + "eventName": "TriggerEventTest", + "eventTriggerConfigId": "5a824061-17ca-46a9-bbf9-114edeadbeef", + "eventSourceARN": "arn:aws:codecommit:us-east-1:123456789012:my-repo", + "userIdentityARN": "arn:aws:iam::123456789012:root", + "eventSource": "aws:codecommit", + "awsRegion": "us-east-1", + "eventTotalParts": 1, + "customData": "custom data" + } `), }, }