Updating dependencies.
Этот коммит содержится в:
3
vendor/github.com/minio/minio-go/README.md
сгенерированный
поставляемый
3
vendor/github.com/minio/minio-go/README.md
сгенерированный
поставляемый
@@ -85,8 +85,9 @@ func main() {
|
||||
} else {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
} else {
|
||||
log.Printf("Successfully created %s\n", bucketName)
|
||||
}
|
||||
log.Printf("Successfully created %s\n", bucketName)
|
||||
|
||||
// Upload the zip file
|
||||
objectName := "golden-oldies.zip"
|
||||
|
||||
8
vendor/github.com/minio/minio-go/api-compose-object.go
сгенерированный
поставляемый
8
vendor/github.com/minio/minio-go/api-compose-object.go
сгенерированный
поставляемый
@@ -362,10 +362,10 @@ func (c Client) ComposeObjectWithProgress(dst DestinationInfo, srcs []SourceInfo
|
||||
srcSizes := make([]int64, len(srcs))
|
||||
var totalSize, size, totalParts int64
|
||||
var srcUserMeta map[string]string
|
||||
var etag string
|
||||
etags := make([]string, len(srcs))
|
||||
var err error
|
||||
for i, src := range srcs {
|
||||
size, etag, srcUserMeta, err = src.getProps(c)
|
||||
size, etags[i], srcUserMeta, err = src.getProps(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -426,9 +426,9 @@ func (c Client) ComposeObjectWithProgress(dst DestinationInfo, srcs []SourceInfo
|
||||
|
||||
// 1. Ensure that the object has not been changed while
|
||||
// we are copying data.
|
||||
for _, src := range srcs {
|
||||
for i, src := range srcs {
|
||||
if src.Headers.Get("x-amz-copy-source-if-match") == "" {
|
||||
src.SetMatchETagCond(etag)
|
||||
src.SetMatchETagCond(etags[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
vendor/github.com/minio/minio-go/api-stat.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/api-stat.go
сгенерированный
поставляемый
@@ -47,6 +47,10 @@ func (c Client) BucketExists(bucketName string) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
if resp != nil {
|
||||
resperr := httpRespToErrorResponse(resp, bucketName, "")
|
||||
if ToErrorResponse(resperr).Code == "NoSuchBucket" {
|
||||
return false, nil
|
||||
}
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return false, httpRespToErrorResponse(resp, bucketName, "")
|
||||
}
|
||||
|
||||
4
vendor/github.com/minio/minio-go/api.go
сгенерированный
поставляемый
4
vendor/github.com/minio/minio-go/api.go
сгенерированный
поставляемый
@@ -99,7 +99,7 @@ type Options struct {
|
||||
// Global constants.
|
||||
const (
|
||||
libraryName = "minio-go"
|
||||
libraryVersion = "v6.0.7"
|
||||
libraryVersion = "v6.0.11"
|
||||
)
|
||||
|
||||
// User Agent should always following the below style.
|
||||
@@ -820,7 +820,7 @@ func (c Client) makeTargetURL(bucketName, objectName, bucketLocation string, isV
|
||||
host = c.s3AccelerateEndpoint
|
||||
} else {
|
||||
// Do not change the host if the endpoint URL is a FIPS S3 endpoint.
|
||||
if !s3utils.IsAmazonFIPSGovCloudEndpoint(*c.endpointURL) {
|
||||
if !s3utils.IsAmazonFIPSEndpoint(*c.endpointURL) {
|
||||
// Fetch new host based on the bucket location.
|
||||
host = getS3Endpoint(bucketLocation)
|
||||
}
|
||||
|
||||
2
vendor/github.com/minio/minio-go/appveyor.yml
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/appveyor.yml
сгенерированный
поставляемый
@@ -16,7 +16,7 @@ install:
|
||||
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
|
||||
- go version
|
||||
- go env
|
||||
- go get -u github.com/golang/lint/golint
|
||||
- go get -u golang.org/x/lint/golint
|
||||
- go get -u github.com/remyoudompheng/go-misc/deadcode
|
||||
- go get -u github.com/gordonklaus/ineffassign
|
||||
- go get -u golang.org/x/crypto/argon2
|
||||
|
||||
6
vendor/github.com/minio/minio-go/core.go
сгенерированный
поставляемый
6
vendor/github.com/minio/minio-go/core.go
сгенерированный
поставляемый
@@ -117,11 +117,11 @@ func (c Core) ListObjectParts(bucket, object, uploadID string, partNumberMarker
|
||||
}
|
||||
|
||||
// CompleteMultipartUpload - Concatenate uploaded parts and commit to an object.
|
||||
func (c Core) CompleteMultipartUpload(bucket, object, uploadID string, parts []CompletePart) error {
|
||||
_, err := c.completeMultipartUpload(context.Background(), bucket, object, uploadID, completeMultipartUpload{
|
||||
func (c Core) CompleteMultipartUpload(bucket, object, uploadID string, parts []CompletePart) (string, error) {
|
||||
res, err := c.completeMultipartUpload(context.Background(), bucket, object, uploadID, completeMultipartUpload{
|
||||
Parts: parts,
|
||||
})
|
||||
return err
|
||||
return res.ETag, err
|
||||
}
|
||||
|
||||
// AbortMultipartUpload - Abort an incomplete upload.
|
||||
|
||||
148
vendor/github.com/minio/minio-go/functional_tests.go
сгенерированный
поставляемый
148
vendor/github.com/minio/minio-go/functional_tests.go
сгенерированный
поставляемый
@@ -5692,6 +5692,153 @@ func testDecryptedCopyObject() {
|
||||
successLogger(testName, function, args, startTime).Info()
|
||||
}
|
||||
|
||||
// Test Core CopyObjectPart implementation
|
||||
func testCoreEncryptedCopyObjectPart() {
|
||||
// initialize logging params
|
||||
startTime := time.Now()
|
||||
testName := getFuncName()
|
||||
function := "CopyObjectPart(destination, source)"
|
||||
args := map[string]interface{}{}
|
||||
|
||||
// Instantiate new minio client object
|
||||
client, err := minio.NewV4(
|
||||
os.Getenv(serverEndpoint),
|
||||
os.Getenv(accessKey),
|
||||
os.Getenv(secretKey),
|
||||
mustParseBool(os.Getenv(enableHTTPS)),
|
||||
)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "Minio v4 client object creation failed", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Instantiate new core client object.
|
||||
c := minio.Core{client}
|
||||
|
||||
// Enable tracing, write to stderr.
|
||||
// c.TraceOn(os.Stderr)
|
||||
|
||||
// Set user agent.
|
||||
c.SetAppInfo("Minio-go-FunctionalTest", "0.1.0")
|
||||
|
||||
// Generate a new random bucket name.
|
||||
bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test")
|
||||
|
||||
// Make a new bucket.
|
||||
err = c.MakeBucket(bucketName, "us-east-1")
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "MakeBucket failed", err)
|
||||
}
|
||||
defer cleanupBucket(bucketName, client)
|
||||
// Make a buffer with 5MB of data
|
||||
buf := bytes.Repeat([]byte("abcde"), 1024*1024)
|
||||
|
||||
// Save the data
|
||||
objectName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
|
||||
password := "correct horse battery staple"
|
||||
srcencryption := encrypt.DefaultPBKDF([]byte(password), []byte(bucketName+objectName))
|
||||
|
||||
objInfo, err := c.PutObject(bucketName, objectName, bytes.NewReader(buf), int64(len(buf)), "", "", map[string]string{
|
||||
"Content-Type": "binary/octet-stream",
|
||||
}, srcencryption)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "PutObject call failed", err)
|
||||
}
|
||||
|
||||
if objInfo.Size != int64(len(buf)) {
|
||||
logError(testName, function, args, startTime, "", fmt.Sprintf("Error: number of bytes does not match, want %v, got %v\n", len(buf), objInfo.Size), err)
|
||||
}
|
||||
|
||||
destBucketName := bucketName
|
||||
destObjectName := objectName + "-dest"
|
||||
dstencryption := encrypt.DefaultPBKDF([]byte(password), []byte(destBucketName+destObjectName))
|
||||
|
||||
uploadID, err := c.NewMultipartUpload(destBucketName, destObjectName, minio.PutObjectOptions{ServerSideEncryption: dstencryption})
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "NewMultipartUpload call failed", err)
|
||||
}
|
||||
|
||||
// Content of the destination object will be two copies of
|
||||
// `objectName` concatenated, followed by first byte of
|
||||
// `objectName`.
|
||||
metadata := make(map[string]string)
|
||||
header := make(http.Header)
|
||||
encrypt.SSECopy(srcencryption).Marshal(header)
|
||||
dstencryption.Marshal(header)
|
||||
for k, v := range header {
|
||||
metadata[k] = v[0]
|
||||
}
|
||||
// First of three parts
|
||||
fstPart, err := c.CopyObjectPart(bucketName, objectName, destBucketName, destObjectName, uploadID, 1, 0, -1, metadata)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "CopyObjectPart call failed", err)
|
||||
}
|
||||
|
||||
// Second of three parts
|
||||
sndPart, err := c.CopyObjectPart(bucketName, objectName, destBucketName, destObjectName, uploadID, 2, 0, -1, metadata)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "CopyObjectPart call failed", err)
|
||||
}
|
||||
|
||||
// Last of three parts
|
||||
lstPart, err := c.CopyObjectPart(bucketName, objectName, destBucketName, destObjectName, uploadID, 3, 0, 1, metadata)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "CopyObjectPart call failed", err)
|
||||
}
|
||||
|
||||
// Complete the multipart upload
|
||||
_, err = c.CompleteMultipartUpload(destBucketName, destObjectName, uploadID, []minio.CompletePart{fstPart, sndPart, lstPart})
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "CompleteMultipartUpload call failed", err)
|
||||
}
|
||||
|
||||
// Stat the object and check its length matches
|
||||
objInfo, err = c.StatObject(destBucketName, destObjectName, minio.StatObjectOptions{minio.GetObjectOptions{ServerSideEncryption: dstencryption}})
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "StatObject call failed", err)
|
||||
}
|
||||
|
||||
if objInfo.Size != (5*1024*1024)*2+1 {
|
||||
logError(testName, function, args, startTime, "", "Destination object has incorrect size!", err)
|
||||
}
|
||||
|
||||
// Now we read the data back
|
||||
getOpts := minio.GetObjectOptions{ServerSideEncryption: dstencryption}
|
||||
getOpts.SetRange(0, 5*1024*1024-1)
|
||||
r, _, err := c.GetObject(destBucketName, destObjectName, getOpts)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "GetObject call failed", err)
|
||||
}
|
||||
getBuf := make([]byte, 5*1024*1024)
|
||||
_, err = io.ReadFull(r, getBuf)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "Read buffer failed", err)
|
||||
}
|
||||
if !bytes.Equal(getBuf, buf) {
|
||||
logError(testName, function, args, startTime, "", "Got unexpected data in first 5MB", err)
|
||||
}
|
||||
|
||||
getOpts.SetRange(5*1024*1024, 0)
|
||||
r, _, err = c.GetObject(destBucketName, destObjectName, getOpts)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "GetObject call failed", err)
|
||||
}
|
||||
getBuf = make([]byte, 5*1024*1024+1)
|
||||
_, err = io.ReadFull(r, getBuf)
|
||||
if err != nil {
|
||||
logError(testName, function, args, startTime, "", "Read buffer failed", err)
|
||||
}
|
||||
if !bytes.Equal(getBuf[:5*1024*1024], buf) {
|
||||
logError(testName, function, args, startTime, "", "Got unexpected data in second 5MB", err)
|
||||
}
|
||||
if getBuf[5*1024*1024] != buf[0] {
|
||||
logError(testName, function, args, startTime, "", "Got unexpected data in last byte of copied object!", err)
|
||||
}
|
||||
|
||||
successLogger(testName, function, args, startTime).Info()
|
||||
|
||||
// Do not need to remove destBucketName its same as bucketName.
|
||||
}
|
||||
func testUserMetadataCopying() {
|
||||
// initialize logging params
|
||||
startTime := time.Now()
|
||||
@@ -7661,6 +7808,7 @@ func main() {
|
||||
testEncryptedCopyObject()
|
||||
testEncryptedEmptyObject()
|
||||
testDecryptedCopyObject()
|
||||
testCoreEncryptedCopyObjectPart()
|
||||
}
|
||||
} else {
|
||||
testFunctional()
|
||||
|
||||
54
vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go
сгенерированный
поставляемый
54
vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go
сгенерированный
поставляемый
@@ -21,8 +21,10 @@ import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
)
|
||||
@@ -50,16 +52,25 @@ type IAM struct {
|
||||
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
|
||||
const (
|
||||
defaultIAMRoleEndpoint = "http://169.254.169.254"
|
||||
defaultECSRoleEndpoint = "http://169.254.170.2"
|
||||
defaultIAMSecurityCredsPath = "/latest/meta-data/iam/security-credentials"
|
||||
)
|
||||
|
||||
// https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html
|
||||
func getEndpoint(endpoint string) (string, bool) {
|
||||
if endpoint != "" {
|
||||
return endpoint, os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") != ""
|
||||
}
|
||||
if ecsURI := os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"); ecsURI != "" {
|
||||
return fmt.Sprintf("%s%s", defaultECSRoleEndpoint, ecsURI), true
|
||||
}
|
||||
return defaultIAMRoleEndpoint, false
|
||||
}
|
||||
|
||||
// NewIAM returns a pointer to a new Credentials object wrapping
|
||||
// the IAM. Takes a ConfigProvider to create a EC2Metadata client.
|
||||
// The ConfigProvider is satisfied by the session.Session type.
|
||||
func NewIAM(endpoint string) *Credentials {
|
||||
if endpoint == "" {
|
||||
endpoint = defaultIAMRoleEndpoint
|
||||
}
|
||||
p := &IAM{
|
||||
Client: &http.Client{
|
||||
Transport: http.DefaultTransport,
|
||||
@@ -73,11 +84,17 @@ func NewIAM(endpoint string) *Credentials {
|
||||
// Error will be returned if the request fails, or unable to extract
|
||||
// the desired
|
||||
func (m *IAM) Retrieve() (Value, error) {
|
||||
roleCreds, err := getCredentials(m.Client, m.endpoint)
|
||||
endpoint, isEcsTask := getEndpoint(m.endpoint)
|
||||
var roleCreds ec2RoleCredRespBody
|
||||
var err error
|
||||
if isEcsTask {
|
||||
roleCreds, err = getEcsTaskCredentials(m.Client, endpoint)
|
||||
} else {
|
||||
roleCreds, err = getCredentials(m.Client, endpoint)
|
||||
}
|
||||
if err != nil {
|
||||
return Value{}, err
|
||||
}
|
||||
|
||||
// Expiry window is set to 10secs.
|
||||
m.SetExpiration(roleCreds.Expiration, DefaultExpiryWindow)
|
||||
|
||||
@@ -111,9 +128,6 @@ type ec2RoleCredRespBody struct {
|
||||
// be sent to fetch the rolling access credentials.
|
||||
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
|
||||
func getIAMRoleURL(endpoint string) (*url.URL, error) {
|
||||
if endpoint == "" {
|
||||
endpoint = defaultIAMRoleEndpoint
|
||||
}
|
||||
u, err := url.Parse(endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -153,12 +167,36 @@ func listRoleNames(client *http.Client, u *url.URL) ([]string, error) {
|
||||
return credsList, nil
|
||||
}
|
||||
|
||||
func getEcsTaskCredentials(client *http.Client, endpoint string) (ec2RoleCredRespBody, error) {
|
||||
req, err := http.NewRequest("GET", endpoint, nil)
|
||||
if err != nil {
|
||||
return ec2RoleCredRespBody{}, err
|
||||
}
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return ec2RoleCredRespBody{}, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return ec2RoleCredRespBody{}, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
respCreds := ec2RoleCredRespBody{}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&respCreds); err != nil {
|
||||
return ec2RoleCredRespBody{}, err
|
||||
}
|
||||
|
||||
return respCreds, nil
|
||||
}
|
||||
|
||||
// getCredentials - obtains the credentials from the IAM role name associated with
|
||||
// the current EC2 service.
|
||||
//
|
||||
// If the credentials cannot be found, or there is an error
|
||||
// reading the response an error will be returned.
|
||||
func getCredentials(client *http.Client, endpoint string) (ec2RoleCredRespBody, error) {
|
||||
|
||||
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
|
||||
u, err := getIAMRoleURL(endpoint)
|
||||
if err != nil {
|
||||
|
||||
31
vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
сгенерированный
поставляемый
31
vendor/github.com/minio/minio-go/pkg/s3utils/utils.go
сгенерированный
поставляемый
@@ -143,11 +143,40 @@ func IsAmazonGovCloudEndpoint(endpointURL url.URL) bool {
|
||||
}
|
||||
|
||||
// IsAmazonFIPSGovCloudEndpoint - Match if it is exactly Amazon S3 FIPS GovCloud endpoint.
|
||||
// See https://aws.amazon.com/compliance/fips.
|
||||
func IsAmazonFIPSGovCloudEndpoint(endpointURL url.URL) bool {
|
||||
if endpointURL == sentinelURL {
|
||||
return false
|
||||
}
|
||||
return endpointURL.Host == "s3-fips-us-gov-west-1.amazonaws.com"
|
||||
return endpointURL.Host == "s3-fips-us-gov-west-1.amazonaws.com" ||
|
||||
endpointURL.Host == "s3-fips.dualstack.us-gov-west-1.amazonaws.com"
|
||||
}
|
||||
|
||||
// IsAmazonFIPSUSEastWestEndpoint - Match if it is exactly Amazon S3 FIPS US East/West endpoint.
|
||||
// See https://aws.amazon.com/compliance/fips.
|
||||
func IsAmazonFIPSUSEastWestEndpoint(endpointURL url.URL) bool {
|
||||
if endpointURL == sentinelURL {
|
||||
return false
|
||||
}
|
||||
switch endpointURL.Host {
|
||||
case "s3-fips.us-east-2.amazonaws.com":
|
||||
case "s3-fips.dualstack.us-west-1.amazonaws.com":
|
||||
case "s3-fips.dualstack.us-west-2.amazonaws.com":
|
||||
case "s3-fips.dualstack.us-east-2.amazonaws.com":
|
||||
case "s3-fips.dualstack.us-east-1.amazonaws.com":
|
||||
case "s3-fips.us-west-1.amazonaws.com":
|
||||
case "s3-fips.us-west-2.amazonaws.com":
|
||||
case "s3-fips.us-east-1.amazonaws.com":
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// IsAmazonFIPSEndpoint - Match if it is exactly Amazon S3 FIPS endpoint.
|
||||
// See https://aws.amazon.com/compliance/fips.
|
||||
func IsAmazonFIPSEndpoint(endpointURL url.URL) bool {
|
||||
return IsAmazonFIPSUSEastWestEndpoint(endpointURL) || IsAmazonFIPSGovCloudEndpoint(endpointURL)
|
||||
}
|
||||
|
||||
// IsGoogleEndpoint - Match if it is exactly Google cloud storage endpoint.
|
||||
|
||||
22
vendor/github.com/minio/minio-go/post-policy.go
сгенерированный
поставляемый
22
vendor/github.com/minio/minio-go/post-policy.go
сгенерированный
поставляемый
@@ -206,6 +206,28 @@ func (p *PostPolicy) SetUserMetadata(key string, value string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetUserData - Set user data as a key/value couple.
|
||||
// Can be retrieved through a HEAD request or an event.
|
||||
func (p *PostPolicy) SetUserData(key string, value string) error {
|
||||
if key == "" {
|
||||
return ErrInvalidArgument("Key is empty")
|
||||
}
|
||||
if value == "" {
|
||||
return ErrInvalidArgument("Value is empty")
|
||||
}
|
||||
headerName := fmt.Sprintf("x-amz-%s", key)
|
||||
policyCond := policyCondition{
|
||||
matchType: "eq",
|
||||
condition: fmt.Sprintf("$%s", headerName),
|
||||
value: value,
|
||||
}
|
||||
if err := p.addNewPolicy(policyCond); err != nil {
|
||||
return err
|
||||
}
|
||||
p.formData[headerName] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
// addNewPolicy - internal helper to validate adding new policies.
|
||||
func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error {
|
||||
if policyCond.matchType == "" || policyCond.condition == "" || policyCond.value == "" {
|
||||
|
||||
2
vendor/github.com/minio/minio-go/s3-error.go
сгенерированный
поставляемый
2
vendor/github.com/minio/minio-go/s3-error.go
сгенерированный
поставляемый
@@ -34,7 +34,7 @@ var s3ErrorResponseMap = map[string]string{
|
||||
"MissingContentLength": "You must provide the Content-Length HTTP header.",
|
||||
"MissingContentMD5": "Missing required header for this request: Content-Md5.",
|
||||
"MissingRequestBodyError": "Request body is empty.",
|
||||
"NoSuchBucket": "The specified bucket does not exist",
|
||||
"NoSuchBucket": "The specified bucket does not exist.",
|
||||
"NoSuchBucketPolicy": "The bucket policy does not exist",
|
||||
"NoSuchKey": "The specified key does not exist.",
|
||||
"NoSuchUpload": "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed.",
|
||||
|
||||
Ссылка в новой задаче
Block a user