81 lines
1.7 KiB
Go
81 lines
1.7 KiB
Go
/*
|
|
* Minio Client (C) 2015 Minio, Inc.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
package s3
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"time"
|
|
)
|
|
|
|
//
|
|
type content struct {
|
|
Key string
|
|
LastModified time.Time
|
|
Size int64
|
|
}
|
|
|
|
// prefix
|
|
type prefix struct {
|
|
Prefix string
|
|
}
|
|
|
|
type listBucketResults struct {
|
|
Contents []*content
|
|
IsTruncated bool
|
|
MaxKeys int
|
|
Name string // bucket name
|
|
Marker string
|
|
Delimiter string
|
|
Prefix string
|
|
CommonPrefixes []*prefix
|
|
}
|
|
|
|
// Meta holds Amazon S3 client credentials and flags.
|
|
type Meta struct {
|
|
*Config
|
|
Transport http.RoundTripper // or nil for the default behavior
|
|
}
|
|
|
|
// Config - see http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html
|
|
type Config struct {
|
|
AccessKeyID string
|
|
SecretAccessKey string
|
|
HostURL string
|
|
UserAgent string
|
|
Debug bool
|
|
|
|
// Used for SSL transport layer
|
|
CertPEM string
|
|
KeyPEM string
|
|
}
|
|
|
|
// TLSConfig - TLS cert and key configuration
|
|
type TLSConfig struct {
|
|
CertPEMBlock []byte
|
|
KeyPEMBlock []byte
|
|
}
|
|
|
|
type s3Client struct {
|
|
*Meta
|
|
|
|
// Supports URL in following formats
|
|
// - http://<ipaddress>/<bucketname>/<object>
|
|
// - http://<bucketname>.<domain>/<object>
|
|
*url.URL
|
|
}
|