This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdefinition.go
129 lines (103 loc) · 3.62 KB
/
definition.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// Copyright 2016 Alsanium, SAS. or its affiliates. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package snsevt
import (
"encoding/json"
"time"
)
// MessageAttributes represents an SNS message attribute.
type MessageAttributes struct {
// The attribute type.
Type string
// The attribute value.
Value string
}
// Record represents the unit of data of an Amazon SNS message.
// See also http://docs.aws.amazon.com/sns/latest/dg/json-formats.html
type Record struct {
// A Universally Unique Identifier, unique for each message published.
// For a message that Amazon SNS resends during a retry, the message ID
// of the original message is used.
MessageID string
// The type of the message.
Type string
// The time when the notification was published.
Timestamp time.Time
// The Subject parameter specified when the notification was published
// to the topic.
// Note that this is an optional parameter.
Subject string
// The Message value specified when the notification was published to
// the topic.
Message string
// The attributes associated with the message.
MessageAttributes map[string]*MessageAttributes
// The Version of the Amazon SNS signature used.
SignatureVersion string
// Base64-encoded "SHA1withRSA" signature of the Message, MessageID,
// Subject (if present), Type, Timestamp, and TopicARN values.
// See also http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.verify.signature.html
Signature string
// The URL to the certificate that was used to sign the message.
SignatureCertURL string
// The URL that you must visit in order to confirm the subscription.
// Alternatively, you can instead use the Token with the
// ConfirmSubscription action to confirm the subscription.
SubscribeURL string
// A value you can use with the ConfirmSubscription action to confirm the
// subscription. Alternatively, you can simply visit the SubscribeURL.
Token string
// The ARN of the topic that this message was published to.
TopicARN string
// An URL that you can use to unsubscribe the endpoint from this topic.
// If you visit this URL, Amazon SNS unsubscribes the endpoint and stops
// sending notifications to this endpoint.
UnsubscribeURL string
}
// EventRecord provides contextual information about an Amazon SNS event.
type EventRecord struct {
// The event version.
EventVersion string
// The event source.
EventSource string
// The ARN of the Lambda subscription.
EventSubscriptionARN string
// The underlying Amazon SNS record associated with the event.
SNS *Record
}
// String returns the string representation.
func (e *EventRecord) String() string {
s, _ := json.Marshal(e)
return string(s)
}
// GoString returns the string representation.
func (e *EventRecord) GoString() string {
return e.String()
}
// Event represents an Amazon SNS event.
type Event struct {
// The list of Amazon SNS event records.
Records []*EventRecord
}
// String returns the string representation.
func (e *Event) String() string {
s, _ := json.Marshal(e)
return string(s)
}
// GoString returns the string representation.
func (e *Event) GoString() string {
return e.String()
}