-
Notifications
You must be signed in to change notification settings - Fork 20
AWS-SDK Migration #2482
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
AWS-SDK Migration #2482
Conversation
Hello benzekrimaha,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
ad7e01e to
2f3ed00
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
f8e5940 to
942aa25
Compare
942aa25 to
f9f96ce
Compare
Wait, you say you've got two Jira ticket 514/524, but they both point to this same PR 🤔 |
| }); | ||
| }); | ||
|
|
||
| it('should create a new master encryption key', done => { |
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.
Looks like a duplicate of the first test "should support default encryption key per account" 🤔
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.
Up, still here
ghost
left 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.
This completes Sylvain's review. I think I covered everything that makes sense given what should probably change, so I'll come back once it's adressed
| listObjects(params, callback) { | ||
| return this.send(new ListObjectsCommand(params)) | ||
| .then(data => callback && callback(null, data)) | ||
| .catch(err => callback && callback(err)); | ||
| } |
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.
It could make sense to switch this file to ts, but the callback should be required?
If no you can do that
| listObjects(params, callback) { | |
| return this.send(new ListObjectsCommand(params)) | |
| .then(data => callback && callback(null, data)) | |
| .catch(err => callback && callback(err)); | |
| } | |
| listObjects(params, callback) { | |
| return this.send(new ListObjectsCommand(params)) | |
| .then(data => callback?.(null, data)) | |
| .catch(err => callback?.(err)); | |
| } |
But better to always call it?
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.
Added a few comments about GCP, I think we are adding lots of dead code: should be cleaned up (but maybe in a followup)
GcpClientclass in GcpService.js should be renamed to avoid confusion/duplicated type name → #2482 (comment)- It seems the functions in GcpApis are not used (they are 'added' in GcpService's class, but not called... some leftover before code was moved "inside" that class maybe, long before this PR ?) → #2482 (comment)
- the sdk v2 functions added in GcpClient.js seem weird : if we need to keep the old syntax, should be in AwsClient (esp. since the code there is not Gcp-specific) → #2482 (comment) and #2482 (comment)
- most sdk v2 functions added in GcpService.js seem not to be called → #2482 (comment) and #2482 (comment)
- code for MPU looks fishy: in GcpClient.js:121 we call
this._client.createMultipartUploadbut this call was not migrated to new SDK nor implemented in GcpService.js.... and thus I think MPU are not tested with GCP - DummyService.js should get cleaned' up → #2482 (comment)
| * - MPU (multipart upload) is emulated using GCP's compose/copy APIs. | ||
| * - All S3-compatible methods are available, with overrides for GCP quirks. | ||
| */ | ||
| class GcpClient extends S3Client { |
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.
should be rename GcpService or GCP to avoid having 2 times the same type, which can only create confusion
| listObjects(params, callback) { | ||
| return this.send(new ListObjectsCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } | ||
|
|
||
| putObject(params, callback) { | ||
| return this.send(new PutObjectCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } | ||
|
|
||
| getObject(params, callback) { | ||
| return this.send(new GetObjectCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } | ||
|
|
||
| deleteObject(params, callback) { | ||
| return this.send(new DeleteObjectCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } | ||
|
|
||
| copyObject(params, callback) { | ||
| return this.send(new CopyObjectCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } | ||
|
|
||
| headObject(params, callback) { | ||
| return this.send(new HeadObjectCommand(params)) | ||
| .then(data => callback?.(null, data)) | ||
| .catch(err => callback?.(err)); | ||
| } |
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.
if these functions are used/needed (i.e. part of the abstraction), they should be added to AwsClient ;
if not, they should not be added (at all)
| * @param {object} params - S3 upload params | ||
| * @param {function} callback | ||
| */ | ||
| upload(params, callback) { |
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.
all (or most of) these new functions are not used : this class is used as _client in GcpClient (.js), where only the following API are called:
headBucket, creatMultipoartUpdload, completeMultipartUpload, uploadPart, uploadPartCopy and abortMultipartUpload (in addition to the send method inherited from S3Client)
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.
actually it is matching: the functions renamed when they are exported, in index.js...
bb29518 to
fb21c07
Compare
As we can no longer use the Service.defineService previously used in aws-sdk v2, we have to manually this commit aims to implement the GCP client using the new aws-sdk v3 architecture and migrate the existing code to use it. Please note that now both the setup and signing mechanisms had to be re-implemented in the GcpService file. Issue: ARSN-514
Issue: ARSN-514
In this commit several changes were done as aws-sdk v3 happens to be less permissive than v2 in terms of error handling and stream management. To ensure backward compatibility with existing functionalities adjustments were made, please refer to code comments for more details. Issue: ARSN-514
As the sdk now returns name instead of code for errors, we need to adapt the error handling accordingly. Issue: ARSN-514
Issue: ARSN-514
Issue: ARSN-514
A security issue was fixed using resolutions in package.json as the vulnerability is in a transient dependency. Issue: ARSN-514
fb21c07 to
6e00a70
Compare
|
/bypass_author_approval |
6e00a70 to
00033b5
Compare
Issue: ARSN-514
Please note that a ticket has been creaed to add coverage not to make this PR more extended : https://scality.atlassian.net/browse/ARSN-524