diff options
Diffstat (limited to 'vendor/github.com/minio/minio-go/api-put-object-encrypted.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/api-put-object-encrypted.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/vendor/github.com/minio/minio-go/api-put-object-encrypted.go b/vendor/github.com/minio/minio-go/api-put-object-encrypted.go index 534a21ecf..87dd1ab1a 100644 --- a/vendor/github.com/minio/minio-go/api-put-object-encrypted.go +++ b/vendor/github.com/minio/minio-go/api-put-object-encrypted.go @@ -1,5 +1,6 @@ /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 Minio, Inc. + * Minio Go Library for Amazon S3 Compatible Cloud Storage + * Copyright 2017 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +18,14 @@ package minio import ( + "context" "io" "github.com/minio/minio-go/pkg/encrypt" ) // PutEncryptedObject - Encrypt and store object. -func (c Client) PutEncryptedObject(bucketName, objectName string, reader io.Reader, encryptMaterials encrypt.Materials, metadata map[string][]string, progress io.Reader) (n int64, err error) { +func (c Client) PutEncryptedObject(bucketName, objectName string, reader io.Reader, encryptMaterials encrypt.Materials) (n int64, err error) { if encryptMaterials == nil { return 0, ErrInvalidArgument("Unable to recognize empty encryption properties") @@ -33,14 +35,10 @@ func (c Client) PutEncryptedObject(bucketName, objectName string, reader io.Read return 0, err } - if metadata == nil { - metadata = make(map[string][]string) - } - - // Set the necessary encryption headers, for future decryption. - metadata[amzHeaderIV] = []string{encryptMaterials.GetIV()} - metadata[amzHeaderKey] = []string{encryptMaterials.GetKey()} - metadata[amzHeaderMatDesc] = []string{encryptMaterials.GetDesc()} + return c.PutObjectWithContext(context.Background(), bucketName, objectName, reader, -1, PutObjectOptions{EncryptMaterials: encryptMaterials}) +} - return c.putObjectMultipartStreamNoLength(bucketName, objectName, encryptMaterials, metadata, progress) +// FPutEncryptedObject - Encrypt and store an object with contents from file at filePath. +func (c Client) FPutEncryptedObject(bucketName, objectName, filePath string, encryptMaterials encrypt.Materials) (n int64, err error) { + return c.FPutObjectWithContext(context.Background(), bucketName, objectName, filePath, PutObjectOptions{EncryptMaterials: encryptMaterials}) } |