35
35
Input = TypeVar ("Input" )
36
36
Output = TypeVar ("Output" )
37
37
38
-
39
38
class DynamoDbEncryption :
40
- """Client for DynamoDbEncryption.
39
+ """Client for DynamoDbEncryption
41
40
42
41
:param config: Configuration for the client.
43
42
"""
44
-
45
43
def __init__ (
46
44
self ,
47
45
config : DynamoDbEncryptionConfig | None = None ,
48
- dafny_client : IDynamoDbEncryptionClient | None = None ,
46
+ dafny_client : IDynamoDbEncryptionClient | None = None
49
47
):
50
48
if config is None :
51
49
self ._config = Config ()
@@ -62,15 +60,10 @@ def __init__(
62
60
if dafny_client is not None :
63
61
self ._config .dafnyImplInterface .impl = dafny_client
64
62
65
- def create_dynamo_db_encryption_branch_key_id_supplier (
66
- self , input : CreateDynamoDbEncryptionBranchKeyIdSupplierInput
67
- ) -> CreateDynamoDbEncryptionBranchKeyIdSupplierOutput :
68
- """Create a Branch Key Supplier for use with the Hierarchical Keyring
69
- that decides what Branch Key to use based on the primary key of the
70
- DynamoDB item being read or written.
63
+ def create_dynamo_db_encryption_branch_key_id_supplier (self , input : CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) -> CreateDynamoDbEncryptionBranchKeyIdSupplierOutput :
64
+ """Create a Branch Key Supplier for use with the Hierarchical Keyring that decides what Branch Key to use based on the primary key of the DynamoDB item being read or written.
71
65
72
- :param input: Inputs for creating a Branch Key Supplier from a
73
- DynamoDB Key Branch Key Id Supplier
66
+ :param input: Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier
74
67
"""
75
68
return self ._execute_operation (
76
69
input = input ,
@@ -81,9 +74,7 @@ def create_dynamo_db_encryption_branch_key_id_supplier(
81
74
operation_name = "CreateDynamoDbEncryptionBranchKeyIdSupplier" ,
82
75
)
83
76
84
- def get_encrypted_data_key_description (
85
- self , input : GetEncryptedDataKeyDescriptionInput
86
- ) -> GetEncryptedDataKeyDescriptionOutput :
77
+ def get_encrypted_data_key_description (self , input : GetEncryptedDataKeyDescriptionInput ) -> GetEncryptedDataKeyDescriptionOutput :
87
78
"""Returns encrypted data key description.
88
79
89
80
:param input: Input for getting encrypted data key description.
@@ -107,7 +98,9 @@ def _execute_operation(
107
98
operation_name : str ,
108
99
) -> Output :
109
100
try :
110
- return self ._handle_execution (input , plugins , serialize , deserialize , config , operation_name )
101
+ return self ._handle_execution (
102
+ input , plugins , serialize , deserialize , config , operation_name
103
+ )
111
104
except Exception as e :
112
105
# Make sure every exception that we throw is an instance of ServiceError so
113
106
# customers can reliably catch everything we throw.
@@ -131,13 +124,12 @@ def _handle_execution(
131
124
transport_response = None ,
132
125
)
133
126
try :
134
- _client_interceptors = config .interceptors
127
+ _client_interceptors = config .interceptors
135
128
except AttributeError :
136
- config .interceptors = []
137
- _client_interceptors = config .interceptors
129
+ config .interceptors = []
130
+ _client_interceptors = config .interceptors
138
131
client_interceptors = cast (
139
- list [Interceptor [Input , Output , DafnyRequest , DafnyResponse ]],
140
- _client_interceptors ,
132
+ list [Interceptor [Input , Output , DafnyRequest , DafnyResponse ]], _client_interceptors
141
133
)
142
134
interceptors = client_interceptors
143
135
@@ -171,7 +163,9 @@ def _handle_execution(
171
163
interceptor .read_before_serialization (context )
172
164
173
165
# Step 4: Serialize the request
174
- context_with_transport_request = cast (InterceptorContext [Input , None , DafnyRequest , None ], context )
166
+ context_with_transport_request = cast (
167
+ InterceptorContext [Input , None , DafnyRequest , None ], context
168
+ )
175
169
context_with_transport_request ._transport_request = serialize (
176
170
context_with_transport_request .request , config
177
171
)
@@ -182,8 +176,8 @@ def _handle_execution(
182
176
183
177
# Step 6: Invoke modify_before_retry_loop
184
178
for interceptor in interceptors :
185
- context_with_transport_request ._transport_request = interceptor . modify_before_retry_loop (
186
- context_with_transport_request
179
+ context_with_transport_request ._transport_request = (
180
+ interceptor . modify_before_retry_loop ( context_with_transport_request )
187
181
)
188
182
189
183
# Step 7: Acquire the retry token.
@@ -218,7 +212,7 @@ def _handle_execution(
218
212
error_info = RetryErrorInfo (
219
213
# TODO: Determine the error type.
220
214
error_type = RetryErrorType .CLIENT_ERROR ,
221
- ),
215
+ )
222
216
)
223
217
except SmithyRetryException :
224
218
raise context_with_response .response
@@ -233,8 +227,7 @@ def _handle_execution(
233
227
# The response will be set either with the modeled output or an exception. The
234
228
# transport_request and transport_response may be set or None.
235
229
execution_context = cast (
236
- InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ],
237
- context ,
230
+ InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ], context
238
231
)
239
232
return self ._finalize_execution (interceptors , execution_context )
240
233
@@ -255,7 +248,9 @@ def _handle_attempt(
255
248
if config .dafnyImplInterface .impl is None :
256
249
raise Exception ("No impl found on the operation config." )
257
250
258
- context_with_response = cast (InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context )
251
+ context_with_response = cast (
252
+ InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context
253
+ )
259
254
260
255
context_with_response ._transport_response = config .dafnyImplInterface .handle_request (
261
256
input = context_with_response .transport_request
@@ -267,8 +262,8 @@ def _handle_attempt(
267
262
268
263
# Step 7o: Invoke modify_before_deserialization
269
264
for interceptor in interceptors :
270
- context_with_response ._transport_response = interceptor . modify_before_deserialization (
271
- context_with_response
265
+ context_with_response ._transport_response = (
266
+ interceptor . modify_before_deserialization ( context_with_response )
272
267
)
273
268
274
269
# Step 7p: Invoke read_before_deserialization
@@ -280,7 +275,9 @@ def _handle_attempt(
280
275
InterceptorContext [Input , Output , DafnyRequest , DafnyResponse ],
281
276
context_with_response ,
282
277
)
283
- context_with_output ._response = deserialize (context_with_output ._transport_response , config )
278
+ context_with_output ._response = deserialize (
279
+ context_with_output ._transport_response , config
280
+ )
284
281
285
282
# Step 7r: Invoke read_after_deserialization
286
283
for interceptor in interceptors :
@@ -293,8 +290,7 @@ def _handle_attempt(
293
290
# None. This will also be true after _finalize_attempt because there is no opportunity
294
291
# there to set the transport_response.
295
292
attempt_context = cast (
296
- InterceptorContext [Input , Output , DafnyRequest , DafnyResponse | None ],
297
- context ,
293
+ InterceptorContext [Input , Output , DafnyRequest , DafnyResponse | None ], context
298
294
)
299
295
return self ._finalize_attempt (interceptors , attempt_context )
300
296
@@ -306,7 +302,9 @@ def _finalize_attempt(
306
302
# Step 7s: Invoke modify_before_attempt_completion
307
303
try :
308
304
for interceptor in interceptors :
309
- context ._response = interceptor .modify_before_attempt_completion (context )
305
+ context ._response = interceptor .modify_before_attempt_completion (
306
+ context
307
+ )
310
308
except Exception as e :
311
309
context ._response = e
312
310
0 commit comments