-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PutEncryptedObject and FPutEncryptedObject calls #821
Conversation
api-put-object-encrypted.go
Outdated
) | ||
|
||
// 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait why are we doing it like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we do it like this:
PutEncryptedObject(bucket, object string, r io.Reader, mat encrypt.Materials) (int64,error)
api-put-object-encrypted.go
Outdated
return 0, err | ||
} | ||
|
||
m := make(map[string]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary - no metadata...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
api-put-object-file-encrypted.go
Outdated
) | ||
|
||
// FPutEncryptedObject - Encrypt and store an object with contents from file at filePath. | ||
func (c Client) FPutEncryptedObject(bucketName, objectName, filePath, contentType string, encryptMaterials encrypt.Materials) (n int64, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the contentType?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this
api-put-object.go
Outdated
func (opts PutObjectOptions) validate() (err error) { | ||
for k := range opts.UserMetadata { | ||
if isStandardHeader(k) || | ||
isCSEHeader(k) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not line-break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -230,3 +237,15 @@ func isStandardHeader(headerKey string) bool { | |||
} | |||
return false | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
3cb393d
to
531f7f2
Compare
api-put-object.go
Outdated
@@ -55,7 +55,7 @@ func (opts *PutObjectOptions) getNumThreads() (numThreads int) { | |||
|
|||
// getMetaData - constructs the headers from metadata entered by user in | |||
// PutObjectOptions struct | |||
func (opts *PutObjectOptions) getMetadata() (headers http.Header) { | |||
func (opts PutObjectOptions) getMetadata() (headers http.Header) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are at it let's rename this function to simply Header()
also the returned value is just header
not headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
api-put-object.go
Outdated
@@ -87,6 +87,15 @@ func (opts *PutObjectOptions) getMetadata() (headers http.Header) { | |||
return | |||
} | |||
|
|||
func (opts PutObjectOptions) validate() (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment.. and a unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Can you squash your changes @poornas ? |
- revive PutEncryptedObject call back, and add a FPutEncryptedObject variant.
done. |
Partially fixes #819.
variant. Options struct is now passed in without a pointer.
Leaving the Get calls for @aead.