chore: make const policy an extern#1587
Conversation
This reverts commit fd93806.
|
Detected changes to the release files or to the check-files action |
|
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
|
Detected changes to the release files or to the check-files action |
|
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
|
Detected changes to the release files or to the check-files action |
|
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
|
Detected changes to the release files or to the check-files action |
|
Changes to the release files or the check-files action requires 2 approvals from CODEOWNERS |
| public partial class InternalLegacyOverride | ||
| { | ||
|
|
||
| public software.amazon.cryptography.dbencryptionsdk.dynamodb.internaldafny.types._ILegacyPolicy _policy |
There was a problem hiding this comment.
I have tried following before reaching to this as solution:
- Directly add a constant
_policyin the class: This does not work because it should also be initialized with a constant in RHS andcreate_FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPTis not a constant. - Add a default constructor: We could have added a
_policyand initialize it in a default constructor but this will not work because dafny transpiles a default constructor into class InternalLegacyOverride and this will cause conflict.
So, the best solution here is to always return FORBID__LEGACY__ENCRYPT__FORBID__LEGACY__DECRYPT from the getter. This is the only place, this variable is going to be used. However, technically this variable is never used because config.internalLegacyOverride.Some? is always false for .NET (and Rust) because they don't support legacy
Issue #, if available:
Description of changes:
Dafny does not support transpiling a constant inside an extern for Go. So, this PR adds a
{:extern}into the constantpolicy. This will need an update to the extern because dafny will no longer generate code forpolicybut we need to write it as it is an extern. This is not a breaking change because we are only writing code in extern instead of dafny generating the code and no customer facing changes are expected.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.