/
minio_event.go
76 lines (71 loc) · 2.09 KB
/
minio_event.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
package watcher
// MinioEvent represents the event delivered by Minio (S3) via Redis.
//
// For reference:
//
// {
// "eventVersion": "2.0",
// "eventSource": "minio:s3",
// "awsRegion": "",
// "eventTime": "2019-10-01T15:28:22Z",
// "eventName": "s3:ObjectCreated:CompleteMultipartUpload",
// "userIdentity": {
// "principalId": "36J9X8EZI4KEV1G7EHXA"
// },
// "requestParameters": {
// "accessKey": "36J9X8EZI4KEV1G7EHXA",
// "region": "",
// "sourceIPAddress": "172.20.0.1"
// },
// "responseElements": {
// "content-length": "291",
// "x-amz-request-id": "15C98F7AC9D60CA6",
// "x-minio-deployment-id": "bcc2f9ce-65f2-4558-a455-b8176012f89b",
// "x-minio-origin-endpoint": "http://172.20.0.5:9000"
// },
// "s3": {
// "s3SchemaVersion": "1.0",
// "configurationId": "Config",
// "bucket": {
// "name": "sips",
// "ownerIdentity": {
// "principalId": "36J9X8EZI4KEV1G7EHXA"
// },
// "arn": "arn:aws:s3:::sips"
// },
// "object": {
// "key": "y25.gif",
// "size": 100,
// "eTag": "b0814df70de0779da2b0b3f9c676c64d-1",
// "contentType": "image/gif",
// "userMetadata": {
// "X-Minio-Internal-actual-size": "100",
// "content-type": "image/gif"
// },
// "versionId": "1",
// "sequencer": "15C98F7ACA94598C"
// }
// },
// "source": {
// "host": "172.20.0.1",
// "port": "",
// "userAgent": "MinIO (linux; amd64) minio-go/v6.0.32 mc/DEVELOPMENT.GOGET"
// }
// }
type MinioEvent struct {
Name string `json:"eventName"`
S3 MinioEventS3 `json:"s3"`
}
func (e MinioEvent) String() string {
return e.Name
}
type MinioEventS3 struct {
Bucket MinioEventS3Bucket `json:"bucket"`
Object MinioEventS3Object `json:"object"`
}
type MinioEventS3Bucket struct {
Name string `json:"name"`
}
type MinioEventS3Object struct {
Key string `json:"key"`
}