Skip to content

Commit

Permalink
fix: Smithy Generated Python was poorly rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
texastony committed Nov 4, 2024
1 parent 5c965c0 commit b230ed1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 264 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -312,30 +312,6 @@ def aws_cryptography_keystore_WriteInitializeMutationInput(dafny_input):
mutation_index=aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.MutationIndex
),
mutation_index=(
(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.MutationIndex.value
)
)
if (dafny_input.MutationIndex.is_Some)
else None
),
over_write_mutation_index=(
(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_OverWriteMutationIndex(
dafny_input.OverWriteMutationIndex.value
)
)
if (dafny_input.OverWriteMutationIndex.is_Some)
else None
),
versions=[
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_OverWriteEncryptedHierarchicalKey(
list_element
)
for list_element in dafny_input.Versions
],
)


Expand Down Expand Up @@ -432,25 +408,8 @@ def aws_cryptography_keystore_WriteMutatedVersionsOutput(dafny_input):
)


def aws_cryptography_keystore_UpdateMutationIndexInput(dafny_input):
return aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexInput(
mutation_index=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.MutationIndex
),
old_mutation_index=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.OldMutationIndex
),
)


def aws_cryptography_keystore_UpdateMutationIndexOutput(dafny_input):
return (
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexOutput()
)


def aws_cryptography_keystore_GetMutationLockInput(dafny_input):
return aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationLockInput(
def aws_cryptography_keystore_GetMutationInput(dafny_input):
return aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationInput(
identifier=b"".join(
ord(c).to_bytes(2, "big") for c in dafny_input.Identifier
).decode("utf-16-be"),
Expand All @@ -465,7 +424,16 @@ def aws_cryptography_keystore_GetMutationOutput(dafny_input):
dafny_input.MutationCommitment.value
)
)
if (dafny_input.MutationLock.is_Some)
if (dafny_input.MutationCommitment.is_Some)
else None
),
mutation_index=(
(
aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.MutationIndex.value
)
)
if (dafny_input.MutationIndex.is_Some)
else None
),
)
Expand Down Expand Up @@ -502,23 +470,6 @@ def aws_cryptography_keystore_WriteMutationIndexOutput(dafny_input):
)


def aws_cryptography_keystore_WriteMutationIndexInput(dafny_input):
return aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexInput(
mutation_commitment=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationCommitment(
dafny_input.MutationCommitment
),
mutation_index=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_MutationIndex(
dafny_input.MutationIndex
),
)


def aws_cryptography_keystore_WriteMutationIndexOutput(dafny_input):
return (
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexOutput()
)


def smithy_api_Unit():
return (
aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.Unit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,9 @@ def write_mutated_versions(
@abc.abstractmethod
def get_mutation(
self,
param: "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexInput",
) -> "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexOutput":
"""Updates a Mutation Index."""
raise NotImplementedError

@abc.abstractmethod
def get_mutation_lock(
self,
param: "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationLockInput",
) -> "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationLockOutput":
"""Check for Mutation Lock on a Branch Key ID.
param: "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationInput",
) -> "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationOutput":
"""Check for Mutation Commitment on a Branch Key ID.
If one exists, returns the Mutation Lock. Otherwise, returns
nothing.
Expand Down Expand Up @@ -273,19 +265,6 @@ def write_mutation_index(
"""
raise NotImplementedError

@abc.abstractmethod
def write_mutation_index(
self,
param: "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexInput",
) -> "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexOutput":
"""Creates a Mutation Index, conditioned on the Mutation Commitment.
Used in the edge case where the Commitment exists and Index does
not. The Index may have been deleted to restart the mutation
from the very begining.
"""
raise NotImplementedError

def WriteNewEncryptedBranchKey(
self, dafny_input: "DafnyWriteNewEncryptedBranchKeyInput"
) -> "DafnyWriteNewEncryptedBranchKeyOutput":
Expand Down Expand Up @@ -525,12 +504,12 @@ def GetMutation(
This method allows custom implementations of this interface to
interact with generated code.
"""
native_input = aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_GetMutationInput(
native_input = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_GetMutationInput(
dafny_input
)
try:
native_output = self.get_mutation(native_input)
dafny_output = aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_GetMutationOutput(
dafny_output = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_GetMutationOutput(
native_output
)
return Wrappers.Result_Success(dafny_output)
Expand All @@ -546,28 +525,7 @@ def DeleteMutation(
This method allows custom implementations of this interface to
interact with generated code.
"""
native_input = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_GetMutationLockInput(
dafny_input
)
try:
native_output = self.get_mutation_lock(native_input)
dafny_output = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_GetMutationLockOutput(
native_output
)
return Wrappers.Result_Success(dafny_output)
except Exception as e:
error = _smithy_error_to_dafny_error(e)
return Wrappers.Result_Failure(error)

def GetMutationLockAndIndex(
self, dafny_input: "DafnyGetMutationLockAndIndexInput"
) -> "DafnyGetMutationLockAndIndexOutput":
"""Do not use.
This method allows custom implementations of this interface to
interact with generated code.
"""
native_input = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_ClobberMutationLockInput(
native_input = aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_DeleteMutationInput(
dafny_input
)
try:
Expand Down Expand Up @@ -601,27 +559,6 @@ def WriteMutationIndex(
error = _smithy_error_to_dafny_error(e)
return Wrappers.Result_Failure(error)

def WriteMutationIndex(
self, dafny_input: "DafnyWriteMutationIndexInput"
) -> "DafnyWriteMutationIndexOutput":
"""Do not use.
This method allows custom implementations of this interface to
interact with generated code.
"""
native_input = aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_WriteMutationIndexInput(
dafny_input
)
try:
native_output = self.write_mutation_index(native_input)
dafny_output = aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_WriteMutationIndexOutput(
native_output
)
return Wrappers.Result_Success(dafny_output)
except Exception as e:
error = _smithy_error_to_dafny_error(e)
return Wrappers.Result_Failure(error)


class KeyStorageInterface(IKeyStorageInterface):

Expand Down Expand Up @@ -943,31 +880,9 @@ def write_mutated_versions(

def get_mutation(
self,
param: "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexInput",
) -> "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.UpdateMutationIndexOutput":
"""Updates a Mutation Index."""
dafny_output = self._impl.UpdateMutationIndex(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_UpdateMutationIndexInput(
param
)
)
if dafny_output.IsFailure():
from aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.deserialize import (
_deserialize_error as aws_cryptography_keystore_deserialize_error,
)

raise aws_cryptography_keystore_deserialize_error(dafny_output.error)

else:
return aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_UpdateMutationIndexOutput(
dafny_output.value
)

def get_mutation_lock(
self,
param: "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationLockInput",
) -> "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationLockOutput":
"""Check for Mutation Lock on a Branch Key ID.
param: "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationInput",
) -> "aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.models.GetMutationOutput":
"""Check for Mutation Commitment on a Branch Key ID.
If one exists, returns the Mutation Lock. Otherwise, returns
nothing.
Expand Down Expand Up @@ -1038,33 +953,6 @@ def write_mutation_index(
dafny_output.value
)

def write_mutation_index(
self,
param: "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexInput",
) -> "aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.models.WriteMutationIndexOutput":
"""Creates a Mutation Index, conditioned on the Mutation Commitment.
Used in the edge case where the Commitment exists and Index does
not. The Index may have been deleted to restart the mutation
from the very begining.
"""
dafny_output = self._impl.WriteMutationIndex(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_WriteMutationIndexInput(
param
)
)
if dafny_output.IsFailure():
from aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.deserialize import (
_deserialize_error as aws_cryptography_keystore_deserialize_error,
)

raise aws_cryptography_keystore_deserialize_error(dafny_output.error)

else:
return aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.dafny_to_smithy.aws_cryptography_keystore_WriteMutationIndexOutput(
dafny_output.value
)

@staticmethod
def from_dict(d: Dict[str, Any]) -> "KeyStorageInterface":
return KeyStorageInterface(d["_impl"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,47 +490,6 @@ def aws_cryptography_keystore_WriteInitializeMutationInput(native_input):
MutationIndex=aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_MutationIndex(
native_input.mutation_index
),
MutationIndex=(
(
Option_Some(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_MutationIndex(
native_input.mutation_index
)
)
)
if (native_input.mutation_index is not None)
else (Option_None())
),
OverWriteMutationIndex=(
(
Option_Some(
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_OverWriteMutationIndex(
native_input.over_write_mutation_index
)
)
)
if (native_input.over_write_mutation_index is not None)
else (Option_None())
),
Versions=Seq(
[
aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_OverWriteEncryptedHierarchicalKey(
list_element
)
for list_element in native_input.versions
]
),
)


def aws_cryptography_keystore_OverWriteMutationIndex(native_input):
return DafnyOverWriteMutationIndex(
Index=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_MutationIndex(
native_input.index
),
Old=aws_cryptographic_materialproviders.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_MutationIndex(
native_input.old
),
)


Expand Down Expand Up @@ -686,7 +645,18 @@ def aws_cryptography_keystore_GetMutationOutput(native_input):
)
)
)
if (native_input.mutation_lock is not None)
if (native_input.mutation_commitment is not None)
else (Option_None())
),
MutationIndex=(
(
Option_Some(
aws_cryptographic_material_providers.smithygenerated.aws_cryptography_keystore.smithy_to_dafny.aws_cryptography_keystore_MutationIndex(
native_input.mutation_index
)
)
)
if (native_input.mutation_index is not None)
else (Option_None())
),
)
Expand Down

0 comments on commit b230ed1

Please sign in to comment.