Skip to content
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

feat: dotnet examples #482

Merged
merged 43 commits into from
Nov 18, 2023
Merged

feat: dotnet examples #482

merged 43 commits into from
Nov 18, 2023

Conversation

ajewellamz
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that these are used somewhere.
Should we put this list in Dafny so that every runtime has access to the same strings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same list used in the Java example.
I presume that once I've moved over all the examples, that all these will be used.
Putting them in a central place seems reasonable. I'm not sure Dafny is the right choice, but maybe I just don't see whatever you're envisioning.

Copy link
Contributor

@lucasmcdonald3 lucasmcdonald3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not looped in on our current plans for repos/languages, but:
Do we actually want to put this in the DDB-Java repo?

Comment on lines +31 to +32
var kmsKeyId = TestUtils.TEST_KMS_KEY_ID;
var ddbTableName = TestUtils.TEST_DDB_TABLE_NAME;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users should be able to pass in their own resource ARNs via a CLI args.

Two questions:

  1. Could you have PutItemGetItem take in these arguments?
  2. Could you add a main method to the bottom of this file that takes in command-line arguments and passes them to PutItemGetItem?

@@ -0,0 +1,19 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users should be able to execute examples independently of one another.
I think you should remove this file in favor of per-example Main methods.
Also for parsing args and passing them into the example method.

using System;
public class TestUtils
{
public static readonly string TEST_KEYSTORE_NAME = "KeyStoreDdbTable";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this go in a runtimes/net/tests or similar directory?
Then add a Tests.csproj file that executes the tests similar to https://github.com/aws/aws-encryption-sdk-dafny/blob/mainline/aws-encryption-sdk-net/Test/AWSEncryptionSDKTests.csproj

@@ -32,7 +32,7 @@ module PutItemTransform {
//= type=implication
//# The PutItem request MUST NOT refer to any legacy parameters,
//# specifically Expected and ConditionalOperator MUST NOT be set.
&& input.sdkInput.Expected.None? && input.sdkInput.ConditionalOperator.None?
&& NoMap(input.sdkInput.Expected) && input.sdkInput.ConditionalOperator.None?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. If this is all that is needed to handle empty, we should change Java.
(But treat DDB's AttributeValue specially)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an optional map or list, the dotnet AWS SDK can't distinguish empty from None (since it hides the IsSet method).
This should be safe for java, since the smithy says "Optional non-empty".
I don't understand what you mean by "we should change java" -- as far as I can tell, Java is right and dotnet is wrong.

@ajewellamz ajewellamz marked this pull request as ready for review October 18, 2023 18:53
@ajewellamz ajewellamz requested a review from a team as a code owner October 18, 2023 18:53
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>10</LangVersion>
<TargetFramework>net6.0</TargetFramework>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a breaking change. I don't think we can do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point recently, it told me MPL didn't support net48. Maybe changing ProjectReference to PackageReference will fix that.

<ItemGroup>
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.300.2"/>
<PackageReference Include="AWSSDK.Core" Version="3.7.300.2"/>
<ProjectReference Include="../../../submodules/MaterialProviders/AwsCryptographicMaterialProviders/runtimes/net/MPL.csproj" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this will work when the code is published.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll switch it back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josecorella I think that the sub-module MPL here is only 6.0,
but I think that upstream is 6 and 4.8?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajewellamz we should update the mpl submodule in this pr to point to the latest mpl changes

Comment on lines -183 to +114
"BS": []
"BS": [""]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because empty sets are illegal. I don't know how is passed in Java.

Copy link
Contributor

@seebees seebees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajewellamz ajewellamz merged commit 2d36a34 into main Nov 18, 2023
21 checks passed
@ajewellamz ajewellamz deleted the dotnet-example branch November 18, 2023 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants