You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
196 lines
5.3 KiB
196 lines
5.3 KiB
10 years ago
|
/*
|
||
9 years ago
|
* Minio Cloud Storage, (C) 2014 Minio, Inc.
|
||
10 years ago
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
9 years ago
|
package main
|
||
10 years ago
|
|
||
10 years ago
|
import "encoding/xml"
|
||
10 years ago
|
|
||
10 years ago
|
// Limit number of objects in a given response
|
||
10 years ago
|
const (
|
||
10 years ago
|
maxObjectList = 1000
|
||
10 years ago
|
)
|
||
|
|
||
10 years ago
|
// ListObjectsResponse - format for list objects response
|
||
|
type ListObjectsResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"`
|
||
10 years ago
|
|
||
|
CommonPrefixes []*CommonPrefix
|
||
|
Contents []*Object
|
||
|
|
||
|
Delimiter string
|
||
|
|
||
|
// Encoding type used to encode object keys in the response.
|
||
|
EncodingType string
|
||
|
|
||
|
// A flag that indicates whether or not ListObjects returned all of the results
|
||
|
// that satisfied the search criteria.
|
||
|
IsTruncated bool
|
||
|
Marker string
|
||
|
MaxKeys int
|
||
|
Name string
|
||
|
|
||
|
// When response is truncated (the IsTruncated element value in the response
|
||
|
// is true), you can use the key name in this field as marker in the subsequent
|
||
9 years ago
|
// request to get next set of objects. Server lists objects in alphabetical
|
||
10 years ago
|
// order Note: This element is returned only if you have delimiter request parameter
|
||
|
// specified. If response does not include the NextMaker and it is truncated,
|
||
|
// you can use the value of the last Key in the response as the marker in the
|
||
|
// subsequent request to get the next set of object keys.
|
||
|
NextMarker string
|
||
|
Prefix string
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
// Part container for part metadata
|
||
|
type Part struct {
|
||
|
PartNumber int
|
||
|
ETag string
|
||
|
LastModified string
|
||
|
Size int64
|
||
|
}
|
||
|
|
||
10 years ago
|
// ListPartsResponse - format for list parts response
|
||
|
type ListPartsResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListPartsResult" json:"-"`
|
||
10 years ago
|
|
||
|
Bucket string
|
||
|
Key string
|
||
|
UploadID string `xml:"UploadId"`
|
||
|
|
||
|
Initiator Initiator
|
||
|
Owner Owner
|
||
|
|
||
|
// The class of storage used to store the object.
|
||
|
StorageClass string
|
||
|
|
||
|
PartNumberMarker int
|
||
|
NextPartNumberMarker int
|
||
|
MaxParts int
|
||
|
IsTruncated bool
|
||
|
|
||
|
// List of parts
|
||
|
Part []*Part
|
||
|
}
|
||
|
|
||
10 years ago
|
// ListMultipartUploadsResponse - format for list multipart uploads response
|
||
|
type ListMultipartUploadsResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult" json:"-"`
|
||
10 years ago
|
|
||
|
Bucket string
|
||
|
KeyMarker string
|
||
|
UploadIDMarker string `xml:"UploadIdMarker"`
|
||
|
NextKeyMarker string
|
||
|
NextUploadIDMarker string `xml:"NextUploadIdMarker"`
|
||
|
EncodingType string
|
||
|
MaxUploads int
|
||
|
IsTruncated bool
|
||
|
Upload []*Upload
|
||
|
Prefix string
|
||
|
Delimiter string
|
||
|
CommonPrefixes []*CommonPrefix
|
||
|
}
|
||
|
|
||
10 years ago
|
// ListBucketsResponse - format for list buckets response
|
||
|
type ListBucketsResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-"`
|
||
10 years ago
|
// Container for one or more buckets.
|
||
10 years ago
|
Buckets struct {
|
||
|
Bucket []*Bucket
|
||
10 years ago
|
} // Buckets are nested
|
||
10 years ago
|
Owner Owner
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
// Upload container for in progress multipart upload
|
||
|
type Upload struct {
|
||
|
Key string
|
||
|
UploadID string `xml:"UploadId"`
|
||
|
Initiator Initiator
|
||
|
Owner Owner
|
||
|
StorageClass string
|
||
|
Initiated string
|
||
|
}
|
||
|
|
||
10 years ago
|
// CommonPrefix container for prefix response in ListObjectsResponse
|
||
|
type CommonPrefix struct {
|
||
10 years ago
|
Prefix string
|
||
|
}
|
||
|
|
||
10 years ago
|
// Bucket container for bucket metadata
|
||
10 years ago
|
type Bucket struct {
|
||
|
Name string
|
||
|
CreationDate string
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
// Object container for object metadata
|
||
|
type Object struct {
|
||
|
ETag string
|
||
10 years ago
|
Key string
|
||
|
LastModified string
|
||
10 years ago
|
Size int64
|
||
10 years ago
|
|
||
|
Owner Owner
|
||
|
|
||
|
// The class of storage used to store the object.
|
||
10 years ago
|
StorageClass string
|
||
|
}
|
||
|
|
||
10 years ago
|
// Initiator inherit from Owner struct, fields are same
|
||
|
type Initiator Owner
|
||
|
|
||
10 years ago
|
// Owner - bucket owner/principal
|
||
10 years ago
|
type Owner struct {
|
||
|
ID string
|
||
|
DisplayName string
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
// InitiateMultipartUploadResponse container for InitiateMultiPartUpload response, provides uploadID to start MultiPart upload
|
||
|
type InitiateMultipartUploadResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InitiateMultipartUploadResult" json:"-"`
|
||
10 years ago
|
|
||
|
Bucket string
|
||
|
Key string
|
||
|
UploadID string `xml:"UploadId"`
|
||
|
}
|
||
|
|
||
10 years ago
|
// CompleteMultipartUploadResponse container for completed multipart upload response
|
||
|
type CompleteMultipartUploadResponse struct {
|
||
10 years ago
|
XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUploadResult" json:"-"`
|
||
10 years ago
|
|
||
|
Location string
|
||
|
Bucket string
|
||
|
Key string
|
||
|
ETag string
|
||
|
}
|
||
|
|
||
10 years ago
|
// List of not implemented bucket queries
|
||
10 years ago
|
var notimplementedBucketResourceNames = map[string]bool{
|
||
10 years ago
|
"policy": true,
|
||
10 years ago
|
"cors": true,
|
||
10 years ago
|
"lifecycle": true,
|
||
|
"location": true,
|
||
|
"logging": true,
|
||
|
"notification": true,
|
||
10 years ago
|
"tagging": true,
|
||
10 years ago
|
"versions": true,
|
||
|
"requestPayment": true,
|
||
|
"versioning": true,
|
||
|
"website": true,
|
||
|
}
|
||
|
|
||
10 years ago
|
// List of not implemented object queries
|
||
10 years ago
|
var notimplementedObjectResourceNames = map[string]bool{
|
||
10 years ago
|
"torrent": true,
|
||
10 years ago
|
}
|