storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/pkg/event/event.go (about) 1 /* 2 * MinIO Cloud Storage, (C) 2018 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package event 18 19 const ( 20 // NamespaceFormat - namespace log format used in some event targets. 21 NamespaceFormat = "namespace" 22 23 // AccessFormat - access log format used in some event targets. 24 AccessFormat = "access" 25 26 // AMZTimeFormat - event time format. 27 AMZTimeFormat = "2006-01-02T15:04:05.000Z" 28 ) 29 30 // Identity represents access key who caused the event. 31 type Identity struct { 32 PrincipalID string `json:"principalId"` 33 } 34 35 // Bucket represents bucket metadata of the event. 36 type Bucket struct { 37 Name string `json:"name"` 38 OwnerIdentity Identity `json:"ownerIdentity"` 39 ARN string `json:"arn"` 40 } 41 42 // Object represents object metadata of the event. 43 type Object struct { 44 Key string `json:"key"` 45 Size int64 `json:"size,omitempty"` 46 ETag string `json:"eTag,omitempty"` 47 ContentType string `json:"contentType,omitempty"` 48 UserMetadata map[string]string `json:"userMetadata,omitempty"` 49 VersionID string `json:"versionId,omitempty"` 50 Sequencer string `json:"sequencer"` 51 } 52 53 // Metadata represents event metadata. 54 type Metadata struct { 55 SchemaVersion string `json:"s3SchemaVersion"` 56 ConfigurationID string `json:"configurationId"` 57 Bucket Bucket `json:"bucket"` 58 Object Object `json:"object"` 59 } 60 61 // Source represents client information who triggered the event. 62 type Source struct { 63 Host string `json:"host"` 64 Port string `json:"port"` 65 UserAgent string `json:"userAgent"` 66 } 67 68 // Event represents event notification information defined in 69 // http://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html. 70 type Event struct { 71 EventVersion string `json:"eventVersion"` 72 EventSource string `json:"eventSource"` 73 AwsRegion string `json:"awsRegion"` 74 EventTime string `json:"eventTime"` 75 EventName Name `json:"eventName"` 76 UserIdentity Identity `json:"userIdentity"` 77 RequestParameters map[string]string `json:"requestParameters"` 78 ResponseElements map[string]string `json:"responseElements"` 79 S3 Metadata `json:"s3"` 80 Source Source `json:"source"` 81 } 82 83 // Log represents event information for some event targets. 84 type Log struct { 85 EventName Name 86 Key string 87 Records []Event 88 }