info.go (2774B)
1 /* 2 * MinIO Go Library for Amazon S3 Compatible Cloud Storage 3 * Copyright 2017-2020 MinIO, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package notification 19 20 // Indentity represents the user id, this is a compliance field. 21 type identity struct { 22 PrincipalID string `json:"principalId"` 23 } 24 25 // event bucket metadata. 26 type bucketMeta struct { 27 Name string `json:"name"` 28 OwnerIdentity identity `json:"ownerIdentity"` 29 ARN string `json:"arn"` 30 } 31 32 // event object metadata. 33 type objectMeta struct { 34 Key string `json:"key"` 35 Size int64 `json:"size,omitempty"` 36 ETag string `json:"eTag,omitempty"` 37 ContentType string `json:"contentType,omitempty"` 38 UserMetadata map[string]string `json:"userMetadata,omitempty"` 39 VersionID string `json:"versionId,omitempty"` 40 Sequencer string `json:"sequencer"` 41 } 42 43 // event server specific metadata. 44 type eventMeta struct { 45 SchemaVersion string `json:"s3SchemaVersion"` 46 ConfigurationID string `json:"configurationId"` 47 Bucket bucketMeta `json:"bucket"` 48 Object objectMeta `json:"object"` 49 } 50 51 // sourceInfo represents information on the client that 52 // triggered the event notification. 53 type sourceInfo struct { 54 Host string `json:"host"` 55 Port string `json:"port"` 56 UserAgent string `json:"userAgent"` 57 } 58 59 // Event represents an Amazon an S3 bucket notification event. 60 type Event struct { 61 EventVersion string `json:"eventVersion"` 62 EventSource string `json:"eventSource"` 63 AwsRegion string `json:"awsRegion"` 64 EventTime string `json:"eventTime"` 65 EventName string `json:"eventName"` 66 UserIdentity identity `json:"userIdentity"` 67 RequestParameters map[string]string `json:"requestParameters"` 68 ResponseElements map[string]string `json:"responseElements"` 69 S3 eventMeta `json:"s3"` 70 Source sourceInfo `json:"source"` 71 } 72 73 // Info - represents the collection of notification events, additionally 74 // also reports errors if any while listening on bucket notifications. 75 type Info struct { 76 Records []Event 77 Err error 78 }