github.com/minio/minio-go/v6@v6.0.57/api-s3-datatypes.go (about)

     1  /*
     2   * MinIO Go Library for Amazon S3 Compatible Cloud Storage
     3   * Copyright 2015-2017 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 minio
    19  
    20  import (
    21  	"encoding/xml"
    22  	"time"
    23  )
    24  
    25  // listAllMyBucketsResult container for listBuckets response.
    26  type listAllMyBucketsResult struct {
    27  	// Container for one or more buckets.
    28  	Buckets struct {
    29  		Bucket []BucketInfo
    30  	}
    31  	Owner owner
    32  }
    33  
    34  // owner container for bucket owner information.
    35  type owner struct {
    36  	DisplayName string
    37  	ID          string
    38  }
    39  
    40  // CommonPrefix container for prefix response.
    41  type CommonPrefix struct {
    42  	Prefix string
    43  }
    44  
    45  // ListBucketV2Result container for listObjects response version 2.
    46  type ListBucketV2Result struct {
    47  	// A response can contain CommonPrefixes only if you have
    48  	// specified a delimiter.
    49  	CommonPrefixes []CommonPrefix
    50  	// Metadata about each object returned.
    51  	Contents  []ObjectInfo
    52  	Delimiter string
    53  
    54  	// Encoding type used to encode object keys in the response.
    55  	EncodingType string
    56  
    57  	// A flag that indicates whether or not ListObjects returned all of the results
    58  	// that satisfied the search criteria.
    59  	IsTruncated bool
    60  	MaxKeys     int64
    61  	Name        string
    62  
    63  	// Hold the token that will be sent in the next request to fetch the next group of keys
    64  	NextContinuationToken string
    65  
    66  	ContinuationToken string
    67  	Prefix            string
    68  
    69  	// FetchOwner and StartAfter are currently not used
    70  	FetchOwner string
    71  	StartAfter string
    72  }
    73  
    74  // ListBucketResult container for listObjects response.
    75  type ListBucketResult struct {
    76  	// A response can contain CommonPrefixes only if you have
    77  	// specified a delimiter.
    78  	CommonPrefixes []CommonPrefix
    79  	// Metadata about each object returned.
    80  	Contents  []ObjectInfo
    81  	Delimiter string
    82  
    83  	// Encoding type used to encode object keys in the response.
    84  	EncodingType string
    85  
    86  	// A flag that indicates whether or not ListObjects returned all of the results
    87  	// that satisfied the search criteria.
    88  	IsTruncated bool
    89  	Marker      string
    90  	MaxKeys     int64
    91  	Name        string
    92  
    93  	// When response is truncated (the IsTruncated element value in
    94  	// the response is true), you can use the key name in this field
    95  	// as marker in the subsequent request to get next set of objects.
    96  	// Object storage lists objects in alphabetical order Note: This
    97  	// element is returned only if you have delimiter request
    98  	// parameter specified. If response does not include the NextMaker
    99  	// and it is truncated, you can use the value of the last Key in
   100  	// the response as the marker in the subsequent request to get the
   101  	// next set of object keys.
   102  	NextMarker string
   103  	Prefix     string
   104  }
   105  
   106  // ListMultipartUploadsResult container for ListMultipartUploads response
   107  type ListMultipartUploadsResult struct {
   108  	Bucket             string
   109  	KeyMarker          string
   110  	UploadIDMarker     string `xml:"UploadIdMarker"`
   111  	NextKeyMarker      string
   112  	NextUploadIDMarker string `xml:"NextUploadIdMarker"`
   113  	EncodingType       string
   114  	MaxUploads         int64
   115  	IsTruncated        bool
   116  	Uploads            []ObjectMultipartInfo `xml:"Upload"`
   117  	Prefix             string
   118  	Delimiter          string
   119  	// A response can contain CommonPrefixes only if you specify a delimiter.
   120  	CommonPrefixes []CommonPrefix
   121  }
   122  
   123  // initiator container for who initiated multipart upload.
   124  type initiator struct {
   125  	ID          string
   126  	DisplayName string
   127  }
   128  
   129  // copyObjectResult container for copy object response.
   130  type copyObjectResult struct {
   131  	ETag         string
   132  	LastModified time.Time // time string format "2006-01-02T15:04:05.000Z"
   133  }
   134  
   135  // ObjectPart container for particular part of an object.
   136  type ObjectPart struct {
   137  	// Part number identifies the part.
   138  	PartNumber int
   139  
   140  	// Date and time the part was uploaded.
   141  	LastModified time.Time
   142  
   143  	// Entity tag returned when the part was uploaded, usually md5sum
   144  	// of the part.
   145  	ETag string
   146  
   147  	// Size of the uploaded part data.
   148  	Size int64
   149  }
   150  
   151  // ListObjectPartsResult container for ListObjectParts response.
   152  type ListObjectPartsResult struct {
   153  	Bucket   string
   154  	Key      string
   155  	UploadID string `xml:"UploadId"`
   156  
   157  	Initiator initiator
   158  	Owner     owner
   159  
   160  	StorageClass         string
   161  	PartNumberMarker     int
   162  	NextPartNumberMarker int
   163  	MaxParts             int
   164  
   165  	// Indicates whether the returned list of parts is truncated.
   166  	IsTruncated bool
   167  	ObjectParts []ObjectPart `xml:"Part"`
   168  
   169  	EncodingType string
   170  }
   171  
   172  // initiateMultipartUploadResult container for InitiateMultiPartUpload
   173  // response.
   174  type initiateMultipartUploadResult struct {
   175  	Bucket   string
   176  	Key      string
   177  	UploadID string `xml:"UploadId"`
   178  }
   179  
   180  // completeMultipartUploadResult container for completed multipart
   181  // upload response.
   182  type completeMultipartUploadResult struct {
   183  	Location string
   184  	Bucket   string
   185  	Key      string
   186  	ETag     string
   187  }
   188  
   189  // CompletePart sub container lists individual part numbers and their
   190  // md5sum, part of completeMultipartUpload.
   191  type CompletePart struct {
   192  	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Part" json:"-"`
   193  
   194  	// Part number identifies the part.
   195  	PartNumber int
   196  	ETag       string
   197  }
   198  
   199  // completeMultipartUpload container for completing multipart upload.
   200  type completeMultipartUpload struct {
   201  	XMLName xml.Name       `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUpload" json:"-"`
   202  	Parts   []CompletePart `xml:"Part"`
   203  }
   204  
   205  // createBucketConfiguration container for bucket configuration.
   206  type createBucketConfiguration struct {
   207  	XMLName  xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CreateBucketConfiguration" json:"-"`
   208  	Location string   `xml:"LocationConstraint"`
   209  }
   210  
   211  // deleteObject container for Delete element in MultiObjects Delete XML request
   212  type deleteObject struct {
   213  	Key       string
   214  	VersionID string `xml:"VersionId,omitempty"`
   215  }
   216  
   217  // deletedObject container for Deleted element in MultiObjects Delete XML response
   218  type deletedObject struct {
   219  	Key       string
   220  	VersionID string `xml:"VersionId,omitempty"`
   221  	// These fields are ignored.
   222  	DeleteMarker          bool
   223  	DeleteMarkerVersionID string
   224  }
   225  
   226  // nonDeletedObject container for Error element (failed deletion) in MultiObjects Delete XML response
   227  type nonDeletedObject struct {
   228  	Key     string
   229  	Code    string
   230  	Message string
   231  }
   232  
   233  // deletedMultiObjects container for MultiObjects Delete XML request
   234  type deleteMultiObjects struct {
   235  	XMLName xml.Name `xml:"Delete"`
   236  	Quiet   bool
   237  	Objects []deleteObject `xml:"Object"`
   238  }
   239  
   240  // deletedMultiObjectsResult container for MultiObjects Delete XML response
   241  type deleteMultiObjectsResult struct {
   242  	XMLName          xml.Name           `xml:"DeleteResult"`
   243  	DeletedObjects   []deletedObject    `xml:"Deleted"`
   244  	UnDeletedObjects []nonDeletedObject `xml:"Error"`
   245  }