-
Notifications
You must be signed in to change notification settings - Fork 878
Create separate operation-specific configs for the object-mapper Batch and Transact operations #3376
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
Merged
ashovlin
merged 5 commits into
feature/v4-ddb-separate-config
from
shovlia/v4-ddb-separate-batch
Jul 30, 2024
Merged
Create separate operation-specific configs for the object-mapper Batch and Transact operations #3376
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
15708fd
feat: Create separate operation-specific configs for the object-mappe…
ashovlin 2f5fb43
Add back existing optional overload, switch to base class
ashovlin 23f2122
Revert optionals on Context back to before
ashovlin 2c3afe6
One more
ashovlin 6895929
Add link to docs, and test that a property on the new operation-speci…
ashovlin 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 hidden or 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
54 changes: 54 additions & 0 deletions
54
sdk/src/Services/DynamoDBv2/Custom/DataModel/BatchGetConfig.cs
This file contains hidden or 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,54 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| using System; | ||
|
|
||
| namespace Amazon.DynamoDBv2.DataModel | ||
| { | ||
| /// <summary> | ||
| /// Input for the BatchGet operation in the object-persistence programming model | ||
| /// </summary> | ||
| #if NET8_0_OR_GREATER | ||
| // The DataModel namespace doesn't support trimming yet, so annotate public classes/methods as incompatible | ||
| [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(Custom.Internal.InternalConstants.RequiresUnreferencedCodeMessage)] | ||
| #endif | ||
| public class BatchGetConfig : BaseOperationConfig | ||
| { | ||
| /// <summary> | ||
| /// Property that directs <see cref="DynamoDBContext"/> to use consistent reads. | ||
| /// If property is not set, behavior defaults to non-consistent reads. | ||
| /// </summary> | ||
| public bool? ConsistentRead { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// If true, all <see cref="DateTime"/> properties are retrieved in UTC timezone while reading data from DynamoDB. Else, the local timezone is used. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This setting is only applicable to the high-level library. Service calls made via | ||
| /// <see cref="AmazonDynamoDBClient"/> will always return <see cref="DateTime"/> attributes in UTC. | ||
| /// </remarks> | ||
| public bool? RetrieveDateTimeInUtc { get; set; } | ||
|
|
||
| /// <inheritdoc/> | ||
| internal override DynamoDBOperationConfig ToDynamoDBOperationConfig() | ||
| { | ||
| var config = base.ToDynamoDBOperationConfig(); | ||
| config.ConsistentRead = ConsistentRead; | ||
| config.RetrieveDateTimeInUtc = RetrieveDateTimeInUtc; | ||
|
|
||
| return config; | ||
| } | ||
| } | ||
| } | ||
52 changes: 52 additions & 0 deletions
52
sdk/src/Services/DynamoDBv2/Custom/DataModel/BatchWriteConfig.cs
This file contains hidden or 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,52 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| namespace Amazon.DynamoDBv2.DataModel | ||
| { | ||
| /// <summary> | ||
| /// Input for the BatchWrite operation in the object-persistence programming model | ||
| /// </summary> | ||
| #if NET8_0_OR_GREATER | ||
| // The DataModel namespace doesn't support trimming yet, so annotate public classes/methods as incompatible | ||
| [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(Custom.Internal.InternalConstants.RequiresUnreferencedCodeMessage)] | ||
| #endif | ||
| public class BatchWriteConfig : BaseOperationConfig | ||
| { | ||
| /// <summary> | ||
| /// Property that directs <see cref="DynamoDBContext"/> to skip version checks | ||
| /// when saving or deleting an object with a version attribute. | ||
| /// If property is not set, version checks are performed. | ||
| /// </summary> | ||
| public bool? SkipVersionCheck { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Directs <see cref="DynamoDBContext" /> to ignore null values when | ||
| /// converting an object to a DynamoDB item. If the property is false | ||
| /// (or not set), null values will be interpreted as directives to | ||
| /// delete the specific attributes on the DynamoDB item. | ||
| /// </summary> | ||
| public bool? IgnoreNullValues { get; set; } | ||
|
|
||
| /// <inheritdoc/> | ||
| internal override DynamoDBOperationConfig ToDynamoDBOperationConfig() | ||
| { | ||
| var config = base.ToDynamoDBOperationConfig(); | ||
| config.SkipVersionCheck = SkipVersionCheck; | ||
| config.IgnoreNullValues = IgnoreNullValues; | ||
|
|
||
| return config; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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.
nit: Can you add a link to https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html in the property comment. This will helps users exercise better judgment while setting this value.
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 in 6895929