capo-lambda-core 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. capo_lambda_core/_aws.py +28 -0
  2. capo_lambda_core/_operations/lambda_core_api_service/create_network_connector.py +5 -5
  3. capo_lambda_core/_operations/lambda_core_api_service/delete_network_connector.py +5 -5
  4. capo_lambda_core/_operations/lambda_core_api_service/get_network_connector.py +4 -4
  5. capo_lambda_core/_operations/lambda_core_api_service/list_network_connectors.py +3 -3
  6. capo_lambda_core/_operations/lambda_core_api_service/update_network_connector.py +5 -5
  7. capo_lambda_core/_resources/lambda_core_api_service/network_connector.py +31 -10
  8. capo_lambda_core/_services/_pipeline.py +296 -40
  9. capo_lambda_core/_services/async_lambda_core.py +27 -7
  10. capo_lambda_core/_services/lambda_core.py +27 -7
  11. capo_lambda_core/errors/_base.py +8 -3
  12. capo_lambda_core/errors/invalid_parameter_value_exception.py +9 -3
  13. capo_lambda_core/errors/network_connector_limit_exceeded_exception.py +9 -3
  14. capo_lambda_core/errors/resource_conflict_exception.py +11 -3
  15. capo_lambda_core/errors/resource_not_found_exception.py +11 -3
  16. capo_lambda_core/errors/service_exception.py +13 -3
  17. capo_lambda_core/errors/too_many_requests_exception.py +11 -3
  18. {capo_lambda_core-0.4.0.dist-info → capo_lambda_core-0.5.0.dist-info}/METADATA +1 -1
  19. {capo_lambda_core-0.4.0.dist-info → capo_lambda_core-0.5.0.dist-info}/RECORD +22 -21
  20. {capo_lambda_core-0.4.0.dist-info → capo_lambda_core-0.5.0.dist-info}/WHEEL +0 -0
  21. {capo_lambda_core-0.4.0.dist-info → capo_lambda_core-0.5.0.dist-info}/licenses/LICENSE +0 -0
  22. {capo_lambda_core-0.4.0.dist-info → capo_lambda_core-0.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ """Error codes and HTTP statuses that are retried whether or not the model marks them @retryable."""
2
+
3
+ # Transient: retried with the normal backoff.
4
+ KNOWN_RETRYABLE_STATUSES = frozenset({500, 502, 503, 504})
5
+ KNOWN_RETRYABLE_CODES = frozenset(
6
+ {"PriorRequestNotComplete", "RequestTimeout", "RequestTimeoutException"}
7
+ )
8
+
9
+ # Throttling: retried with the longer throttling backoff.
10
+ KNOWN_THROTTLING_STATUSES = frozenset({429})
11
+ KNOWN_THROTTLING_CODES = frozenset(
12
+ {
13
+ "BandwidthLimitExceeded",
14
+ "EC2ThrottledException",
15
+ "LimitExceededException",
16
+ "PriorRequestNotComplete",
17
+ "ProvisionedThroughputExceededException",
18
+ "RequestLimitExceeded",
19
+ "RequestThrottled",
20
+ "RequestThrottledException",
21
+ "SlowDown",
22
+ "ThrottledException",
23
+ "Throttling",
24
+ "ThrottlingException",
25
+ "TooManyRequestsException",
26
+ "TransactionInProgressException",
27
+ }
28
+ )
@@ -37,23 +37,23 @@ def handle_error(response: zapros.Response) -> Never:
37
37
  match code:
38
38
  case "InvalidParameterValueException":
39
39
  raise capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException.from_json(
40
- data, message
40
+ data, message, response=response
41
41
  )
42
42
  case "NetworkConnectorLimitExceededException":
43
43
  raise capo_lambda_core.errors.network_connector_limit_exceeded_exception.NetworkConnectorLimitExceededException.from_json(
44
- data, message
44
+ data, message, response=response
45
45
  )
46
46
  case "ResourceConflictException":
47
47
  raise capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException.from_json(
48
- data, message
48
+ data, message, response=response
49
49
  )
50
50
  case "ServiceException":
51
51
  raise capo_lambda_core.errors.service_exception.ServiceException.from_json(
52
- data, message
52
+ data, message, response=response
53
53
  )
54
54
  case "TooManyRequestsException":
55
55
  raise capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException.from_json(
56
- data, message
56
+ data, message, response=response
57
57
  )
58
58
  case _:
59
59
  raise UnknownServiceError(code=code, message=message, response=response)
@@ -37,23 +37,23 @@ def handle_error(response: zapros.Response) -> Never:
37
37
  match code:
38
38
  case "InvalidParameterValueException":
39
39
  raise capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException.from_json(
40
- data, message
40
+ data, message, response=response
41
41
  )
42
42
  case "ResourceConflictException":
43
43
  raise capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException.from_json(
44
- data, message
44
+ data, message, response=response
45
45
  )
46
46
  case "ResourceNotFoundException":
47
47
  raise capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
48
- data, message
48
+ data, message, response=response
49
49
  )
50
50
  case "ServiceException":
51
51
  raise capo_lambda_core.errors.service_exception.ServiceException.from_json(
52
- data, message
52
+ data, message, response=response
53
53
  )
54
54
  case "TooManyRequestsException":
55
55
  raise capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException.from_json(
56
- data, message
56
+ data, message, response=response
57
57
  )
58
58
  case _:
59
59
  raise UnknownServiceError(code=code, message=message, response=response)
@@ -40,19 +40,19 @@ def handle_error(response: zapros.Response) -> Never:
40
40
  match code:
41
41
  case "InvalidParameterValueException":
42
42
  raise capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException.from_json(
43
- data, message
43
+ data, message, response=response
44
44
  )
45
45
  case "ResourceNotFoundException":
46
46
  raise capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
47
- data, message
47
+ data, message, response=response
48
48
  )
49
49
  case "ServiceException":
50
50
  raise capo_lambda_core.errors.service_exception.ServiceException.from_json(
51
- data, message
51
+ data, message, response=response
52
52
  )
53
53
  case "TooManyRequestsException":
54
54
  raise capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException.from_json(
55
- data, message
55
+ data, message, response=response
56
56
  )
57
57
  case _:
58
58
  raise UnknownServiceError(code=code, message=message, response=response)
@@ -34,15 +34,15 @@ def handle_error(response: zapros.Response) -> Never:
34
34
  match code:
35
35
  case "InvalidParameterValueException":
36
36
  raise capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException.from_json(
37
- data, message
37
+ data, message, response=response
38
38
  )
39
39
  case "ServiceException":
40
40
  raise capo_lambda_core.errors.service_exception.ServiceException.from_json(
41
- data, message
41
+ data, message, response=response
42
42
  )
43
43
  case "TooManyRequestsException":
44
44
  raise capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException.from_json(
45
- data, message
45
+ data, message, response=response
46
46
  )
47
47
  case _:
48
48
  raise UnknownServiceError(code=code, message=message, response=response)
@@ -39,23 +39,23 @@ def handle_error(response: zapros.Response) -> Never:
39
39
  match code:
40
40
  case "InvalidParameterValueException":
41
41
  raise capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException.from_json(
42
- data, message
42
+ data, message, response=response
43
43
  )
44
44
  case "ResourceConflictException":
45
45
  raise capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException.from_json(
46
- data, message
46
+ data, message, response=response
47
47
  )
48
48
  case "ResourceNotFoundException":
49
49
  raise capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
50
- data, message
50
+ data, message, response=response
51
51
  )
52
52
  case "ServiceException":
53
53
  raise capo_lambda_core.errors.service_exception.ServiceException.from_json(
54
- data, message
54
+ data, message, response=response
55
55
  )
56
56
  case "TooManyRequestsException":
57
57
  raise capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException.from_json(
58
- data, message
58
+ data, message, response=response
59
59
  )
60
60
  case _:
61
61
  raise UnknownServiceError(code=code, message=message, response=response)
@@ -8,6 +8,7 @@ import capo_lambda_core._auth._sigv4
8
8
  from capo_lambda_core._services._pipeline import (
9
9
  AsyncOperationRequest,
10
10
  AsyncOperationResponse,
11
+ OperationLogging,
11
12
  OperationRequest,
12
13
  OperationResponse,
13
14
  aexecute_pipeline,
@@ -97,7 +98,9 @@ class NetworkConnector:
97
98
  )
98
99
  return OperationResponse(output=output, response=http_response)
99
100
 
100
- interceptors_, options_ = self._service.operation_options(config_overrides)
101
+ interceptors_, options_ = self._service.operation_options(
102
+ config_overrides, OperationLogging("CreateNetworkConnector")
103
+ )
101
104
  input_: capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest = {
102
105
  "name": name,
103
106
  "configuration": configuration,
@@ -148,7 +151,9 @@ class NetworkConnector:
148
151
  )
149
152
  return OperationResponse(output=output, response=http_response)
150
153
 
151
- interceptors_, options_ = self._service.operation_options(config_overrides)
154
+ interceptors_, options_ = self._service.operation_options(
155
+ config_overrides, OperationLogging("GetNetworkConnector")
156
+ )
152
157
  input_: capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest = {
153
158
  "identifier": identifier
154
159
  }
@@ -206,7 +211,9 @@ class NetworkConnector:
206
211
  )
207
212
  return OperationResponse(output=output, response=http_response)
208
213
 
209
- interceptors_, options_ = self._service.operation_options(config_overrides)
214
+ interceptors_, options_ = self._service.operation_options(
215
+ config_overrides, OperationLogging("UpdateNetworkConnector")
216
+ )
210
217
  input_: capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest = {
211
218
  "identifier": identifier
212
219
  }
@@ -257,7 +264,9 @@ class NetworkConnector:
257
264
  )
258
265
  return OperationResponse(output=output, response=http_response)
259
266
 
260
- interceptors_, options_ = self._service.operation_options(config_overrides)
267
+ interceptors_, options_ = self._service.operation_options(
268
+ config_overrides, OperationLogging("DeleteNetworkConnector")
269
+ )
261
270
  input_: capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest = {
262
271
  "identifier": identifier
263
272
  }
@@ -310,7 +319,9 @@ class NetworkConnector:
310
319
  )
311
320
  return OperationResponse(output=output, response=http_response)
312
321
 
313
- interceptors_, options_ = self._service.operation_options(config_overrides)
322
+ interceptors_, options_ = self._service.operation_options(
323
+ config_overrides, OperationLogging("ListNetworkConnectors")
324
+ )
314
325
  input_: capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest = {}
315
326
  if state is not None:
316
327
  input_["state"] = state
@@ -381,7 +392,9 @@ class AsyncNetworkConnector:
381
392
  )
382
393
  return AsyncOperationResponse(output=output, response=http_response)
383
394
 
384
- interceptors_, options_ = self._service.operation_options(config_overrides)
395
+ interceptors_, options_ = self._service.operation_options(
396
+ config_overrides, OperationLogging("CreateNetworkConnector")
397
+ )
385
398
  input_: capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest = {
386
399
  "name": name,
387
400
  "configuration": configuration,
@@ -433,7 +446,9 @@ class AsyncNetworkConnector:
433
446
  )
434
447
  return AsyncOperationResponse(output=output, response=http_response)
435
448
 
436
- interceptors_, options_ = self._service.operation_options(config_overrides)
449
+ interceptors_, options_ = self._service.operation_options(
450
+ config_overrides, OperationLogging("GetNetworkConnector")
451
+ )
437
452
  input_: capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest = {
438
453
  "identifier": identifier
439
454
  }
@@ -492,7 +507,9 @@ class AsyncNetworkConnector:
492
507
  )
493
508
  return AsyncOperationResponse(output=output, response=http_response)
494
509
 
495
- interceptors_, options_ = self._service.operation_options(config_overrides)
510
+ interceptors_, options_ = self._service.operation_options(
511
+ config_overrides, OperationLogging("UpdateNetworkConnector")
512
+ )
496
513
  input_: capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest = {
497
514
  "identifier": identifier
498
515
  }
@@ -544,7 +561,9 @@ class AsyncNetworkConnector:
544
561
  )
545
562
  return AsyncOperationResponse(output=output, response=http_response)
546
563
 
547
- interceptors_, options_ = self._service.operation_options(config_overrides)
564
+ interceptors_, options_ = self._service.operation_options(
565
+ config_overrides, OperationLogging("DeleteNetworkConnector")
566
+ )
548
567
  input_: capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest = {
549
568
  "identifier": identifier
550
569
  }
@@ -598,7 +617,9 @@ class AsyncNetworkConnector:
598
617
  )
599
618
  return AsyncOperationResponse(output=output, response=http_response)
600
619
 
601
- interceptors_, options_ = self._service.operation_options(config_overrides)
620
+ interceptors_, options_ = self._service.operation_options(
621
+ config_overrides, OperationLogging("ListNetworkConnectors")
622
+ )
602
623
  input_: capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest = {}
603
624
  if state is not None:
604
625
  input_["state"] = state
@@ -1,10 +1,20 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import logging
3
4
  import random
5
+ import threading
4
6
  import time
5
7
  from collections.abc import AsyncIterator, Iterator, Sequence
6
8
  from dataclasses import dataclass
7
- from typing import TYPE_CHECKING, Awaitable, Callable, Generic, TypeVar, cast
9
+ from typing import (
10
+ TYPE_CHECKING,
11
+ Any,
12
+ Awaitable,
13
+ Callable,
14
+ Generic,
15
+ TypeVar,
16
+ cast,
17
+ )
8
18
 
9
19
  from typing_extensions import Never
10
20
  from zapros import (
@@ -19,21 +29,69 @@ from zapros import (
19
29
  )
20
30
 
21
31
  from capo_lambda_core._async import anysleep
32
+ from capo_lambda_core._aws import (
33
+ KNOWN_RETRYABLE_CODES,
34
+ KNOWN_RETRYABLE_STATUSES,
35
+ KNOWN_THROTTLING_CODES,
36
+ KNOWN_THROTTLING_STATUSES,
37
+ )
22
38
  from capo_lambda_core._body import Body
23
39
  from capo_lambda_core._iter import StaticAnyIterator
24
- from capo_lambda_core.errors import ServiceError
40
+ from capo_lambda_core.errors import ServiceError, UnknownServiceError
25
41
 
26
42
  if TYPE_CHECKING:
27
43
  from capo_lambda_core._auth._identity import Credentials
28
44
  from capo_lambda_core._auth._providers import IdentityProvider
29
45
 
46
+ logger = logging.getLogger("capo_lambda_core.operation")
47
+
30
48
  TInput = TypeVar("TInput")
31
49
  TOutput = TypeVar("TOutput")
32
50
 
33
51
 
52
+ class RetryQuota:
53
+ """Retry tokens shared by all operations of one client: retries spend them, successes refund them."""
54
+
55
+ CAPACITY: int = 500
56
+ TRANSIENT_COST: int = 14
57
+ THROTTLING_COST: int = 5
58
+ NO_RETRY_INCREMENT: int = 1
59
+
60
+ def __init__(self) -> None:
61
+ self._available: int = self.CAPACITY
62
+
63
+ def acquire(self, is_throttling: bool) -> int | None:
64
+ cost = self.THROTTLING_COST if is_throttling else self.TRANSIENT_COST
65
+ if cost > self._available:
66
+ return None
67
+ self._available -= cost
68
+ return cost
69
+
70
+ def release(self, last_retry_cost: int | None) -> None:
71
+ refund = self.NO_RETRY_INCREMENT if last_retry_cost is None else last_retry_cost
72
+ self._available = min(self.CAPACITY, self._available + refund)
73
+
74
+
75
+ class ThreadSafeRetryQuota(RetryQuota):
76
+ """A ``RetryQuota`` that sync clients can share across threads."""
77
+
78
+ def __init__(self) -> None:
79
+ super().__init__()
80
+ self._lock: threading.Lock = threading.Lock()
81
+
82
+ def acquire(self, is_throttling: bool) -> int | None:
83
+ with self._lock:
84
+ return super().acquire(is_throttling)
85
+
86
+ def release(self, last_retry_cost: int | None) -> None:
87
+ with self._lock:
88
+ super().release(last_retry_cost)
89
+
90
+
34
91
  @dataclass
35
92
  class OperationOptions:
36
93
  client: Client
94
+ retry_quota: RetryQuota
37
95
  use_dual_stack: bool | None = None
38
96
  use_fips: bool | None = None
39
97
  region: str | None = None
@@ -46,6 +104,7 @@ class OperationOptions:
46
104
  @dataclass
47
105
  class AsyncOperationOptions:
48
106
  client: AsyncClient
107
+ retry_quota: RetryQuota
49
108
  use_dual_stack: bool | None = None
50
109
  use_fips: bool | None = None
51
110
  region: str | None = None
@@ -100,6 +159,16 @@ AsyncInterceptor = Callable[
100
159
  ]
101
160
 
102
161
 
162
+ @dataclass
163
+ class OperationLogging:
164
+ """What the logging interceptor needs to know about one operation call."""
165
+
166
+ operation: str
167
+ # Return a copy that is safe to log; None when the shape has nothing to hide.
168
+ redact_input: Callable[[Any], dict[str, Any]] | None = None
169
+ redact_output: Callable[[Any], dict[str, Any]] | None = None
170
+
171
+
103
172
  def execute_pipeline(
104
173
  request: OperationRequest[TInput],
105
174
  handler: NextFn[TInput, TOutput],
@@ -142,16 +211,31 @@ def raise_error(response: Response, handle_error: Callable[[Response], Never]) -
142
211
  try:
143
212
  handle_error(response)
144
213
  except ServiceError as exc:
145
- # The response itself can say a retry is safe, even when the error is
146
- # not marked @retryable: a 429, a transient 5xx or a Retry-After header.
147
- if response.status == 429:
148
- exc.is_throttling_error = True
149
- if (
150
- response.status in (429, 500, 502, 503, 504)
151
- or "retry-after" in response.headers
152
- ):
153
- exc.is_retryable = True
214
+ _apply_retry_rules(exc, response)
154
215
  raise
216
+ except Exception as exc:
217
+ # The error body could not be decoded (an HTML page from a proxy, a
218
+ # truncated read): the status code is all there is to go on.
219
+ error = UnknownServiceError(code=None, message=None, response=response)
220
+ _apply_retry_rules(error, response)
221
+ raise error from exc
222
+
223
+
224
+ def _apply_retry_rules(exc: ServiceError, response: Response) -> None:
225
+ # A retry can be safe even when the error is not marked @retryable: a known
226
+ # throttling or transient status or error code, or a Retry-After header.
227
+ if (
228
+ response.status in KNOWN_THROTTLING_STATUSES
229
+ or exc.code in KNOWN_THROTTLING_CODES
230
+ ):
231
+ exc.is_throttling_error = True
232
+ exc.is_retryable = True
233
+ if (
234
+ response.status in KNOWN_RETRYABLE_STATUSES
235
+ or exc.code in KNOWN_RETRYABLE_CODES
236
+ or "retry-after" in response.headers
237
+ ):
238
+ exc.is_retryable = True
155
239
 
156
240
 
157
241
  def _is_retryable(exc: Exception) -> bool:
@@ -213,26 +297,64 @@ def retry() -> Interceptor[TInput, TOutput]:
213
297
  request: OperationRequest[TInput], next: NextFn[TInput, TOutput]
214
298
  ) -> OperationResponse[TOutput]:
215
299
  max_attempts = request.options.retry_max_attempts or 3
216
- last_exc: Exception | None = None
300
+ quota = request.options.retry_quota
301
+ last_retry_cost: int | None = None
217
302
  for attempt in range(1, max_attempts + 1):
218
303
  try:
219
- return next(request)
304
+ response = next(request)
220
305
  except Exception as exc:
221
- if not _is_retryable(exc):
306
+ if not _is_retryable(exc) or attempt == max_attempts:
222
307
  raise
223
- last_exc = exc
224
- if attempt < max_attempts:
225
- if not _is_pre_transmission(exc) and not _prepare_retry(
226
- request.input
227
- ):
228
- raise
229
- is_throttling = (
230
- isinstance(exc, ServiceError) and exc.is_throttling_error
308
+ if not _is_pre_transmission(exc) and not _prepare_retry(request.input):
309
+ logger.debug(
310
+ "attempt %d/%d failed: %r, not retrying because the request body cannot be replayed",
311
+ attempt,
312
+ max_attempts,
313
+ exc,
314
+ extra={
315
+ "attempt": attempt,
316
+ "max_attempts": max_attempts,
317
+ "error": exc,
318
+ },
231
319
  )
232
- time.sleep(_retry_delay(attempt, is_throttling))
233
-
234
- assert last_exc
235
- raise last_exc
320
+ raise
321
+ is_throttling = (
322
+ isinstance(exc, ServiceError) and exc.is_throttling_error
323
+ )
324
+ cost = quota.acquire(is_throttling)
325
+ if cost is None:
326
+ logger.debug(
327
+ "attempt %d/%d failed: %r, not retrying because the retry quota is exhausted",
328
+ attempt,
329
+ max_attempts,
330
+ exc,
331
+ extra={
332
+ "attempt": attempt,
333
+ "max_attempts": max_attempts,
334
+ "error": exc,
335
+ },
336
+ )
337
+ raise
338
+ last_retry_cost = cost
339
+ delay = _retry_delay(attempt, is_throttling)
340
+ logger.debug(
341
+ "attempt %d/%d failed: %r, retrying in %.2fs",
342
+ attempt,
343
+ max_attempts,
344
+ exc,
345
+ delay,
346
+ extra={
347
+ "attempt": attempt,
348
+ "max_attempts": max_attempts,
349
+ "error": exc,
350
+ "delay": delay,
351
+ },
352
+ )
353
+ time.sleep(delay)
354
+ else:
355
+ quota.release(last_retry_cost)
356
+ return response
357
+ raise AssertionError("unreachable")
236
358
 
237
359
  return interceptor
238
360
 
@@ -242,25 +364,159 @@ def aretry() -> AsyncInterceptor[TInput, TOutput]:
242
364
  request: AsyncOperationRequest[TInput], next: AsyncNextFn[TInput, TOutput]
243
365
  ) -> AsyncOperationResponse[TOutput]:
244
366
  max_attempts = request.options.retry_max_attempts or 3
245
- last_exc: Exception | None = None
367
+ quota = request.options.retry_quota
368
+ last_retry_cost: int | None = None
246
369
  for attempt in range(1, max_attempts + 1):
247
370
  try:
248
- return await next(request)
371
+ response = await next(request)
249
372
  except Exception as exc:
250
- if not _is_retryable(exc):
373
+ if not _is_retryable(exc) or attempt == max_attempts:
251
374
  raise
252
- last_exc = exc
253
- if attempt < max_attempts:
254
- if not _is_pre_transmission(exc) and not await _aprepare_retry(
255
- request.input
256
- ):
257
- raise
258
- is_throttling = (
259
- isinstance(exc, ServiceError) and exc.is_throttling_error
375
+ if not _is_pre_transmission(exc) and not await _aprepare_retry(
376
+ request.input
377
+ ):
378
+ logger.debug(
379
+ "attempt %d/%d failed: %r, not retrying because the request body cannot be replayed",
380
+ attempt,
381
+ max_attempts,
382
+ exc,
383
+ extra={
384
+ "attempt": attempt,
385
+ "max_attempts": max_attempts,
386
+ "error": exc,
387
+ },
260
388
  )
261
- await anysleep(_retry_delay(attempt, is_throttling))
389
+ raise
390
+ is_throttling = (
391
+ isinstance(exc, ServiceError) and exc.is_throttling_error
392
+ )
393
+ cost = quota.acquire(is_throttling)
394
+ if cost is None:
395
+ logger.debug(
396
+ "attempt %d/%d failed: %r, not retrying because the retry quota is exhausted",
397
+ attempt,
398
+ max_attempts,
399
+ exc,
400
+ extra={
401
+ "attempt": attempt,
402
+ "max_attempts": max_attempts,
403
+ "error": exc,
404
+ },
405
+ )
406
+ raise
407
+ last_retry_cost = cost
408
+ delay = _retry_delay(attempt, is_throttling)
409
+ logger.debug(
410
+ "attempt %d/%d failed: %r, retrying in %.2fs",
411
+ attempt,
412
+ max_attempts,
413
+ exc,
414
+ delay,
415
+ extra={
416
+ "attempt": attempt,
417
+ "max_attempts": max_attempts,
418
+ "error": exc,
419
+ "delay": delay,
420
+ },
421
+ )
422
+ await anysleep(delay)
423
+ else:
424
+ quota.release(last_retry_cost)
425
+ return response
426
+ raise AssertionError("unreachable")
427
+
428
+ return interceptor
429
+
430
+
431
+ def log_operation(operation_logging: OperationLogging) -> Interceptor[TInput, TOutput]:
432
+ operation = operation_logging.operation
433
+ redact_input = operation_logging.redact_input
434
+ redact_output = operation_logging.redact_output
435
+
436
+ def interceptor(
437
+ request: OperationRequest[TInput], next: NextFn[TInput, TOutput]
438
+ ) -> OperationResponse[TOutput]:
439
+ debug = logger.isEnabledFor(logging.DEBUG)
440
+ if debug:
441
+ input_ = (
442
+ request.input if redact_input is None else redact_input(request.input)
443
+ )
444
+ logger.debug(
445
+ "%s input: %r",
446
+ operation,
447
+ input_,
448
+ extra={"operation": operation, "input": input_},
449
+ )
450
+ try:
451
+ response = next(request)
452
+ except Exception as exc:
453
+ logger.debug(
454
+ "%s failed: %r",
455
+ operation,
456
+ exc,
457
+ extra={"operation": operation, "error": exc},
458
+ )
459
+ raise
460
+ if debug:
461
+ output = (
462
+ response.output
463
+ if redact_output is None
464
+ else redact_output(response.output)
465
+ )
466
+ logger.debug(
467
+ "%s output: %r",
468
+ operation,
469
+ output,
470
+ extra={"operation": operation, "output": output},
471
+ )
472
+ return response
473
+
474
+ return interceptor
262
475
 
263
- assert last_exc
264
- raise last_exc
476
+
477
+ def alog_operation(
478
+ operation_logging: OperationLogging,
479
+ ) -> AsyncInterceptor[TInput, TOutput]:
480
+ operation = operation_logging.operation
481
+ redact_input = operation_logging.redact_input
482
+ redact_output = operation_logging.redact_output
483
+
484
+ async def interceptor(
485
+ request: AsyncOperationRequest[TInput], next: AsyncNextFn[TInput, TOutput]
486
+ ) -> AsyncOperationResponse[TOutput]:
487
+ debug = logger.isEnabledFor(logging.DEBUG)
488
+ if debug:
489
+ input_ = (
490
+ request.input if redact_input is None else redact_input(request.input)
491
+ )
492
+ logger.debug(
493
+ "%s input: %r",
494
+ operation,
495
+ input_,
496
+ extra={"operation": operation, "input": input_},
497
+ )
498
+ try:
499
+ response = await next(request)
500
+ except Exception as exc:
501
+ logger.debug(
502
+ "%s failed: %r",
503
+ operation,
504
+ exc,
505
+ extra={"operation": operation, "error": exc},
506
+ )
507
+ raise
508
+ if debug:
509
+ output = (
510
+ response.output
511
+ if redact_output is None
512
+ else redact_output(response.output)
513
+ )
514
+ logger.debug(
515
+ "%s output: %r",
516
+ operation,
517
+ output,
518
+ extra={"operation": operation, "output": output},
519
+ )
520
+ return response
265
521
 
266
522
  return interceptor
@@ -28,7 +28,10 @@ from capo_lambda_core._services._pipeline import (
28
28
  AsyncOperationOptions,
29
29
  AsyncOperationRequest,
30
30
  AsyncOperationResponse,
31
+ OperationLogging,
32
+ RetryQuota,
31
33
  aexecute_pipeline,
34
+ alog_operation,
32
35
  aretry,
33
36
  )
34
37
 
@@ -101,6 +104,8 @@ class AsyncLambdaCoreClient:
101
104
  # it for their one-off calls.
102
105
  raw_handler = client.handler
103
106
  self._client = client.wrap_with_middleware(lambda next: AuthMiddleware(next))
107
+ # One retry quota for all of this client's operations.
108
+ self._retry_quota = RetryQuota()
104
109
  if credentials is not None and credentials_provider is not None:
105
110
  warnings.warn(
106
111
  "Both credentials and credentials_provider given; provider takes precedence"
@@ -131,7 +136,9 @@ class AsyncLambdaCoreClient:
131
136
  self.network_connector = AsyncNetworkConnector(self)
132
137
 
133
138
  def operation_options(
134
- self, config_overrides: Optional[AsyncLambdaCoreClientConfig] = None
139
+ self,
140
+ config_overrides: Optional[AsyncLambdaCoreClientConfig] = None,
141
+ operation_logging: OperationLogging | None = None,
135
142
  ) -> tuple[Iterable[AsyncInterceptor[Any, Any]], AsyncOperationOptions]:
136
143
  overrides: AsyncLambdaCoreClientConfig = config_overrides or {}
137
144
  interceptors_: list[AsyncInterceptor[Any, Any]] = [
@@ -139,10 +146,13 @@ class AsyncLambdaCoreClient:
139
146
  "operation_interceptors", self._config.get("operation_interceptors", [])
140
147
  ),
141
148
  aaws_config(),
142
- aretry(),
143
149
  ]
150
+ if operation_logging is not None:
151
+ interceptors_.append(alog_operation(operation_logging))
152
+ interceptors_.append(aretry())
144
153
  options_: AsyncOperationOptions = AsyncOperationOptions(
145
154
  client=self._client,
155
+ retry_quota=self._retry_quota,
146
156
  retry_max_attempts=overrides.get(
147
157
  "retry_max_attempts", self._config.get("retry_max_attempts")
148
158
  ),
@@ -208,7 +218,9 @@ class AsyncLambdaCoreClient:
208
218
  )
209
219
  return AsyncOperationResponse(output=output, response=http_response)
210
220
 
211
- interceptors_, options_ = self.operation_options(config_overrides)
221
+ interceptors_, options_ = self.operation_options(
222
+ config_overrides, OperationLogging("CreateNetworkConnector")
223
+ )
212
224
  input_: capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest = {
213
225
  "name": name,
214
226
  "configuration": configuration,
@@ -260,7 +272,9 @@ class AsyncLambdaCoreClient:
260
272
  )
261
273
  return AsyncOperationResponse(output=output, response=http_response)
262
274
 
263
- interceptors_, options_ = self.operation_options(config_overrides)
275
+ interceptors_, options_ = self.operation_options(
276
+ config_overrides, OperationLogging("GetNetworkConnector")
277
+ )
264
278
  input_: capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest = {
265
279
  "identifier": identifier
266
280
  }
@@ -319,7 +333,9 @@ class AsyncLambdaCoreClient:
319
333
  )
320
334
  return AsyncOperationResponse(output=output, response=http_response)
321
335
 
322
- interceptors_, options_ = self.operation_options(config_overrides)
336
+ interceptors_, options_ = self.operation_options(
337
+ config_overrides, OperationLogging("UpdateNetworkConnector")
338
+ )
323
339
  input_: capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest = {
324
340
  "identifier": identifier
325
341
  }
@@ -371,7 +387,9 @@ class AsyncLambdaCoreClient:
371
387
  )
372
388
  return AsyncOperationResponse(output=output, response=http_response)
373
389
 
374
- interceptors_, options_ = self.operation_options(config_overrides)
390
+ interceptors_, options_ = self.operation_options(
391
+ config_overrides, OperationLogging("DeleteNetworkConnector")
392
+ )
375
393
  input_: capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest = {
376
394
  "identifier": identifier
377
395
  }
@@ -425,7 +443,9 @@ class AsyncLambdaCoreClient:
425
443
  )
426
444
  return AsyncOperationResponse(output=output, response=http_response)
427
445
 
428
- interceptors_, options_ = self.operation_options(config_overrides)
446
+ interceptors_, options_ = self.operation_options(
447
+ config_overrides, OperationLogging("ListNetworkConnectors")
448
+ )
429
449
  input_: capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest = {}
430
450
  if state is not None:
431
451
  input_["state"] = state
@@ -25,10 +25,13 @@ from capo_lambda_core._resources.lambda_core_api_service.network_connector impor
25
25
  from capo_lambda_core._services._aws_config import aws_config
26
26
  from capo_lambda_core._services._pipeline import (
27
27
  Interceptor,
28
+ OperationLogging,
28
29
  OperationOptions,
29
30
  OperationRequest,
30
31
  OperationResponse,
32
+ ThreadSafeRetryQuota,
31
33
  execute_pipeline,
34
+ log_operation,
32
35
  retry,
33
36
  )
34
37
 
@@ -101,6 +104,8 @@ class LambdaCoreClient:
101
104
  # it for their one-off calls.
102
105
  raw_handler = client.handler
103
106
  self._client = client.wrap_with_middleware(lambda next: AuthMiddleware(next))
107
+ # One retry quota for all of this client's operations.
108
+ self._retry_quota = ThreadSafeRetryQuota()
104
109
  if credentials is not None and credentials_provider is not None:
105
110
  warnings.warn(
106
111
  "Both credentials and credentials_provider given; provider takes precedence"
@@ -131,7 +136,9 @@ class LambdaCoreClient:
131
136
  self.network_connector = NetworkConnector(self)
132
137
 
133
138
  def operation_options(
134
- self, config_overrides: Optional[LambdaCoreClientConfig] = None
139
+ self,
140
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
141
+ operation_logging: OperationLogging | None = None,
135
142
  ) -> tuple[Iterable[Interceptor[Any, Any]], OperationOptions]:
136
143
  overrides: LambdaCoreClientConfig = config_overrides or {}
137
144
  interceptors_: list[Interceptor[Any, Any]] = [
@@ -139,10 +146,13 @@ class LambdaCoreClient:
139
146
  "operation_interceptors", self._config.get("operation_interceptors", [])
140
147
  ),
141
148
  aws_config(),
142
- retry(),
143
149
  ]
150
+ if operation_logging is not None:
151
+ interceptors_.append(log_operation(operation_logging))
152
+ interceptors_.append(retry())
144
153
  options_: OperationOptions = OperationOptions(
145
154
  client=self._client,
155
+ retry_quota=self._retry_quota,
146
156
  retry_max_attempts=overrides.get(
147
157
  "retry_max_attempts", self._config.get("retry_max_attempts")
148
158
  ),
@@ -207,7 +217,9 @@ class LambdaCoreClient:
207
217
  )
208
218
  return OperationResponse(output=output, response=http_response)
209
219
 
210
- interceptors_, options_ = self.operation_options(config_overrides)
220
+ interceptors_, options_ = self.operation_options(
221
+ config_overrides, OperationLogging("CreateNetworkConnector")
222
+ )
211
223
  input_: capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest = {
212
224
  "name": name,
213
225
  "configuration": configuration,
@@ -258,7 +270,9 @@ class LambdaCoreClient:
258
270
  )
259
271
  return OperationResponse(output=output, response=http_response)
260
272
 
261
- interceptors_, options_ = self.operation_options(config_overrides)
273
+ interceptors_, options_ = self.operation_options(
274
+ config_overrides, OperationLogging("GetNetworkConnector")
275
+ )
262
276
  input_: capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest = {
263
277
  "identifier": identifier
264
278
  }
@@ -316,7 +330,9 @@ class LambdaCoreClient:
316
330
  )
317
331
  return OperationResponse(output=output, response=http_response)
318
332
 
319
- interceptors_, options_ = self.operation_options(config_overrides)
333
+ interceptors_, options_ = self.operation_options(
334
+ config_overrides, OperationLogging("UpdateNetworkConnector")
335
+ )
320
336
  input_: capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest = {
321
337
  "identifier": identifier
322
338
  }
@@ -367,7 +383,9 @@ class LambdaCoreClient:
367
383
  )
368
384
  return OperationResponse(output=output, response=http_response)
369
385
 
370
- interceptors_, options_ = self.operation_options(config_overrides)
386
+ interceptors_, options_ = self.operation_options(
387
+ config_overrides, OperationLogging("DeleteNetworkConnector")
388
+ )
371
389
  input_: capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest = {
372
390
  "identifier": identifier
373
391
  }
@@ -420,7 +438,9 @@ class LambdaCoreClient:
420
438
  )
421
439
  return OperationResponse(output=output, response=http_response)
422
440
 
423
- interceptors_, options_ = self.operation_options(config_overrides)
441
+ interceptors_, options_ = self.operation_options(
442
+ config_overrides, OperationLogging("ListNetworkConnectors")
443
+ )
424
444
  input_: capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest = {}
425
445
  if state is not None:
426
446
  input_["state"] = state
@@ -1,5 +1,7 @@
1
1
  from typing import Literal
2
2
 
3
+ from zapros import Response
4
+
3
5
 
4
6
  class LambdaCoreError(Exception):
5
7
  """Base class for all LambdaCore service errors."""
@@ -14,6 +16,7 @@ class ServiceError(LambdaCoreError):
14
16
  is_retryable: Whether this error is retryable.
15
17
  code: The wire error code, or ``None``.
16
18
  message: The error message, or ``None``.
19
+ response: The HTTP response the error was read from.
17
20
  """
18
21
 
19
22
  code: str | None = None
@@ -26,6 +29,7 @@ class ServiceError(LambdaCoreError):
26
29
  is_retryable: bool,
27
30
  code: str | None = None,
28
31
  message: str | None = None,
32
+ response: Response,
29
33
  ) -> None:
30
34
  super().__init__(f"{code or '<no code>'}: {message or '<no message>'}")
31
35
  self.fault = fault
@@ -33,6 +37,7 @@ class ServiceError(LambdaCoreError):
33
37
  self.is_retryable = is_retryable
34
38
  self.code = code
35
39
  self.message = message
40
+ self.response = response
36
41
 
37
42
 
38
43
  class SerializationError(LambdaCoreError):
@@ -53,9 +58,9 @@ class UnknownServiceError(ServiceError):
53
58
  """
54
59
 
55
60
  def __init__(
56
- self, *, code: str | None, message: str | None, response: object
61
+ self, *, code: str | None, message: str | None, response: Response
57
62
  ) -> None:
58
- _status = getattr(response, "status", 500)
63
+ _status = response.status
59
64
  _fault: Literal["client", "server"] = "client" if _status < 500 else "server"
60
65
  _throttling = _status == 429
61
66
  _retryable = _throttling or _status >= 500
@@ -65,8 +70,8 @@ class UnknownServiceError(ServiceError):
65
70
  is_retryable=_retryable,
66
71
  code=code,
67
72
  message=message,
73
+ response=response,
68
74
  )
69
- self.response = response
70
75
 
71
76
 
72
77
  class WaiterFailedError(LambdaCoreError):
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -41,7 +42,11 @@ class InvalidParameterValueException(ServiceError):
41
42
  code: str | None = "InvalidParameterValueException"
42
43
 
43
44
  def __init__(
44
- self, data: InvalidParameterValueException_, message: str | None = None
45
+ self,
46
+ data: InvalidParameterValueException_,
47
+ message: str | None = None,
48
+ *,
49
+ response: zapros.Response,
45
50
  ):
46
51
  super().__init__(
47
52
  "client",
@@ -49,11 +54,12 @@ class InvalidParameterValueException(ServiceError):
49
54
  is_retryable=False,
50
55
  code="InvalidParameterValueException",
51
56
  message=message,
57
+ response=response,
52
58
  )
53
59
  self.data = data
54
60
 
55
61
  @classmethod
56
62
  def from_json(
57
- cls, data: dict, message: str | None = None
63
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
58
64
  ) -> "InvalidParameterValueException":
59
- return cls(deserialize_json(data), message)
65
+ return cls(deserialize_json(data), message, response=response)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -42,7 +43,11 @@ class NetworkConnectorLimitExceededException(ServiceError):
42
43
  code: str | None = "NetworkConnectorLimitExceededException"
43
44
 
44
45
  def __init__(
45
- self, data: NetworkConnectorLimitExceededException_, message: str | None = None
46
+ self,
47
+ data: NetworkConnectorLimitExceededException_,
48
+ message: str | None = None,
49
+ *,
50
+ response: zapros.Response,
46
51
  ):
47
52
  super().__init__(
48
53
  "client",
@@ -50,11 +55,12 @@ class NetworkConnectorLimitExceededException(ServiceError):
50
55
  is_retryable=False,
51
56
  code="NetworkConnectorLimitExceededException",
52
57
  message=message,
58
+ response=response,
53
59
  )
54
60
  self.data = data
55
61
 
56
62
  @classmethod
57
63
  def from_json(
58
- cls, data: dict, message: str | None = None
64
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
59
65
  ) -> "NetworkConnectorLimitExceededException":
60
- return cls(deserialize_json(data), message)
66
+ return cls(deserialize_json(data), message, response=response)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -40,18 +41,25 @@ class ResourceConflictException(ServiceError):
40
41
 
41
42
  code: str | None = "ResourceConflictException"
42
43
 
43
- def __init__(self, data: ResourceConflictException_, message: str | None = None):
44
+ def __init__(
45
+ self,
46
+ data: ResourceConflictException_,
47
+ message: str | None = None,
48
+ *,
49
+ response: zapros.Response,
50
+ ):
44
51
  super().__init__(
45
52
  "client",
46
53
  is_throttling_error=False,
47
54
  is_retryable=False,
48
55
  code="ResourceConflictException",
49
56
  message=message,
57
+ response=response,
50
58
  )
51
59
  self.data = data
52
60
 
53
61
  @classmethod
54
62
  def from_json(
55
- cls, data: dict, message: str | None = None
63
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
56
64
  ) -> "ResourceConflictException":
57
- return cls(deserialize_json(data), message)
65
+ return cls(deserialize_json(data), message, response=response)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -40,18 +41,25 @@ class ResourceNotFoundException(ServiceError):
40
41
 
41
42
  code: str | None = "ResourceNotFoundException"
42
43
 
43
- def __init__(self, data: ResourceNotFoundException_, message: str | None = None):
44
+ def __init__(
45
+ self,
46
+ data: ResourceNotFoundException_,
47
+ message: str | None = None,
48
+ *,
49
+ response: zapros.Response,
50
+ ):
44
51
  super().__init__(
45
52
  "client",
46
53
  is_throttling_error=False,
47
54
  is_retryable=False,
48
55
  code="ResourceNotFoundException",
49
56
  message=message,
57
+ response=response,
50
58
  )
51
59
  self.data = data
52
60
 
53
61
  @classmethod
54
62
  def from_json(
55
- cls, data: dict, message: str | None = None
63
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
56
64
  ) -> "ResourceNotFoundException":
57
- return cls(deserialize_json(data), message)
65
+ return cls(deserialize_json(data), message, response=response)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -40,16 +41,25 @@ class ServiceException(ServiceError):
40
41
 
41
42
  code: str | None = "ServiceException"
42
43
 
43
- def __init__(self, data: ServiceException_, message: str | None = None):
44
+ def __init__(
45
+ self,
46
+ data: ServiceException_,
47
+ message: str | None = None,
48
+ *,
49
+ response: zapros.Response,
50
+ ):
44
51
  super().__init__(
45
52
  "server",
46
53
  is_throttling_error=False,
47
54
  is_retryable=False,
48
55
  code="ServiceException",
49
56
  message=message,
57
+ response=response,
50
58
  )
51
59
  self.data = data
52
60
 
53
61
  @classmethod
54
- def from_json(cls, data: dict, message: str | None = None) -> "ServiceException":
55
- return cls(deserialize_json(data), message)
62
+ def from_json(
63
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
64
+ ) -> "ServiceException":
65
+ return cls(deserialize_json(data), message, response=response)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ import zapros
5
6
  from typing_extensions import NotRequired, TypedDict
6
7
 
7
8
  from capo_lambda_core.errors import ServiceError
@@ -57,18 +58,25 @@ class TooManyRequestsException(ServiceError):
57
58
 
58
59
  code: str | None = "TooManyRequestsException"
59
60
 
60
- def __init__(self, data: TooManyRequestsException_, message: str | None = None):
61
+ def __init__(
62
+ self,
63
+ data: TooManyRequestsException_,
64
+ message: str | None = None,
65
+ *,
66
+ response: zapros.Response,
67
+ ):
61
68
  super().__init__(
62
69
  "client",
63
70
  is_throttling_error=False,
64
71
  is_retryable=False,
65
72
  code="TooManyRequestsException",
66
73
  message=message,
74
+ response=response,
67
75
  )
68
76
  self.data = data
69
77
 
70
78
  @classmethod
71
79
  def from_json(
72
- cls, data: dict, message: str | None = None
80
+ cls, data: dict, message: str | None = None, *, response: zapros.Response
73
81
  ) -> "TooManyRequestsException":
74
- return cls(deserialize_json(data), message)
82
+ return cls(deserialize_json(data), message, response=response)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: capo-lambda-core
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Python SDK for AWS Lambda Core.
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Intended Audience :: Developers
@@ -1,5 +1,6 @@
1
1
  capo_lambda_core/__init__.py,sha256=2z7DzYTApVMarSd2DP3cAYNq4xH4TvT4u_w2DkvDp8w,2188
2
2
  capo_lambda_core/_async.py,sha256=h6ySvzTgw6Vz53pgCi0YvxHurRgLsjGXXfskGimI4AY,451
3
+ capo_lambda_core/_aws.py,sha256=J3fgqo5_OvD4snBVUfjQgQgfbcGalRBUUr9cUTvGlKk,939
3
4
  capo_lambda_core/_body.py,sha256=jSCEnWRtVOClX1-ox0VnG2YHmnRtANO52vhR8951EWI,8496
4
5
  capo_lambda_core/_iter.py,sha256=T_s-wDvQwcKN5JpnWCBFyyXXGsbAwQisFSSK5RPKDTA,3165
5
6
  capo_lambda_core/_pagination.py,sha256=EihZfcSTQN5NRCcdJ26KcpYTUGzctwP6Iz9jYBFntWg,698
@@ -9,33 +10,33 @@ capo_lambda_core/_auth/_providers.py,sha256=L3nWWsx5C9THHTsHAadWi8bHYZLeChizCmZX
9
10
  capo_lambda_core/_auth/_signers.py,sha256=y3CBvzVRkAZ0nYg5br_HFkpKWklQE6zbca5HVCexD9o,4962
10
11
  capo_lambda_core/_auth/_sigv4.py,sha256=4Zu1I9lXRTjt_CeEqrySWys72sAKtDM1FSVpi8u9Y6Q,20728
11
12
  capo_lambda_core/_auth/_zapros_handler.py,sha256=8xdfKJH-rJB2fFNajj7v5JlSn06u9ZUoOmgqUh2jptA,2978
12
- capo_lambda_core/_operations/lambda_core_api_service/create_network_connector.py,sha256=B_xdFr0XOEt_zqxeJVzaJCoMFOXDdbr3NH8zhdWMDVQ,6970
13
- capo_lambda_core/_operations/lambda_core_api_service/delete_network_connector.py,sha256=OF7bIFmNfZc9afP7-tHzw8xr5bFcAzTzJruMWXHcN5g,6800
14
- capo_lambda_core/_operations/lambda_core_api_service/get_network_connector.py,sha256=lP2c56VAg9YLJ-V0XsS02lcoEKTFWBdXazt14CF4Hak,6727
15
- capo_lambda_core/_operations/lambda_core_api_service/list_network_connectors.py,sha256=ZsS5oIgIFZFSeRxrchLlxSuonH440bz_B4mRNW74Nuo,6614
16
- capo_lambda_core/_operations/lambda_core_api_service/update_network_connector.py,sha256=Kl2DTQIh2u8Qctr2PNlOfOVOdIaD_cZb_QHTQMAaef4,7094
13
+ capo_lambda_core/_operations/lambda_core_api_service/create_network_connector.py,sha256=c-n-RbQ2V9-UIo13WT-y4V90kvmbOsS3a8BdigIFwLQ,7065
14
+ capo_lambda_core/_operations/lambda_core_api_service/delete_network_connector.py,sha256=hSCChSr8khcVvzulMMN3mo8Jg5yLCVpEKu8CP4KSSPg,6895
15
+ capo_lambda_core/_operations/lambda_core_api_service/get_network_connector.py,sha256=R35rQHlYi86YeARGsNkCkjWFhaFs_lyUVVYrsNXOqdk,6803
16
+ capo_lambda_core/_operations/lambda_core_api_service/list_network_connectors.py,sha256=hdAqJC3wNOtPkFxFFfnXkL7jEXq3rzjM_W79BzVJH-c,6671
17
+ capo_lambda_core/_operations/lambda_core_api_service/update_network_connector.py,sha256=qpQPXxGtwUtmhVGjO6EVL6a2hnNIntmefrQ-Ucby_1o,7189
17
18
  capo_lambda_core/_protocol/__init__.py,sha256=MSIVV1jVmxqtMyjeNhffomlwpuVB7-tzRK4rdPDFCG8,61
18
19
  capo_lambda_core/_protocol/errors.py,sha256=LGBCYv4hreZJWCslL1jZMzcsy9_38EYIYVRyeyrPtg8,2914
19
20
  capo_lambda_core/_protocol/eventstream.py,sha256=P27Vneb7xwMlnUp5NypduhJc99OGP2CvWlxRGFMKbTQ,8943
20
21
  capo_lambda_core/_protocol/serialize.py,sha256=9yv7gMXl03SdUzfWKUvXs-jr9uZmWDLXBM5J44azkUs,1348
21
22
  capo_lambda_core/_protocol/xml.py,sha256=D4VZOoKjh1hoV1HKUVoA6Hg7aKKfUNenyRKTSTjCQFs,1062
22
- capo_lambda_core/_resources/lambda_core_api_service/network_connector.py,sha256=ap7KAkdpyU0pc-BOr97z_WPviLwOJK3QfvksOYkGQC4,43510
23
+ capo_lambda_core/_resources/lambda_core_api_service/network_connector.py,sha256=lXkHiFv-aJAV90KigE3VLl-wIIGReAJ13LIZkIljHlc,44184
23
24
  capo_lambda_core/_rule_engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
25
  capo_lambda_core/_rule_engine/_aws_partition.py,sha256=gxziWLrEyQKXSmsQ-skA8DdYWrHXAURuxBDhZPqMNb8,5555
25
26
  capo_lambda_core/_rule_engine/_endpoint_rule_set.py,sha256=u3ySxDh5YWDm3WGxOxAb3M7G-ab9BwQ0m7qK1Z7afjc,4993
26
27
  capo_lambda_core/_rule_engine/_endpoint_runtime.py,sha256=o94904z9c3fuJJD7vDrl_k1b9nWLueMKAXB6-OxL1Fs,13797
27
28
  capo_lambda_core/_services/_aws_config.py,sha256=rcNWCI9N9AWCsBZ4nnyhz2f513o9esWOOUnwU5MCp1g,5203
28
- capo_lambda_core/_services/_pipeline.py,sha256=rYP5bKY9F9VnYha0m3ttOL0j_OLkTTja2dzwuWHHB14,8058
29
- capo_lambda_core/_services/async_lambda_core.py,sha256=6Pwf3pOZ4RrW4iwTLQN7E-pMPxiqVg_F9xpcx4beHC4,29447
30
- capo_lambda_core/_services/lambda_core.py,sha256=7-vsAVgPF5QuM6Xdynv9oLj6hjqpe8ElSYL-pTfzy5o,28919
29
+ capo_lambda_core/_services/_pipeline.py,sha256=ML8n5X46E8M1OUXYxuEO6wXFmwmS8rny0xrNTmezwUU,16798
30
+ capo_lambda_core/_services/async_lambda_core.py,sha256=sSh8Jd6ABnQ3XXdqC09UevgZutM_qGw1n9CoYUyshm4,30173
31
+ capo_lambda_core/_services/lambda_core.py,sha256=KiUUKFXht5OZVvF7VEZdUonQ4nUQ2TSGeQdsZM7XcIk,29663
31
32
  capo_lambda_core/errors/__init__.py,sha256=uuzIG5uMlesW1UnXndNgsNpe-tZiCFSS_UFeZHieFb0,1154
32
- capo_lambda_core/errors/_base.py,sha256=7RwU3dOATtaJ6mhJo8Mn3ledn_48aFJgKU2ZHM3F5mY,3034
33
- capo_lambda_core/errors/invalid_parameter_value_exception.py,sha256=LIOcXd089ZB6sOisAsk8Gd4yoUq8o0jHGpIAf4-Wsm4,1836
34
- capo_lambda_core/errors/network_connector_limit_exceeded_exception.py,sha256=KRCfBy1z5oM944NJFrCGeZ32Ji9u7Mu3DjssTFSufJU,1984
35
- capo_lambda_core/errors/resource_conflict_exception.py,sha256=_xFRxG1mjnV3HJ2lpUp30yc_33IcWPvUnOsk7-fDCRg,1767
36
- capo_lambda_core/errors/resource_not_found_exception.py,sha256=RjTmZPy0uTAJp6Lm43_6pMRKhl24-QiBymuqCXcN5J8,1767
37
- capo_lambda_core/errors/service_exception.py,sha256=YlnSab9Mh22Swl5VzyfujybTNEEREWVu2rMLQ0agyA4,1654
38
- capo_lambda_core/errors/too_many_requests_exception.py,sha256=piaA9oj7p2QePMt8SjpFIFYgUQOrgMKUPc7ukw1Ha78,2498
33
+ capo_lambda_core/errors/_base.py,sha256=QXAfTrrP6t-b4Y2iQF_N1RWcGLorgQ1E9wK7wG_VW-U,3168
34
+ capo_lambda_core/errors/invalid_parameter_value_exception.py,sha256=8yb7aPqo1yvN8mp2ikOKRMKxg2Vned3ubyBtWE2q-D4,1993
35
+ capo_lambda_core/errors/network_connector_limit_exceeded_exception.py,sha256=sedGCbk2-1PZMRTHclwvKTfFG0kSkMSVHskWWQffRfk,2141
36
+ capo_lambda_core/errors/resource_conflict_exception.py,sha256=jdbn3pgRisZXuPVVzJjsiO2YPjwDnC-hFLeY_R3-HR8,1938
37
+ capo_lambda_core/errors/resource_not_found_exception.py,sha256=pgLDtDgrqR53TNFEc130aJQ-gLoSWsEpxuq4Ysg46pA,1938
38
+ capo_lambda_core/errors/service_exception.py,sha256=DEZsZm3srvAG7OlqrXaVk8UR3vknJVTKSjaK4rIOFJI,1839
39
+ capo_lambda_core/errors/too_many_requests_exception.py,sha256=YosRto334JARdFFYIJ2O8I1Ml-soolsMcAp9QSiOLC0,2669
39
40
  capo_lambda_core/types/associated_compute_resource_types_list.py,sha256=MWyIUfvvTDGDNJXet5eaBPqBXgpZF6MevNuFtUQmOOY,998
40
41
  capo_lambda_core/types/client_token_string.py,sha256=mPCxBt-1AWmaUJ3tqvzYUjJrFm4Rcs8BwafDy3zFj0E,148
41
42
  capo_lambda_core/types/compute_resource_type.py,sha256=u0R7iYYR_3aErLbUscgGT_AOqM3chO1NOUiwfGPp2xE,385
@@ -79,8 +80,8 @@ capo_lambda_core/types/update_network_connector_request.py,sha256=WjmQ7dbyKw-h58
79
80
  capo_lambda_core/types/update_network_connector_response.py,sha256=-qzPoPTfMCRyg9Upb3PrAxs84lcl2deMGeevKe3uukQ,5887
80
81
  capo_lambda_core/types/_prelude/blob.py,sha256=L57RpNwdTSboMhnddA-0PBonXBu3oPm3RAr4Ff7IjzQ,277
81
82
  capo_lambda_core/types/_prelude/timestamp.py,sha256=wfGPIPU-oBc2-PPqjNnJIElt1jXcEdb78Ux6jSX1mu0,487
82
- capo_lambda_core-0.4.0.dist-info/licenses/LICENSE,sha256=sOQjPuig7ktMdOZpG1TdsPSYAVS_9UYVXwDDbD75nVI,1072
83
- capo_lambda_core-0.4.0.dist-info/METADATA,sha256=e6Encj9b56kWovVuiZbOrCuVKfkI_XIGg-j50kaXeWc,3552
84
- capo_lambda_core-0.4.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
85
- capo_lambda_core-0.4.0.dist-info/top_level.txt,sha256=5SOL6GmRwmGKsZnqDRXU_wnO0da1632SLMxYJflxe3E,17
86
- capo_lambda_core-0.4.0.dist-info/RECORD,,
83
+ capo_lambda_core-0.5.0.dist-info/licenses/LICENSE,sha256=sOQjPuig7ktMdOZpG1TdsPSYAVS_9UYVXwDDbD75nVI,1072
84
+ capo_lambda_core-0.5.0.dist-info/METADATA,sha256=d8IqjzwKjCT6SLRTkQ9YZ2i6znavD9WA_EF36H9nh0o,3552
85
+ capo_lambda_core-0.5.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
86
+ capo_lambda_core-0.5.0.dist-info/top_level.txt,sha256=5SOL6GmRwmGKsZnqDRXU_wnO0da1632SLMxYJflxe3E,17
87
+ capo_lambda_core-0.5.0.dist-info/RECORD,,