-
Notifications
You must be signed in to change notification settings - Fork 17
feat: multipart & ranged get examples #168
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
Conversation
… into imabhichow-examples-multipart # Conflicts: # src/examples/java/software/amazon/encryption/s3/examples/MultipartUploadExample.java # src/test/java/software/amazon/encryption/s3/examples/MultipartUploadExampleTest.java
} | ||
|
||
public static void AsyncClient(String bucket) { | ||
final String input = appendTestSuffix("PutAsyncGetAsync"); |
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 don't think we want to append test suffix to the input
import static software.amazon.encryption.s3.utils.S3EncryptionClientTestResources.appendTestSuffix; | ||
|
||
public class AsyncClientExample { | ||
public static final String OBJECT_KEY = "async-client-example"; |
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.
We are missing appending the test suffix here.
Since there's only one test,
we might as well just define the object key inside the 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.
We also use this Object Key for clean-up method.
|
||
// Instantiate the S3 Encryption Client to encrypt and decrypt | ||
// by specifying a KMS Key with the kmsKeyId builder parameter. | ||
// You must also specify the enableDelayedAuthenticationMode parameter to upload more than 64MB object or increase your default buffer size. |
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 isn't quite accurate - delayed auth is not required to upload objects larger than 64Mib/configured buffer size, only for download
// Asserts | ||
String inputAsString = IoUtils.toUtf8String(new BoundedInputStream(fileSizeLimit)); | ||
String outputAsString = IoUtils.toUtf8String(result.asInputStream()); | ||
assertEquals(inputAsString, outputAsString); |
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.
we should be doing something like:
assertTrue(IOUtils.contentEquals(objectStreamForResult, output));
to avoid buffering the entire object into 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.
ack!
public static void simpleAesGcmV3RangedGet(String bucket) { | ||
final String objectKey = appendTestSuffix("simple-v3-ranged-get-example"); | ||
|
||
// Instantiate the S3 Encryption Client by specifying an AES Key with the aesKey builder parameter. |
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.
Comment refers to AES key but the example uses KMS
v3Client.close(); | ||
} | ||
|
||
public static void aesGcmV3RangedGetOperations(String bucket) { |
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.
nit: let's add a comment mentioning that this example demonstrates how various unusual ranged get cases are handled
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.
LGTM!
## [3.1.0](v3.0.1...v3.1.0) (2023-08-31) ### Features * add configuration option to set max buffer size ([#166](#166)) ([ecf6e6c](ecf6e6c)) * multipart & ranged get examples ([#168](#168)) ([203e5dc](203e5dc)) * Refactor `KmsKeyring` to use `GenerateDataKey` instead of `Encrypt` ([#171](#171)) ([a1a22a4](a1a22a4)) ### Fixes * Create default wrapped clients only if necessary. ([#163](#163)) ([285eab6](285eab6)) * unwrap completion exception in AbortMultipartUpload and inside multipart putObject ([#174](#174)) ([84baad8](84baad8)) ### Maintenance * allow CI to run in forks ([#164](#164)) ([66a5ca4](66a5ca4)) * **deps-dev:** bump bcprov-jdk18on from 1.72 to 1.74 ([#169](#169)) ([5502eab](5502eab)) * fix bugs and nit ([#175](#175)) ([926818b](926818b)) * install dependabot ([#172](#172)) ([1c63fdb](1c63fdb)) * warn against use of Encryption Context for non-kms keyrings. ([#173](#173)) ([54557a9](54557a9))
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: