-
Notifications
You must be signed in to change notification settings - Fork 877
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
Issue #3365 - adding response metadata into enhanced response objects #3413
Open
petercipov
wants to merge
14
commits into
aws:master
Choose a base branch
from
petercipov:Issue-#3365
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
18605bb
Issue #3365 - adding request metadata into enhanced response objects
petercipov f18e2a1
adding change object
petercipov 1c9381b
fixing changes file
petercipov df4083b
removing unneeded imports
petercipov 6d284dd
removing obsolete imports
petercipov ac112ce
removing obsolete code
petercipov 9c10c65
fixing field accesibility
petercipov e69a80d
fixing/enhancing test cases
petercipov 8984dbe
fixing naming
petercipov 135af6b
adding test cases in functional tests
petercipov b8c28f8
Merge branch 'master' into Issue-#3365
petercipov 6233de7
Merge branch 'master' into Issue-#3365
petercipov 292d90c
Merge branch 'master' into Issue-#3365
petercipov 0c98f14
Merge branch 'master' into Issue-#3365
petercipov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"type": "feature", | ||
"category": "Amazon DynamoDB", | ||
"contributor": "petercipov", | ||
"description": "Pass DynamoDbResponseMetadata via ItemEnhancedResponse objects to retrieve requestId using enhanced client" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbAsyncTable; | ||
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable; | ||
import software.amazon.awssdk.services.dynamodb.model.ConsumedCapacity; | ||
import software.amazon.awssdk.services.dynamodb.model.DynamoDbResponseMetadata; | ||
import software.amazon.awssdk.services.dynamodb.model.ItemCollectionMetrics; | ||
import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse; | ||
|
||
|
@@ -38,11 +39,13 @@ public final class UpdateItemEnhancedResponse<T> { | |
private final T attributes; | ||
private final ConsumedCapacity consumedCapacity; | ||
private final ItemCollectionMetrics itemCollectionMetrics; | ||
private final DynamoDbResponseMetadata responseMetadata; | ||
|
||
private UpdateItemEnhancedResponse(Builder<T> builder) { | ||
this.attributes = builder.attributes; | ||
this.consumedCapacity = builder.consumedCapacity; | ||
this.itemCollectionMetrics = builder.itemCollectionMetrics; | ||
this.responseMetadata = builder.responseMetadata; | ||
} | ||
|
||
/** | ||
|
@@ -70,6 +73,14 @@ public ItemCollectionMetrics itemCollectionMetrics() { | |
return itemCollectionMetrics; | ||
} | ||
|
||
/** | ||
* The response metadata, f.e. requestId | ||
* @see UpdateItemResponse#responseMetadata() () | ||
*/ | ||
public DynamoDbResponseMetadata responseMetadata() { | ||
return responseMetadata; | ||
} | ||
|
||
public static <T> Builder<T> builder(Class<? extends T> clzz) { | ||
return new Builder<>(); | ||
} | ||
|
@@ -86,19 +97,22 @@ public boolean equals(Object o) { | |
UpdateItemEnhancedResponse<?> that = (UpdateItemEnhancedResponse<?>) o; | ||
return Objects.equals(attributes, that.attributes) | ||
&& Objects.equals(consumedCapacity, that.consumedCapacity) | ||
&& Objects.equals(itemCollectionMetrics, that.itemCollectionMetrics); | ||
&& Objects.equals(itemCollectionMetrics, that.itemCollectionMetrics) | ||
&& Objects.equals(responseMetadata, that.responseMetadata); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(attributes); | ||
result = 31 * result + Objects.hashCode(consumedCapacity); | ||
result = 31 * result + Objects.hashCode(itemCollectionMetrics); | ||
result = 31 * result + Objects.hashCode(responseMetadata); | ||
return result; | ||
} | ||
|
||
@NotThreadSafe | ||
public static final class Builder<T> { | ||
public DynamoDbResponseMetadata responseMetadata; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be Nit: put it as the last instance variable for consistency |
||
private T attributes; | ||
private ConsumedCapacity consumedCapacity; | ||
private ItemCollectionMetrics itemCollectionMetrics; | ||
|
@@ -118,6 +132,11 @@ public Builder<T> itemCollectionMetrics(ItemCollectionMetrics itemCollectionMetr | |
return this; | ||
} | ||
|
||
public Builder<T> responseMetadata(DynamoDbResponseMetadata responseMetadata) { | ||
this.responseMetadata = responseMetadata; | ||
return this; | ||
} | ||
|
||
public UpdateItemEnhancedResponse<T> build() { | ||
return new UpdateItemEnhancedResponse<>(this); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
private
as in DeleteItemEnhancedResponseNit: put it as the last instance variable for consistency