Documentation ¶
Overview ¶
Package events contains the validation logic for different types of events.
Index ¶
- Variables
- func BuildCloudEvent(data []byte) (*cloudevents.Event, error)
- func EventNames(t EventType) ([]string, error)
- func InputData(name string, t EventType) []byte
- func OutputData(name string, t EventType, isConversion bool) []byte
- func PrintValidationInfos(vis []*ValidationInfo) (string, error)
- type Event
- type EventData
- type EventType
- type ValidationInfo
Constants ¶
This section is empty.
Variables ¶
var Events = map[string]Event{ "firebase-auth": { Input: EventData{ LegacyEvent: []byte(`{ "data": { "email": "test@nowhere.com", "metadata": { "createdAt": "2020-05-26T10:42:27Z", "lastSignedInAt": "2020-10-24T11:00:00Z" }, "providerData": [ { "email": "test@nowhere.com", "providerId": "password", "uid": "test@nowhere.com" } ], "uid": "UUpby3s4spZre6kHsgVSPetzQ8l2" }, "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType": "providers/firebase.auth/eventTypes/user.create", "notSupported": { }, "resource": "projects/my-project-id", "timestamp": "2020-09-29T11:32:00.123Z" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.auth.user.v1.created", "source": "//firebaseauth.googleapis.com/projects/my-project-id", "subject": "users/UUpby3s4spZre6kHsgVSPetzQ8l2", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "email": "test@nowhere.com", "metadata": { "createTime": "2020-05-26T10:42:27Z", "lastSignInTime": "2020-10-24T11:00:00Z" }, "providerData": [ { "email": "test@nowhere.com", "providerId": "password", "uid": "test@nowhere.com" } ], "uid": "UUpby3s4spZre6kHsgVSPetzQ8l2" } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "email": "test@nowhere.com", "metadata": { "createdAt": "2020-05-26T10:42:27Z", "lastSignedInAt": "2020-10-24T11:00:00Z" }, "providerData": [ { "email": "test@nowhere.com", "providerId": "password", "uid": "test@nowhere.com" } ], "uid": "UUpby3s4spZre6kHsgVSPetzQ8l2" }, "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType": "providers/firebase.auth/eventTypes/user.create", "resource": "projects/my-project-id", "timestamp": "2020-09-29T11:32:00.123Z" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.auth.user.v1.created", "source": "//firebaseauth.googleapis.com/projects/my-project-id", "subject": "users/UUpby3s4spZre6kHsgVSPetzQ8l2", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "email": "test@nowhere.com", "metadata": { "createTime": "2020-05-26T10:42:27Z", "lastSignInTime": "2020-10-24T11:00:00Z" }, "providerData": [ { "email": "test@nowhere.com", "providerId": "password", "uid": "test@nowhere.com" } ], "uid": "UUpby3s4spZre6kHsgVSPetzQ8l2" } } `), }, ConvertedOutput: EventData{}, }, "firebase-db1": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": null, "delta": { "grandchild": "other" } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": null, "delta": { "grandchild": "other" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": null, "delta": { "grandchild": "other" } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType": "providers/google.firebase.database/eventTypes/ref.write" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": null, "delta": { "grandchild": "other" } } } `), }, ConvertedOutput: EventData{}, }, "firebase-db2": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain":"europe-west1.firebasedatabase.app", "data": { "data": { "grandchild": "other" }, "delta": { "grandchild": "other changed" } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/europe-west1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other" }, "delta": { "grandchild": "other changed" } } }`), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "grandchild": "other" }, "delta": { "grandchild": "other changed" } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/europe-west1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other" }, "delta": { "grandchild": "other changed" } } }`), }, ConvertedOutput: EventData{}, }, "firebase-db3": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": null, "delta": 10 }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": null, "delta": 10 } }`), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": null, "delta": 10 }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": null, "delta": 10 } }`), }, ConvertedOutput: EventData{}, }, "firebase-db4": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "grandchild": "other changed" }, "delta": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } } } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other changed" }, "delta": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } } } } }`), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "grandchild": "other changed" }, "delta": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } } } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other changed" }, "delta": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } } } } }`), }, ConvertedOutput: EventData{}, }, "firebase-db5": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": "def" } } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": "def" } } } }`), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": "def" } } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": "def" } } } }`), }, ConvertedOutput: EventData{}, }, "firebase-db6": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "deeply": { "abc": "def", "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "nested": null } } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "abc": "def", "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "nested": null } } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "deeply": { "abc": "def", "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "nested": null } } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "abc": "def", "nested": { "text": "This is deeply nested", "text2": "Second value" } }, "grandchild": "other changed" }, "delta": { "deeply": { "nested": null } } } } `), }, ConvertedOutput: EventData{}, }, "firebase-db7": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "deeply": { "abc": "def" }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": 10 } } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "abc": "def" }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": 10 } } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "deeply": { "abc": "def" }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": 10 } } }, "context": { "eventType": "providers/google.firebase.database/eventTypes/ref.write", "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "deeply": { "abc": "def" }, "grandchild": "other changed" }, "delta": { "deeply": { "abc": 10 } } } } `), }, ConvertedOutput: EventData{}, }, "firebase-db8": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.write", "params": { }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "gcf-test": { "abc": 10, "child1": "value1", "xyz": { "deeply": { "abc": 11 }, "grandchild": "other changed" } }, "not-gcf-test": "Foo" }, "delta": { "gcf-test": { "xyz": { "deeply": { "abc": 12 } } } } }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "gcf-test": { "abc": 10, "child1": "value1", "xyz": { "deeply": { "abc": 11 }, "grandchild": "other changed" } }, "not-gcf-test": "Foo" }, "delta": { "gcf-test": { "xyz": { "deeply": { "abc": 12 } } } } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "gcf-test": { "abc": 10, "child1": "value1", "xyz": { "deeply": { "abc": 11 }, "grandchild": "other changed" } }, "not-gcf-test": "Foo" }, "delta": { "gcf-test": { "xyz": { "deeply": { "abc": 12 } } } } }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.write", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.written", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "gcf-test": { "abc": 10, "child1": "value1", "xyz": { "deeply": { "abc": 11 }, "grandchild": "other changed" } }, "not-gcf-test": "Foo" }, "delta": { "gcf-test": { "xyz": { "deeply": { "abc": 12 } } } } } } `), }, ConvertedOutput: EventData{}, }, "firebase-dbdelete1": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.delete", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": { "grandchild": "other changed" }, "delta": null }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.deleted", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other changed" }, "delta": null } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": { "grandchild": "other changed" }, "delta": null }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.delete", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.deleted", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": { "grandchild": "other changed" }, "delta": null } } `), }, ConvertedOutput: EventData{}, }, "firebase-dbdelete2": { Input: EventData{ LegacyEvent: []byte(`{ "eventType": "providers/google.firebase.database/eventTypes/ref.delete", "params": { "child": "xyz" }, "auth": { "admin": true }, "domain": "firebaseio.com", "data": { "data": 10, "delta": null }, "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.deleted", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": 10, "delta": null } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "data": 10, "delta": null }, "context": { "resource": "projects/_/instances/my-project-id/refs/gcf-test/xyz", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/google.firebase.database/eventTypes/ref.delete", "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.firebase.database.ref.v1.deleted", "source": "//firebasedatabase.googleapis.com/projects/_/locations/us-central1/instances/my-project-id", "subject": "refs/gcf-test/xyz", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "data": 10, "delta": null } } `), }, ConvertedOutput: EventData{}, }, "firestore_complex": { Input: EventData{ LegacyEvent: []byte(`{ "data": { "oldValue": {}, "updateMask": {}, "value": { "createTime": "2020-04-23T14:25:05.349632Z", "fields": { "arrayValue": { "arrayValue": { "values": [ { "integerValue": "1" }, { "integerValue": "2" } ] } }, "booleanValue": { "booleanValue": true }, "doubleValue": { "doubleValue": 5.5 }, "geoPointValue": { "geoPointValue": { "latitude": 51.4543, "longitude": -0.9781 } }, "intValue": { "integerValue": "50" }, "mapValue": { "mapValue": { "fields": { "field1": { "stringValue": "x" }, "field2": { "arrayValue": { "values": [ { "stringValue": "x" }, { "integerValue": "1" } ] } } } } }, "nullValue": { "nullValue": null }, "referenceValue": { "referenceValue": "projects/project-id/databases/(default)/documents/foo/bar/baz/qux" }, "stringValue": { "stringValue": "text" }, "timestampValue": { "timestampValue": "2020-04-23T14:23:53.241Z" } }, "name": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "updateTime": "2020-04-23T14:25:05.349632Z" } }, "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType": "providers/cloud.firestore/eventTypes/document.write", "notSupported": {}, "params": { "doc": "IH75dRdeYJKd4uuQiqch" }, "resource": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "timestamp": "2020-09-29T11:32:00.123Z" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.firestore.document.v1.written", "source": "//firestore.googleapis.com/projects/project-id/databases/(default)", "subject": "documents/gcf-test/IH75dRdeYJKd4uuQiqch", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "oldValue": {}, "updateMask": {}, "value": { "createTime": "2020-04-23T14:25:05.349632Z", "fields": { "arrayValue": { "arrayValue": { "values": [ { "integerValue": "1" }, { "integerValue": "2" } ] } }, "booleanValue": { "booleanValue": true }, "doubleValue": { "doubleValue": 5.5 }, "geoPointValue": { "geoPointValue": { "latitude": 51.4543, "longitude": -0.9781 } }, "intValue": { "integerValue": "50" }, "mapValue": { "mapValue": { "fields": { "field1": { "stringValue": "x" }, "field2": { "arrayValue": { "values": [ { "stringValue": "x" }, { "integerValue": "1" } ] } } } } }, "nullValue": { "nullValue": null }, "referenceValue": { "referenceValue": "projects/project-id/databases/(default)/documents/foo/bar/baz/qux" }, "stringValue": { "stringValue": "text" }, "timestampValue": { "timestampValue": "2020-04-23T14:23:53.241Z" } }, "name": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "updateTime": "2020-04-23T14:25:05.349632Z" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data": { "oldValue": {}, "updateMask": {}, "value": { "createTime": "2020-04-23T14:25:05.349632Z", "fields": { "arrayValue": { "arrayValue": { "values": [ { "integerValue": "1" }, { "integerValue": "2" } ] } }, "booleanValue": { "booleanValue": true }, "doubleValue": { "doubleValue": 5.5 }, "geoPointValue": { "geoPointValue": { "latitude": 51.4543, "longitude": -0.9781 } }, "intValue": { "integerValue": "50" }, "mapValue": { "mapValue": { "fields": { "field1": { "stringValue": "x" }, "field2": { "arrayValue": { "values": [ { "stringValue": "x" }, { "integerValue": "1" } ] } } } } }, "nullValue": { "nullValue": null }, "referenceValue": { "referenceValue": "projects/project-id/databases/(default)/documents/foo/bar/baz/qux" }, "stringValue": { "stringValue": "text" }, "timestampValue": { "timestampValue": "2020-04-23T14:23:53.241Z" } }, "name": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "updateTime": "2020-04-23T14:25:05.349632Z" } }, "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType": "providers/cloud.firestore/eventTypes/document.write", "resource": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "timestamp": "2020-09-29T11:32:00.123Z" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.firestore.document.v1.written", "source": "//firestore.googleapis.com/projects/project-id/databases/(default)", "subject": "documents/gcf-test/IH75dRdeYJKd4uuQiqch", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "oldValue": {}, "updateMask": {}, "value": { "createTime": "2020-04-23T14:25:05.349632Z", "fields": { "arrayValue": { "arrayValue": { "values": [ { "integerValue": "1" }, { "integerValue": "2" } ] } }, "booleanValue": { "booleanValue": true }, "doubleValue": { "doubleValue": 5.5 }, "geoPointValue": { "geoPointValue": { "latitude": 51.4543, "longitude": -0.9781 } }, "intValue": { "integerValue": "50" }, "mapValue": { "mapValue": { "fields": { "field1": { "stringValue": "x" }, "field2": { "arrayValue": { "values": [ { "stringValue": "x" }, { "integerValue": "1" } ] } } } } }, "nullValue": { "nullValue": null }, "referenceValue": { "referenceValue": "projects/project-id/databases/(default)/documents/foo/bar/baz/qux" }, "stringValue": { "stringValue": "text" }, "timestampValue": { "timestampValue": "2020-04-23T14:23:53.241Z" } }, "name": "projects/project-id/databases/(default)/documents/gcf-test/IH75dRdeYJKd4uuQiqch", "updateTime": "2020-04-23T14:25:05.349632Z" } } } `), }, ConvertedOutput: EventData{}, }, "firestore_simple": { Input: EventData{ LegacyEvent: []byte(`{ "data":{ "oldValue":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"3" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" }, "updateMask":{ "fieldPaths":[ "count" ] }, "value":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"4" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" } }, "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType":"providers/cloud.firestore/eventTypes/document.write", "notSupported":{ }, "params":{ "doc":"2Vm2mI1d0wIaK2Waj5to" }, "resource":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "timestamp":"2020-09-29T11:32:00.123Z" } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.firestore.document.v1.written", "source": "//firestore.googleapis.com/projects/project-id/databases/(default)", "subject": "documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "oldValue":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"3" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" }, "updateMask":{ "fieldPaths":[ "count" ] }, "value":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"4" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "data":{ "oldValue":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"3" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" }, "updateMask":{ "fieldPaths":[ "count" ] }, "value":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"4" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" } }, "context": { "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "eventType":"providers/cloud.firestore/eventTypes/document.write", "resource":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "timestamp":"2020-09-29T11:32:00.123Z" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.firestore.document.v1.written", "source": "//firestore.googleapis.com/projects/project-id/databases/(default)", "subject": "documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "oldValue":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"3" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" }, "updateMask":{ "fieldPaths":[ "count" ] }, "value":{ "createTime":"2020-04-23T09:58:53.211035Z", "fields":{ "another test":{ "stringValue":"asd" }, "count":{ "integerValue":"4" }, "foo":{ "stringValue":"bar" } }, "name":"projects/project-id/databases/(default)/documents/gcf-test/2Vm2mI1d0wIaK2Waj5to", "updateTime":"2020-04-23T12:00:27.247187Z" } } } `), }, ConvertedOutput: EventData{}, }, "legacy_pubsub": { Input: EventData{ LegacyEvent: []byte(`{ "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/cloud.pubsub/eventTypes/topic.publish", "resource": "projects/sample-project/topics/gcf-test", "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "attributes": { "attribute1": "value1" }, "data": "VGhpcyBpcyBhIHNhbXBsZSBtZXNzYWdl" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "subscription": "projects/sample-project/subscriptions/sample-subscription", "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "attributes": { "attribute1": "value1" }, "data": "VGhpcyBpcyBhIHNhbXBsZSBtZXNzYWdl" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "providers/cloud.pubsub/eventTypes/topic.publish", "resource": "projects/sample-project/topics/gcf-test" }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "attributes": { "attribute1": "value1" }, "data": "VGhpcyBpcyBhIHNhbXBsZSBtZXNzYWdl" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "attributes": { "attribute1": "value1" }, "data": "VGhpcyBpcyBhIHNhbXBsZSBtZXNzYWdl" } } } `), }, ConvertedOutput: EventData{ LegacyEvent: []byte(`{ "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp": "2020-09-29T11:32:00.123Z", "eventType":"google.pubsub.topic.publish", "resource": { "service":"pubsub.googleapis.com", "name":"projects/sample-project/topics/gcf-test", "type":"type.googleapis.com/google.pubsub.v1.PubsubMessage" } }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "attributes": { "attribute1": "value1" }, "data": "VGhpcyBpcyBhIHNhbXBsZSBtZXNzYWdl" } } `), }, }, "pubsub_binary": { Input: EventData{ LegacyEvent: []byte(`{ "context": { "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp":"2020-09-29T11:32:00.123Z", "eventType":"google.pubsub.topic.publish", "resource":{ "service":"pubsub.googleapis.com", "name":"projects/sample-project/topics/gcf-test", "type":"type.googleapis.com/google.pubsub.v1.PubsubMessage" } }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "data": "AQIDBA==" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "subscription": "projects/sample-project/subscriptions/sample-subscription", "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "data": "AQIDBA==" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "context": { "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp":"2020-09-29T11:32:00.123Z", "eventType":"google.pubsub.topic.publish", "resource":{ "service":"pubsub.googleapis.com", "name":"projects/sample-project/topics/gcf-test", "type":"type.googleapis.com/google.pubsub.v1.PubsubMessage" } }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "data": "AQIDBA==" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "data": "AQIDBA==" } } } `), }, ConvertedOutput: EventData{}, }, "pubsub_text": { Input: EventData{ LegacyEvent: []byte(`{ "context": { "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp":"2020-09-29T11:32:00.123Z", "eventType":"google.pubsub.topic.publish", "resource":{ "service":"pubsub.googleapis.com", "name":"projects/sample-project/topics/gcf-test", "type":"type.googleapis.com/google.pubsub.v1.PubsubMessage" } }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "attributes": { "attr1":"attr1-value" }, "data": "dGVzdCBtZXNzYWdlIDM=" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "subscription": "projects/sample-project/subscriptions/sample-subscription", "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "attributes": { "attr1":"attr1-value" }, "data": "dGVzdCBtZXNzYWdlIDM=" } } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "context": { "eventId":"aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp":"2020-09-29T11:32:00.123Z", "eventType":"google.pubsub.topic.publish", "resource":{ "service":"pubsub.googleapis.com", "name":"projects/sample-project/topics/gcf-test", "type":"type.googleapis.com/google.pubsub.v1.PubsubMessage" } }, "data": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "attributes": { "attr1":"attr1-value" }, "data": "dGVzdCBtZXNzYWdlIDM=" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.pubsub.topic.v1.messagePublished", "source": "//pubsub.googleapis.com/projects/sample-project/topics/gcf-test", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "message": { "@type": "type.googleapis.com/google.pubsub.v1.PubsubMessage", "messageId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "publishTime": "2020-09-29T11:32:00.123Z", "attributes": { "attr1":"attr1-value" }, "data": "dGVzdCBtZXNzYWdlIDM=" } } } `), }, ConvertedOutput: EventData{}, }, "storage": { Input: EventData{ LegacyEvent: []byte(`{ "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "google.storage.object.finalize", "resource": { "service": "storage.googleapis.com", "name": "projects/_/buckets/some-bucket/objects/folder/Test.cs", "type": "storage#object" } }, "data": { "bucket": "some-bucket", "contentType": "text/plain", "crc32c": "rTVTeQ==", "etag": "CNHZkbuF/ugCEAE=", "generation": "1587627537231057", "id": "some-bucket/folder/Test.cs/1587627537231057", "kind": "storage#object", "md5Hash": "kF8MuJ5+CTJxvyhHS1xzRg==", "mediaLink": "https://www.googleapis.com/download/storage/v1/b/some-bucket/o/folder%2FTest.cs?generation=1587627537231057\u0026alt=media", "metageneration": "1", "name": "folder/Test.cs", "selfLink": "https://www.googleapis.com/storage/v1/b/some-bucket/o/folder/Test.cs", "size": "352", "storageClass": "MULTI_REGIONAL", "timeCreated": "2020-04-23T07:38:57.230Z", "timeStorageClassUpdated": "2020-04-23T07:38:57.230Z", "updated": "2020-04-23T07:38:57.230Z" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.storage.object.v1.finalized", "source": "//storage.googleapis.com/projects/_/buckets/some-bucket", "subject": "objects/folder/Test.cs", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "bucket": "some-bucket", "contentType": "text/plain", "crc32c": "rTVTeQ==", "etag": "CNHZkbuF/ugCEAE=", "generation": "1587627537231057", "id": "some-bucket/folder/Test.cs/1587627537231057", "kind": "storage#object", "md5Hash": "kF8MuJ5+CTJxvyhHS1xzRg==", "mediaLink": "https://www.googleapis.com/download/storage/v1/b/some-bucket/o/folder%2FTest.cs?generation=1587627537231057\u0026alt=media", "metageneration": "1", "name": "folder/Test.cs", "selfLink": "https://www.googleapis.com/storage/v1/b/some-bucket/o/folder/Test.cs", "size": "352", "storageClass": "MULTI_REGIONAL", "timeCreated": "2020-04-23T07:38:57.230Z", "timeStorageClassUpdated": "2020-04-23T07:38:57.230Z", "updated": "2020-04-23T07:38:57.230Z" } } `), }, Output: EventData{ LegacyEvent: []byte(`{ "context": { "eventId": "aaaaaa-1111-bbbb-2222-cccccccccccc", "timestamp": "2020-09-29T11:32:00.123Z", "eventType": "google.storage.object.finalize", "resource": { "service": "storage.googleapis.com", "name": "projects/_/buckets/some-bucket/objects/folder/Test.cs", "type": "storage#object" } }, "data": { "bucket": "some-bucket", "contentType": "text/plain", "crc32c": "rTVTeQ==", "etag": "CNHZkbuF/ugCEAE=", "generation": "1587627537231057", "id": "some-bucket/folder/Test.cs/1587627537231057", "kind": "storage#object", "md5Hash": "kF8MuJ5+CTJxvyhHS1xzRg==", "mediaLink": "https://www.googleapis.com/download/storage/v1/b/some-bucket/o/folder%2FTest.cs?generation=1587627537231057\u0026alt=media", "metageneration": "1", "name": "folder/Test.cs", "selfLink": "https://www.googleapis.com/storage/v1/b/some-bucket/o/folder/Test.cs", "size": "352", "storageClass": "MULTI_REGIONAL", "timeCreated": "2020-04-23T07:38:57.230Z", "timeStorageClassUpdated": "2020-04-23T07:38:57.230Z", "updated": "2020-04-23T07:38:57.230Z" } } `), CloudEvent: []byte(`{ "specversion": "1.0", "type": "google.cloud.storage.object.v1.finalized", "source": "//storage.googleapis.com/projects/_/buckets/some-bucket", "subject": "objects/folder/Test.cs", "id": "aaaaaa-1111-bbbb-2222-cccccccccccc", "time": "2020-09-29T11:32:00.123Z", "datacontenttype": "application/json", "data": { "bucket": "some-bucket", "contentType": "text/plain", "crc32c": "rTVTeQ==", "etag": "CNHZkbuF/ugCEAE=", "generation": "1587627537231057", "id": "some-bucket/folder/Test.cs/1587627537231057", "kind": "storage#object", "md5Hash": "kF8MuJ5+CTJxvyhHS1xzRg==", "mediaLink": "https://www.googleapis.com/download/storage/v1/b/some-bucket/o/folder%2FTest.cs?generation=1587627537231057\u0026alt=media", "metageneration": "1", "name": "folder/Test.cs", "selfLink": "https://www.googleapis.com/storage/v1/b/some-bucket/o/folder/Test.cs", "size": "352", "storageClass": "MULTI_REGIONAL", "timeCreated": "2020-04-23T07:38:57.230Z", "timeStorageClassUpdated": "2020-04-23T07:38:57.230Z", "updated": "2020-04-23T07:38:57.230Z" } } `), }, ConvertedOutput: EventData{}, }, }
Functions ¶
func BuildCloudEvent ¶
func BuildCloudEvent(data []byte) (*cloudevents.Event, error)
BuildCloudEvent creates a CloudEvent from a byte slice.
func EventNames ¶
EventNames returns a list of event names to use as inputs for a particular event type.
func InputData ¶
InputData returns the contents of the input event for a particular event name and type.
func OutputData ¶
OutputData returns the contents of the output event for a particular event name and type.
func PrintValidationInfos ¶ added in v0.2.0
func PrintValidationInfos(vis []*ValidationInfo) (string, error)
PrintValidationInfos takes a list of ValidationInfos and collapses them into a single error and a single log line recording which events were validation, which skipped, and why.
Types ¶
type ValidationInfo ¶ added in v0.2.0
ValidationInfo contains information about a particular validation step, including a reason why the validation for this event and type was skipped or the relevant error.
func ValidateEvent ¶
func ValidateEvent(name string, it EventType, ot EventType, got []byte) *ValidationInfo
ValidateEvent validates that a particular function output matches the expected contents.