-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Updated six S3 examples. #1922
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
Updated six S3 examples. #1922
Conversation
{ | ||
string bucketName = "doc-example-bucket"; | ||
|
||
// If the AWS region defined for your default user is different |
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.
AWS Region on first use , Region thereafter. I won't repeat this 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.
fixed
string bucketName = "doc-example-bucket"; | ||
|
||
// If the AWS region defined for your default user is different | ||
// from the AWS regsion where your Amazon S3 bucket is located, |
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.
Region
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.
Fixed
} | ||
|
||
/// <summary> | ||
/// Makes the call to abort the multi-part copy process. |
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.
Just "Aborts ..."
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.
Changed
/// <param name="client">The initialized client object used to create | ||
/// the TransferUtility object.</param> | ||
/// <param name="bucketName">The name of the multi-part copy operation | ||
/// is in progress.</param> |
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.
that is in
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.
fixed
string filePath, | ||
string base64Key) | ||
{ | ||
// List to store upload part responses. |
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.
The list
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.
When I looked at this one, it seems that anyone who knows C# would know his is a generic List of Responses. I removed the comment altogether.
// Upload the object. | ||
PutObjectRequest putObjectRequest = await UploadObjectAsync(client, bucketName, keyName, base64Key); | ||
|
||
// Download the object and verify that its contents matche what you uploaded. |
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.
match
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.
fixed
await GetObjectMetadataAsync(client, bucketName, keyName, base64Key); | ||
|
||
// Copy both the source and target objects using server-side encryption with | ||
// a customer-provided encryption key. |
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.
delete "customer-provided"
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.
changed to "an encryption key."
/// </summary> | ||
/// <param name="client">The initialized S3 client object used to call | ||
/// CopyObjectAsync.</param> | ||
/// <param name="bucketName">The S3 bucket containing the object we |
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.
delete "we wish"
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.
changed
|
||
/// <summary> | ||
/// This method grants appropriate permissions for logging to the | ||
/// S3 bucket where the logs will be stored. |
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.
S3 -> Amazon S3. I won't repeat this 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.
S3 is correct in this instance. First time Amazon Simple Storage Service (Amazon S3), 2nd time Amazon S3, and third time only S3.
/// file you want to upload.</param> | ||
/// <param name="url">The presigned URL that will be used to upload the | ||
/// file to the S3 bucket.</param> | ||
/// <returns>A boolean value indicating the success or failure of the |
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.
Boolean
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.
fixed
string bucketName = "doc-example-bucket"; | ||
|
||
// If the AWS Region defined for your default user is different | ||
// from the Regsion where your Amazon S3 bucket is located, |
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.
Region
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.
Fixed
} | ||
|
||
/// <summary> | ||
/// Aborts the multi-part copy process. |
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.
Aborts -> Cancels
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.
changed
/// </summary> | ||
/// <param name="client">The initialized client object used to create | ||
/// the TransferUtility object.</param> | ||
/// <param name="bucketName">The name of the multi-part copy operation |
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.
The parameter name and comment aren't compatible.
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.
Changed to:
The name of the S3 bucket where the multi-part copy operation is in progress.
{ | ||
var transferUtility = new TransferUtility(client); | ||
|
||
// Abort all in-progress uploads initiated before the specified date. |
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.
Abort -> Cancel
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.
Changed
string filePath = $"sample\\{targetKeyName}"; | ||
|
||
// If the AWS Region defined for your default user is different | ||
// from the Regsion where your Amazon S3 bucket is located, |
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.
Region
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.
fixed
/// <summary> | ||
/// Creates the encryption key to use with the multi-part upload. | ||
/// </summary> | ||
/// <returns>A string containing the base64 key for encrypting the |
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.
base64-encoded
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.
fixed
string copyTargetKeyName = "examplecopy.txt"; | ||
|
||
// If the AWS Region defined for your default user is different | ||
// from the Regsion where your Amazon S3 bucket is located, |
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.
Region
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.
Fixed
Console.WriteLine("Error...Object encryption method is not the same as AES256 we set"); | ||
} | ||
|
||
// Assert.AreEqual(putObjectRequest.ContentBody, content); |
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.
Did you mean to leave these in here?
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.
Shouldn't have been there. Removed.
|
||
GetObjectMetadataResponse getObjectMetadataResponse = await client.GetObjectMetadataAsync(getObjectMetadataRequest); | ||
Console.WriteLine("The object metadata show encryption method used is: {0}", getObjectMetadataResponse.ServerSideEncryptionCustomerMethod); | ||
// Assert.AreEqual(ServerSideEncryptionCustomerMethod.AES256, getObjectMetadataResponse.ServerSideEncryptionCustomerMethod); |
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.
Did you mean to leave this here?
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.
Shouldn't have been there. Removed.
string logObjectKeyPrefix = "Logs"; | ||
|
||
// If the AWS Region defined for your default user is different | ||
// from the Regsion where your Amazon S3 bucket is located, |
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.
Region
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.
Fixed.
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.
Also fixed the same error in:
ServerSideEncryptionExample
UploadUsingPresignedURLExample
aws-doc-sdk-examples Pull Request
Thank you for making a submission to the aws-doc-sdk-examples repository. For more information about submitting pull requests to this repository, see Guidelines for contributing.
NOTE: This PR template contains three sections. Depending on the reason for your pull request, please fill out the section that applies to you and then remove the other two sections.
Existing Example Update
The following examples have been updated:
The submitter has:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.