Skip to content

Commit d1c42a6

Browse files
texastonyShubham Chaturvediseebees
authored
chore: clarify InFlightTTLExceeded exception (#1169)
Update documentation in the different runtimes to further clarify when InFlightTTLExceeded is raised. Co-authored-by: Shubham Chaturvedi <scchatur@amazon.com> Co-authored-by: seebees <ryanemer@amazon.com>
1 parent ed1f804 commit d1c42a6

6 files changed

Lines changed: 156 additions & 100 deletions

File tree

AwsCryptographicMaterialProviders/dafny/AwsCryptographicMaterialProviders/Model/cryptographic-materials-cache.smithy

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ structure PutCacheEntryInput {
5151
operation GetCacheEntry {
5252
input: GetCacheEntryInput,
5353
output: GetCacheEntryOutput,
54+
errors: [
55+
InFlightTTLExceeded
56+
EntryDoesNotExist
57+
//Technically, numerous other errors, depending on the implementation
58+
]
5459
}
5560

5661
structure GetCacheEntryInput {
@@ -115,6 +120,7 @@ structure UpdateUsageMetadataInput {
115120
}
116121

117122
@error("client")
123+
@documentation("The requested element is not in the cache; AWS Crypto Tools intends to deprecate this for a non-error control scheme.")
118124
structure EntryDoesNotExist {
119125
@required
120126
message: String,
@@ -127,6 +133,19 @@ structure EntryAlreadyExists {
127133
}
128134

129135
@error("client")
136+
@documentation(
137+
"Thrown if a request is waiting for longer than `inflightTTL`.
138+
The Storm Tracking Cache protects against unbounded parallelism.
139+
The Storm Tracking Cache will only work `fanOut` number of concurrent requests.
140+
As requests are completed,
141+
queued requests are worked.
142+
If a request is not worked in less than `inflightTTL`,
143+
this exception is thrown.
144+
145+
Note that this exception does NOT imply that the material requested
146+
is invalid or unreachable;
147+
it only implies that the cache had more requests to handle than it could
148+
with the given `fanOut` and `inflightTTL` constraints.")
130149
structure InFlightTTLExceeded {
131150
@required
132151
message: String,

AwsCryptographicMaterialProviders/runtimes/go/ImplementationFromDafny-go/awscryptographymaterialproviderssmithygeneratedtypes/errors.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AwsCryptographicMaterialProviders/runtimes/go/TestsFromDafny-go/awscryptographymaterialproviderssmithygeneratedtypes/errors.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AwsCryptographicMaterialProviders/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/materialproviders/model/EntryDoesNotExist.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import java.util.Objects;
77

8+
/**
9+
* The requested element is not in the cache; AWS Crypto Tools intends to deprecate this for a non-error control scheme.
10+
*/
811
public class EntryDoesNotExist extends RuntimeException {
912

1013
protected EntryDoesNotExist(BuilderImpl builder) {

AwsCryptographicMaterialProviders/runtimes/java/src/main/smithy-generated/software/amazon/cryptography/materialproviders/model/InFlightTTLExceeded.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55

66
import java.util.Objects;
77

8+
/**
9+
* Thrown if a request is waiting for longer than `inflightTTL`.
10+
* The Storm Tracking Cache protects against unbounded parallelism.
11+
* The Storm Tracking Cache will only work `fanOut` number of concurrent requests.
12+
* As requests are completed,
13+
* queued requests are worked.
14+
* If a request is not worked in less than `inflightTTL`,
15+
* this exception is thrown.
16+
*
17+
* Note that this exception does NOT imply that the material requested
18+
* is invalid or unreachable;
19+
* it only implies that the cache had more requests to handle than it could
20+
* with the given `fanOut` and `inflightTTL` constraints.
21+
*/
822
public class InFlightTTLExceeded extends RuntimeException {
923

1024
protected InFlightTTLExceeded(BuilderImpl builder) {

AwsCryptographicMaterialProviders/runtimes/python/src/aws_cryptographic_material_providers/smithygenerated/aws_cryptography_materialproviders/errors.py

Lines changed: 108 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,114 @@ def __eq__(self, other: Any) -> bool:
9696
return all(getattr(self, a) == getattr(other, a) for a in attributes)
9797

9898

99+
class EntryDoesNotExist(ApiError[Literal["EntryDoesNotExist"]]):
100+
code: Literal["EntryDoesNotExist"] = "EntryDoesNotExist"
101+
message: str
102+
103+
def __init__(
104+
self,
105+
*,
106+
message: str,
107+
):
108+
"""The requested element is not in the cache; AWS Crypto Tools intends
109+
to deprecate this for a non-error control scheme.
110+
111+
:param message: A message associated with the specific error.
112+
"""
113+
super().__init__(message)
114+
115+
def as_dict(self) -> Dict[str, Any]:
116+
"""Converts the EntryDoesNotExist to a dictionary."""
117+
return {
118+
"message": self.message,
119+
"code": self.code,
120+
}
121+
122+
@staticmethod
123+
def from_dict(d: Dict[str, Any]) -> "EntryDoesNotExist":
124+
"""Creates a EntryDoesNotExist from a dictionary."""
125+
kwargs: Dict[str, Any] = {
126+
"message": d["message"],
127+
}
128+
129+
return EntryDoesNotExist(**kwargs)
130+
131+
def __repr__(self) -> str:
132+
result = "EntryDoesNotExist("
133+
if self.message is not None:
134+
result += f"message={repr(self.message)}"
135+
136+
return result + ")"
137+
138+
def __eq__(self, other: Any) -> bool:
139+
if not isinstance(other, EntryDoesNotExist):
140+
return False
141+
attributes: list[str] = [
142+
"message",
143+
"message",
144+
]
145+
return all(getattr(self, a) == getattr(other, a) for a in attributes)
146+
147+
148+
class InFlightTTLExceeded(ApiError[Literal["InFlightTTLExceeded"]]):
149+
code: Literal["InFlightTTLExceeded"] = "InFlightTTLExceeded"
150+
message: str
151+
152+
def __init__(
153+
self,
154+
*,
155+
message: str,
156+
):
157+
"""Thrown if a request is waiting for longer than `inflightTTL`. The
158+
Storm Tracking Cache protects against unbounded parallelism. The Storm
159+
Tracking Cache will only work `fanOut` number of concurrent requests.
160+
As requests are completed, queued requests are worked. If a request is
161+
not worked in less than `inflightTTL`, this exception is thrown.
162+
163+
Note that this exception does NOT imply that the material
164+
requested
165+
is invalid or unreachable;
166+
it only implies that the cache had more
167+
requests to handle than it could
168+
with the given `fanOut` and `inflightTTL`
169+
constraints.
170+
:param message: A message associated with the specific error.
171+
"""
172+
super().__init__(message)
173+
174+
def as_dict(self) -> Dict[str, Any]:
175+
"""Converts the InFlightTTLExceeded to a dictionary."""
176+
return {
177+
"message": self.message,
178+
"code": self.code,
179+
}
180+
181+
@staticmethod
182+
def from_dict(d: Dict[str, Any]) -> "InFlightTTLExceeded":
183+
"""Creates a InFlightTTLExceeded from a dictionary."""
184+
kwargs: Dict[str, Any] = {
185+
"message": d["message"],
186+
}
187+
188+
return InFlightTTLExceeded(**kwargs)
189+
190+
def __repr__(self) -> str:
191+
result = "InFlightTTLExceeded("
192+
if self.message is not None:
193+
result += f"message={repr(self.message)}"
194+
195+
return result + ")"
196+
197+
def __eq__(self, other: Any) -> bool:
198+
if not isinstance(other, InFlightTTLExceeded):
199+
return False
200+
attributes: list[str] = [
201+
"message",
202+
"message",
203+
]
204+
return all(getattr(self, a) == getattr(other, a) for a in attributes)
205+
206+
99207
class InvalidDecryptionMaterials(ApiError[Literal["InvalidDecryptionMaterials"]]):
100208
code: Literal["InvalidDecryptionMaterials"] = "InvalidDecryptionMaterials"
101209
message: str
@@ -466,94 +574,6 @@ def __eq__(self, other: Any) -> bool:
466574
return all(getattr(self, a) == getattr(other, a) for a in attributes)
467575

468576

469-
class EntryDoesNotExist(ApiError[Literal["EntryDoesNotExist"]]):
470-
code: Literal["EntryDoesNotExist"] = "EntryDoesNotExist"
471-
message: str
472-
473-
def __init__(
474-
self,
475-
*,
476-
message: str,
477-
):
478-
super().__init__(message)
479-
480-
def as_dict(self) -> Dict[str, Any]:
481-
"""Converts the EntryDoesNotExist to a dictionary."""
482-
return {
483-
"message": self.message,
484-
"code": self.code,
485-
}
486-
487-
@staticmethod
488-
def from_dict(d: Dict[str, Any]) -> "EntryDoesNotExist":
489-
"""Creates a EntryDoesNotExist from a dictionary."""
490-
kwargs: Dict[str, Any] = {
491-
"message": d["message"],
492-
}
493-
494-
return EntryDoesNotExist(**kwargs)
495-
496-
def __repr__(self) -> str:
497-
result = "EntryDoesNotExist("
498-
if self.message is not None:
499-
result += f"message={repr(self.message)}"
500-
501-
return result + ")"
502-
503-
def __eq__(self, other: Any) -> bool:
504-
if not isinstance(other, EntryDoesNotExist):
505-
return False
506-
attributes: list[str] = [
507-
"message",
508-
"message",
509-
]
510-
return all(getattr(self, a) == getattr(other, a) for a in attributes)
511-
512-
513-
class InFlightTTLExceeded(ApiError[Literal["InFlightTTLExceeded"]]):
514-
code: Literal["InFlightTTLExceeded"] = "InFlightTTLExceeded"
515-
message: str
516-
517-
def __init__(
518-
self,
519-
*,
520-
message: str,
521-
):
522-
super().__init__(message)
523-
524-
def as_dict(self) -> Dict[str, Any]:
525-
"""Converts the InFlightTTLExceeded to a dictionary."""
526-
return {
527-
"message": self.message,
528-
"code": self.code,
529-
}
530-
531-
@staticmethod
532-
def from_dict(d: Dict[str, Any]) -> "InFlightTTLExceeded":
533-
"""Creates a InFlightTTLExceeded from a dictionary."""
534-
kwargs: Dict[str, Any] = {
535-
"message": d["message"],
536-
}
537-
538-
return InFlightTTLExceeded(**kwargs)
539-
540-
def __repr__(self) -> str:
541-
result = "InFlightTTLExceeded("
542-
if self.message is not None:
543-
result += f"message={repr(self.message)}"
544-
545-
return result + ")"
546-
547-
def __eq__(self, other: Any) -> bool:
548-
if not isinstance(other, InFlightTTLExceeded):
549-
return False
550-
attributes: list[str] = [
551-
"message",
552-
"message",
553-
]
554-
return all(getattr(self, a) == getattr(other, a) for a in attributes)
555-
556-
557577
class AwsCryptographicMaterialProvidersException(
558578
ApiError[Literal["AwsCryptographicMaterialProvidersException"]]
559579
):

0 commit comments

Comments
 (0)