storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/api-datatypes.go (about) 1 /* 2 * MinIO Cloud Storage, (C) 2015, 2016 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 cmd 18 19 import ( 20 "encoding/xml" 21 "time" 22 ) 23 24 // DeletedObject objects deleted 25 type DeletedObject struct { 26 DeleteMarker bool `xml:"DeleteMarker,omitempty"` 27 DeleteMarkerVersionID string `xml:"DeleteMarkerVersionId,omitempty"` 28 ObjectName string `xml:"Key,omitempty"` 29 VersionID string `xml:"VersionId,omitempty"` 30 31 // MinIO extensions to support delete marker replication 32 // Replication status of DeleteMarker 33 DeleteMarkerReplicationStatus string `xml:"DeleteMarkerReplicationStatus,omitempty"` 34 // MTime of DeleteMarker on source that needs to be propagated to replica 35 DeleteMarkerMTime DeleteMarkerMTime `xml:"DeleteMarkerMTime,omitempty"` 36 // Status of versioned delete (of object or DeleteMarker) 37 VersionPurgeStatus VersionPurgeStatusType `xml:"VersionPurgeStatus,omitempty"` 38 // PurgeTransitioned is nonempty if object is in transition tier 39 PurgeTransitioned string `xml:"PurgeTransitioned,omitempty"` 40 } 41 42 // DeleteMarkerMTime is an embedded type containing time.Time for XML marshal 43 type DeleteMarkerMTime struct { 44 time.Time 45 } 46 47 // MarshalXML encodes expiration date if it is non-zero and encodes 48 // empty string otherwise 49 func (t DeleteMarkerMTime) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error { 50 if t.Time.IsZero() { 51 return nil 52 } 53 return e.EncodeElement(t.Time.Format(time.RFC3339), startElement) 54 } 55 56 // ObjectToDelete carries key name for the object to delete. 57 type ObjectToDelete struct { 58 ObjectName string `xml:"Key"` 59 VersionID string `xml:"VersionId"` 60 // Replication status of DeleteMarker 61 DeleteMarkerReplicationStatus string `xml:"DeleteMarkerReplicationStatus"` 62 // Status of versioned delete (of object or DeleteMarker) 63 VersionPurgeStatus VersionPurgeStatusType `xml:"VersionPurgeStatus"` 64 // Version ID of delete marker 65 DeleteMarkerVersionID string `xml:"DeleteMarkerVersionId"` 66 // PurgeTransitioned is nonempty if object is in transition tier 67 PurgeTransitioned string `xml:"PurgeTransitioned"` 68 } 69 70 // createBucketConfiguration container for bucket configuration request from client. 71 // Used for parsing the location from the request body for Makebucket. 72 type createBucketLocationConfiguration struct { 73 XMLName xml.Name `xml:"CreateBucketConfiguration" json:"-"` 74 Location string `xml:"LocationConstraint"` 75 } 76 77 // DeleteObjectsRequest - xml carrying the object key names which needs to be deleted. 78 type DeleteObjectsRequest struct { 79 // Element to enable quiet mode for the request 80 Quiet bool 81 // List of objects to be deleted 82 Objects []ObjectToDelete `xml:"Object"` 83 }