capo-lambda-core 0.1.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 (86) hide show
  1. capo_lambda_core/__init__.py +71 -0
  2. capo_lambda_core/_async.py +25 -0
  3. capo_lambda_core/_auth/_identity.py +16 -0
  4. capo_lambda_core/_auth/_providers.py +886 -0
  5. capo_lambda_core/_auth/_signers.py +121 -0
  6. capo_lambda_core/_auth/_sigv4.py +579 -0
  7. capo_lambda_core/_auth/_zapros_handler.py +80 -0
  8. capo_lambda_core/_body.py +221 -0
  9. capo_lambda_core/_iter.py +113 -0
  10. capo_lambda_core/_operations/lambda_core_api_service/create_network_connector.py +166 -0
  11. capo_lambda_core/_operations/lambda_core_api_service/delete_network_connector.py +163 -0
  12. capo_lambda_core/_operations/lambda_core_api_service/get_network_connector.py +162 -0
  13. capo_lambda_core/_operations/lambda_core_api_service/list_network_connectors.py +166 -0
  14. capo_lambda_core/_operations/lambda_core_api_service/update_network_connector.py +169 -0
  15. capo_lambda_core/_pagination.py +21 -0
  16. capo_lambda_core/_protocol/__init__.py +1 -0
  17. capo_lambda_core/_protocol/errors.py +93 -0
  18. capo_lambda_core/_protocol/eventstream.py +240 -0
  19. capo_lambda_core/_protocol/serialize.py +47 -0
  20. capo_lambda_core/_protocol/xml.py +33 -0
  21. capo_lambda_core/_resources/lambda_core_api_service/network_connector.py +616 -0
  22. capo_lambda_core/_rule_engine/__init__.py +0 -0
  23. capo_lambda_core/_rule_engine/_aws_partition.py +160 -0
  24. capo_lambda_core/_rule_engine/_endpoint_rule_set.py +135 -0
  25. capo_lambda_core/_rule_engine/_endpoint_runtime.py +389 -0
  26. capo_lambda_core/_services/_aws_config.py +160 -0
  27. capo_lambda_core/_services/_pipeline.py +247 -0
  28. capo_lambda_core/_services/async_lambda_core.py +468 -0
  29. capo_lambda_core/_services/lambda_core.py +463 -0
  30. capo_lambda_core/errors/__init__.py +39 -0
  31. capo_lambda_core/errors/_base.py +94 -0
  32. capo_lambda_core/errors/invalid_parameter_value_exception.py +59 -0
  33. capo_lambda_core/errors/network_connector_limit_exceeded_exception.py +60 -0
  34. capo_lambda_core/errors/resource_conflict_exception.py +57 -0
  35. capo_lambda_core/errors/resource_not_found_exception.py +57 -0
  36. capo_lambda_core/errors/service_exception.py +55 -0
  37. capo_lambda_core/errors/too_many_requests_exception.py +74 -0
  38. capo_lambda_core/py.typed +0 -0
  39. capo_lambda_core/types/_prelude/blob.py +12 -0
  40. capo_lambda_core/types/_prelude/timestamp.py +17 -0
  41. capo_lambda_core/types/associated_compute_resource_types_list.py +31 -0
  42. capo_lambda_core/types/client_token_string.py +5 -0
  43. capo_lambda_core/types/compute_resource_type.py +14 -0
  44. capo_lambda_core/types/core_timestamp.py +20 -0
  45. capo_lambda_core/types/create_network_connector_request.py +88 -0
  46. capo_lambda_core/types/create_network_connector_response.py +93 -0
  47. capo_lambda_core/types/delete_network_connector_request.py +25 -0
  48. capo_lambda_core/types/delete_network_connector_response.py +93 -0
  49. capo_lambda_core/types/get_network_connector_request.py +25 -0
  50. capo_lambda_core/types/get_network_connector_response.py +196 -0
  51. capo_lambda_core/types/list_network_connectors_request.py +34 -0
  52. capo_lambda_core/types/list_network_connectors_response.py +54 -0
  53. capo_lambda_core/types/max_hundred_list_items.py +5 -0
  54. capo_lambda_core/types/network_connector_arn.py +5 -0
  55. capo_lambda_core/types/network_connector_configuration.py +48 -0
  56. capo_lambda_core/types/network_connector_id.py +6 -0
  57. capo_lambda_core/types/network_connector_identifier.py +6 -0
  58. capo_lambda_core/types/network_connector_last_update_status.py +18 -0
  59. capo_lambda_core/types/network_connector_last_update_status_reason.py +5 -0
  60. capo_lambda_core/types/network_connector_last_update_status_reason_code.py +22 -0
  61. capo_lambda_core/types/network_connector_name.py +5 -0
  62. capo_lambda_core/types/network_connector_role_arn.py +5 -0
  63. capo_lambda_core/types/network_connector_security_group_id.py +5 -0
  64. capo_lambda_core/types/network_connector_security_group_ids.py +19 -0
  65. capo_lambda_core/types/network_connector_state.py +21 -0
  66. capo_lambda_core/types/network_connector_state_reason_code.py +22 -0
  67. capo_lambda_core/types/network_connector_subnet_id.py +5 -0
  68. capo_lambda_core/types/network_connector_subnet_ids.py +19 -0
  69. capo_lambda_core/types/network_connector_summary.py +94 -0
  70. capo_lambda_core/types/network_connector_tag_key.py +5 -0
  71. capo_lambda_core/types/network_connector_tag_value.py +5 -0
  72. capo_lambda_core/types/network_connector_tags.py +29 -0
  73. capo_lambda_core/types/network_connector_type.py +14 -0
  74. capo_lambda_core/types/network_connector_version.py +5 -0
  75. capo_lambda_core/types/network_connector_vpc_egress_configuration.py +103 -0
  76. capo_lambda_core/types/network_connectors_list.py +35 -0
  77. capo_lambda_core/types/network_protocol.py +17 -0
  78. capo_lambda_core/types/string.py +5 -0
  79. capo_lambda_core/types/throttle_reason.py +21 -0
  80. capo_lambda_core/types/update_network_connector_request.py +64 -0
  81. capo_lambda_core/types/update_network_connector_response.py +138 -0
  82. capo_lambda_core-0.1.0.dist-info/METADATA +103 -0
  83. capo_lambda_core-0.1.0.dist-info/RECORD +86 -0
  84. capo_lambda_core-0.1.0.dist-info/WHEEL +5 -0
  85. capo_lambda_core-0.1.0.dist-info/licenses/LICENSE +21 -0
  86. capo_lambda_core-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,463 @@
1
+ """Generated from Smithy shape ``com.amazonaws.lambdacore#LambdaCoreApiService``."""
2
+
3
+ import uuid
4
+ import warnings
5
+ from collections.abc import Iterator
6
+ from typing import TYPE_CHECKING, Any, Iterable, Optional
7
+
8
+ from typing_extensions import Self, TypedDict
9
+ from zapros import BaseHandler, Client
10
+
11
+ import capo_lambda_core._auth._signers
12
+ import capo_lambda_core._auth._sigv4
13
+ from capo_lambda_core._auth._identity import Credentials
14
+ from capo_lambda_core._auth._providers import (
15
+ CredentialsProvider,
16
+ IdentityProvider,
17
+ StaticAwsCredentialsProvider,
18
+ default_aws_credentials_chain,
19
+ )
20
+ from capo_lambda_core._auth._zapros_handler import AuthMiddleware
21
+ from capo_lambda_core._pagination import resolve_path as _resolve_path
22
+ from capo_lambda_core._resources.lambda_core_api_service.network_connector import (
23
+ NetworkConnector,
24
+ )
25
+ from capo_lambda_core._services._aws_config import aws_config
26
+ from capo_lambda_core._services._pipeline import (
27
+ Interceptor,
28
+ OperationOptions,
29
+ OperationRequest,
30
+ OperationResponse,
31
+ execute_pipeline,
32
+ retry,
33
+ )
34
+
35
+ if TYPE_CHECKING:
36
+ import capo_lambda_core.types.client_token_string
37
+ import capo_lambda_core.types.create_network_connector_request
38
+ import capo_lambda_core.types.create_network_connector_response
39
+ import capo_lambda_core.types.delete_network_connector_request
40
+ import capo_lambda_core.types.delete_network_connector_response
41
+ import capo_lambda_core.types.get_network_connector_request
42
+ import capo_lambda_core.types.get_network_connector_response
43
+ import capo_lambda_core.types.list_network_connectors_request
44
+ import capo_lambda_core.types.list_network_connectors_response
45
+ import capo_lambda_core.types.max_hundred_list_items
46
+ import capo_lambda_core.types.network_connector_configuration
47
+ import capo_lambda_core.types.network_connector_identifier
48
+ import capo_lambda_core.types.network_connector_name
49
+ import capo_lambda_core.types.network_connector_role_arn
50
+ import capo_lambda_core.types.network_connector_state
51
+ import capo_lambda_core.types.network_connector_summary
52
+ import capo_lambda_core.types.network_connector_tags
53
+ import capo_lambda_core.types.string
54
+ import capo_lambda_core.types.update_network_connector_request
55
+ import capo_lambda_core.types.update_network_connector_response
56
+
57
+
58
+ class LambdaCoreClientConfig(TypedDict, total=False, closed=True):
59
+ operation_interceptors: Iterable[Interceptor[Any, Any]]
60
+ retry_max_attempts: int | None
61
+ region: str | None
62
+ use_dual_stack: bool | None
63
+ use_fips: bool | None
64
+ endpoint: str | None
65
+ credentials_provider: IdentityProvider[Credentials] | None
66
+
67
+
68
+ class LambdaCoreClient:
69
+ """A client for the ``LambdaCore`` service.
70
+
71
+ Args:
72
+ http_handler: HTTP handler for sending requests. If not provided, creates a default handler.
73
+ operation_interceptors: Interceptors that wrap every operation call. If not provided, defaults to an empty list.
74
+ retry_max_attempts: Maximum number of times to retry a failed operation. Defaults to 3.
75
+ region: The value of the ``AWS::Region`` endpoint parameter.
76
+ use_dual_stack: The value of the ``AWS::UseDualStack`` endpoint parameter.
77
+ use_fips: The value of the ``AWS::UseFIPS`` endpoint parameter.
78
+ endpoint: The value of the ``SDK::Endpoint`` endpoint parameter.
79
+ credentials: AWS credentials for request signing.
80
+ credentials_provider: Provider that resolves AWS credentials. Takes precedence over ``credentials``.
81
+ """
82
+
83
+ def __init__(
84
+ self,
85
+ http_handler: BaseHandler | None = None,
86
+ operation_interceptors: Iterable[Interceptor[Any, Any]] | None = None,
87
+ retry_max_attempts: int | None = None,
88
+ region: str | None = None,
89
+ use_dual_stack: bool | None = None,
90
+ use_fips: bool | None = None,
91
+ endpoint: str | None = None,
92
+ credentials: Credentials | None = None,
93
+ credentials_provider: CredentialsProvider | None = None,
94
+ ):
95
+ self._client = Client(http_handler).wrap_with_middleware(
96
+ lambda next: AuthMiddleware(next)
97
+ )
98
+ if credentials is not None and credentials_provider is not None:
99
+ warnings.warn(
100
+ "Both credentials and credentials_provider given; provider takes precedence"
101
+ )
102
+ resolved_credentials_provider: IdentityProvider[Credentials] | None = (
103
+ credentials_provider
104
+ )
105
+ if resolved_credentials_provider is None and credentials is not None:
106
+ resolved_credentials_provider = StaticAwsCredentialsProvider(credentials)
107
+ if resolved_credentials_provider is None and credentials is None:
108
+ resolved_credentials_provider = default_aws_credentials_chain(
109
+ Client(http_handler)
110
+ )
111
+ self._config = LambdaCoreClientConfig(
112
+ {
113
+ "operation_interceptors": operation_interceptors or [],
114
+ "retry_max_attempts": retry_max_attempts,
115
+ "region": region,
116
+ "use_dual_stack": use_dual_stack,
117
+ "use_fips": use_fips,
118
+ "endpoint": endpoint,
119
+ "credentials_provider": resolved_credentials_provider,
120
+ }
121
+ )
122
+
123
+ # resources
124
+ self.network_connector = NetworkConnector(self)
125
+
126
+ def operation_options(
127
+ self, config_overrides: Optional[LambdaCoreClientConfig] = None
128
+ ) -> tuple[Iterable[Interceptor[Any, Any]], OperationOptions]:
129
+ overrides: LambdaCoreClientConfig = config_overrides or {}
130
+ interceptors_: list[Interceptor[Any, Any]] = [
131
+ *overrides.get(
132
+ "operation_interceptors", self._config.get("operation_interceptors", [])
133
+ ),
134
+ aws_config(),
135
+ retry(),
136
+ ]
137
+ options_: OperationOptions = OperationOptions(
138
+ client=self._client,
139
+ retry_max_attempts=overrides.get(
140
+ "retry_max_attempts", self._config.get("retry_max_attempts")
141
+ ),
142
+ region=overrides.get("region", self._config.get("region")),
143
+ use_dual_stack=overrides.get(
144
+ "use_dual_stack", self._config.get("use_dual_stack")
145
+ ),
146
+ use_fips=overrides.get("use_fips", self._config.get("use_fips")),
147
+ endpoint=overrides.get("endpoint", self._config.get("endpoint")),
148
+ credentials_provider=overrides.get(
149
+ "credentials_provider", self._config.get("credentials_provider")
150
+ ),
151
+ )
152
+ return interceptors_, options_
153
+
154
+ def create_network_connector(
155
+ self,
156
+ name: "capo_lambda_core.types.network_connector_name.NetworkConnectorName",
157
+ configuration: "capo_lambda_core.types.network_connector_configuration.NetworkConnectorConfiguration",
158
+ *,
159
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
160
+ operator_role: Optional[
161
+ "capo_lambda_core.types.network_connector_role_arn.NetworkConnectorRoleArn"
162
+ ] = None,
163
+ client_token: Optional[
164
+ "capo_lambda_core.types.client_token_string.ClientTokenString"
165
+ ] = None,
166
+ tags: Optional[
167
+ "capo_lambda_core.types.network_connector_tags.NetworkConnectorTags"
168
+ ] = None,
169
+ ) -> "capo_lambda_core.types.create_network_connector_response.CreateNetworkConnectorResponse":
170
+ """<p>Creates a network connector that enables Lambda compute resources to route outbound traffic through your Amazon VPC. The network connector provisions elastic network interfaces (ENIs) in the subnets you specify, providing a managed network path to private resources such as databases, caches, and internal APIs.</p> <p>This operation is asynchronous. The network connector starts in <code>PENDING</code> state while ENIs are provisioned in your VPC (provisioning typically takes up to 10 minutes). Use <code>GetNetworkConnector</code> to poll the connector state until it reaches <code>ACTIVE</code>. Once active, you can attach the connector to Lambda MicroVMs at run time using the <code>egressNetworkConnectors</code> parameter on <code>RunMicroVm</code>.</p> <p>This operation is idempotent when you provide a <code>ClientToken</code> — if you retry a request that completed successfully using the same client token, the operation returns the existing connector without creating a duplicate.</p>
171
+
172
+ Args:
173
+ name: <p>A unique name for the network connector within your account and Region. You can use the name to identify the connector in subsequent API calls.</p>
174
+ configuration: <p>The network configuration for the connector. Specify a <code>VpcEgressConfiguration</code> to enable outbound traffic routing through your VPC.</p>
175
+ operator_role: <p>The ARN of the IAM role that Lambda assumes to manage elastic network interfaces in your VPC. This role must have permissions for <code>ec2:CreateNetworkInterface</code>, <code>ec2:DeleteNetworkInterface</code>, and related describe operations.</p>
176
+ client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request with the same client token, the API returns the existing connector without creating a duplicate.</p>
177
+ tags: <p>A map of key-value pairs to associate with the network connector for organization, cost allocation, or access control.</p>
178
+
179
+ Raises:
180
+ capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
181
+ capo_lambda_core.errors.network_connector_limit_exceeded_exception.NetworkConnectorLimitExceededException: <p>The account has reached the maximum number of network connectors allowed. Delete unused connectors or request a limit increase through Service Quotas.</p>
182
+ capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException: <p>The request could not be completed due to a conflict with the current state of the resource. For example, attempting to update a connector that is not in <code>ACTIVE</code> state.</p>
183
+ capo_lambda_core.errors.service_exception.ServiceException: <p>An internal service error occurred. Retry the request with exponential backoff.</p>
184
+ capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
185
+ capo_lambda_core.errors.UnknownServiceError: The service returned an error code this client does not model.
186
+ """
187
+
188
+ def _handler(
189
+ req: "OperationRequest[capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest]",
190
+ ) -> OperationResponse[
191
+ "capo_lambda_core.types.create_network_connector_response.CreateNetworkConnectorResponse"
192
+ ]:
193
+ import capo_lambda_core._operations.lambda_core_api_service.create_network_connector
194
+
195
+ output, http_response = (
196
+ capo_lambda_core._operations.lambda_core_api_service.create_network_connector.create_network_connector(
197
+ req.options, req.input
198
+ )
199
+ )
200
+ return OperationResponse(output=output, response=http_response)
201
+
202
+ interceptors_, options_ = self.operation_options(config_overrides)
203
+ input_: capo_lambda_core.types.create_network_connector_request.CreateNetworkConnectorRequest = {
204
+ "name": name,
205
+ "configuration": configuration,
206
+ }
207
+ if operator_role is not None:
208
+ input_["operator_role"] = operator_role
209
+ if client_token is None:
210
+ client_token = str(uuid.uuid4())
211
+ input_["client_token"] = client_token
212
+ if tags is not None:
213
+ input_["tags"] = tags
214
+
215
+ response = execute_pipeline(
216
+ OperationRequest(input=input_, options=options_),
217
+ handler=_handler,
218
+ interceptors=list(interceptors_),
219
+ )
220
+ response.response.close()
221
+ return response.output
222
+
223
+ def get_network_connector(
224
+ self,
225
+ identifier: "capo_lambda_core.types.network_connector_identifier.NetworkConnectorIdentifier",
226
+ *,
227
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
228
+ ) -> "capo_lambda_core.types.get_network_connector_response.GetNetworkConnectorResponse":
229
+ """<p>Retrieves the current configuration, state, and metadata of a network connector. The <code>Identifier</code> parameter accepts the connector ID, name, or full ARN. Use this operation to poll connector state after creation or update, or to inspect the current VPC configuration and any failure reasons.</p> <p>The response includes the full connector configuration, current state, and — if the connector has been updated — the <code>LastUpdateStatus</code> and <code>LastUpdateStatusReasonCode</code> fields that indicate whether the most recent update succeeded or failed.</p>
230
+
231
+ Raises:
232
+ capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
233
+ capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified network connector does not exist. Verify the identifier (ID, name, or ARN) and Region.</p>
234
+ capo_lambda_core.errors.service_exception.ServiceException: <p>An internal service error occurred. Retry the request with exponential backoff.</p>
235
+ capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
236
+ capo_lambda_core.errors.UnknownServiceError: The service returned an error code this client does not model.
237
+ """
238
+
239
+ def _handler(
240
+ req: "OperationRequest[capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest]",
241
+ ) -> OperationResponse[
242
+ "capo_lambda_core.types.get_network_connector_response.GetNetworkConnectorResponse"
243
+ ]:
244
+ import capo_lambda_core._operations.lambda_core_api_service.get_network_connector
245
+
246
+ output, http_response = (
247
+ capo_lambda_core._operations.lambda_core_api_service.get_network_connector.get_network_connector(
248
+ req.options, req.input
249
+ )
250
+ )
251
+ return OperationResponse(output=output, response=http_response)
252
+
253
+ interceptors_, options_ = self.operation_options(config_overrides)
254
+ input_: capo_lambda_core.types.get_network_connector_request.GetNetworkConnectorRequest = {
255
+ "identifier": identifier
256
+ }
257
+
258
+ response = execute_pipeline(
259
+ OperationRequest(input=input_, options=options_),
260
+ handler=_handler,
261
+ interceptors=list(interceptors_),
262
+ )
263
+ response.response.close()
264
+ return response.output
265
+
266
+ def update_network_connector(
267
+ self,
268
+ identifier: "capo_lambda_core.types.network_connector_identifier.NetworkConnectorIdentifier",
269
+ *,
270
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
271
+ configuration: Optional[
272
+ "capo_lambda_core.types.network_connector_configuration.NetworkConnectorConfiguration"
273
+ ] = None,
274
+ operator_role: Optional[
275
+ "capo_lambda_core.types.network_connector_role_arn.NetworkConnectorRoleArn"
276
+ ] = None,
277
+ client_token: Optional[
278
+ "capo_lambda_core.types.client_token_string.ClientTokenString"
279
+ ] = None,
280
+ ) -> "capo_lambda_core.types.update_network_connector_response.UpdateNetworkConnectorResponse":
281
+ """<p>Updates the VPC configuration or operator role of an existing network connector. You can modify the subnet IDs, security group IDs, network protocol, or operator role. The connector must be in <code>ACTIVE</code> state to accept updates.</p> <p>This operation is asynchronous. The connector remains in <code>ACTIVE</code> state during the update — existing workloads that reference this connector are not disrupted. Use <code>GetNetworkConnector</code> to monitor the <code>LastUpdateStatus</code> field, which transitions through <code>InProgress</code> to <code>Successful</code> or <code>Failed</code>. If the update fails, the <code>LastUpdateStatusReasonCode</code> field provides a specific error code for troubleshooting. This operation is idempotent when you provide a <code>ClientToken</code>.</p>
282
+
283
+ Args:
284
+ configuration: <p>The updated network configuration for the connector. Provide the full <code>VpcEgressConfiguration</code> including all subnet IDs and security group IDs — this replaces the existing configuration.</p>
285
+ operator_role: <p>The updated ARN of the IAM role that Lambda assumes to manage ENIs. Use this to change the operator role without recreating the connector.</p>
286
+ client_token: <p>A unique, case-sensitive identifier to ensure idempotency of the update request.</p>
287
+
288
+ Raises:
289
+ capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
290
+ capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException: <p>The request could not be completed due to a conflict with the current state of the resource. For example, attempting to update a connector that is not in <code>ACTIVE</code> state.</p>
291
+ capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified network connector does not exist. Verify the identifier (ID, name, or ARN) and Region.</p>
292
+ capo_lambda_core.errors.service_exception.ServiceException: <p>An internal service error occurred. Retry the request with exponential backoff.</p>
293
+ capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
294
+ capo_lambda_core.errors.UnknownServiceError: The service returned an error code this client does not model.
295
+ """
296
+
297
+ def _handler(
298
+ req: "OperationRequest[capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest]",
299
+ ) -> OperationResponse[
300
+ "capo_lambda_core.types.update_network_connector_response.UpdateNetworkConnectorResponse"
301
+ ]:
302
+ import capo_lambda_core._operations.lambda_core_api_service.update_network_connector
303
+
304
+ output, http_response = (
305
+ capo_lambda_core._operations.lambda_core_api_service.update_network_connector.update_network_connector(
306
+ req.options, req.input
307
+ )
308
+ )
309
+ return OperationResponse(output=output, response=http_response)
310
+
311
+ interceptors_, options_ = self.operation_options(config_overrides)
312
+ input_: capo_lambda_core.types.update_network_connector_request.UpdateNetworkConnectorRequest = {
313
+ "identifier": identifier
314
+ }
315
+ if configuration is not None:
316
+ input_["configuration"] = configuration
317
+ if operator_role is not None:
318
+ input_["operator_role"] = operator_role
319
+ if client_token is None:
320
+ client_token = str(uuid.uuid4())
321
+ input_["client_token"] = client_token
322
+
323
+ response = execute_pipeline(
324
+ OperationRequest(input=input_, options=options_),
325
+ handler=_handler,
326
+ interceptors=list(interceptors_),
327
+ )
328
+ response.response.close()
329
+ return response.output
330
+
331
+ def delete_network_connector(
332
+ self,
333
+ identifier: "capo_lambda_core.types.network_connector_identifier.NetworkConnectorIdentifier",
334
+ *,
335
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
336
+ ) -> "capo_lambda_core.types.delete_network_connector_response.DeleteNetworkConnectorResponse":
337
+ """<p>Initiates deletion of a network connector. The connector transitions to <code>DELETING</code> state while elastic network interfaces are cleaned up asynchronously. After deletion completes, subsequent calls to <code>GetNetworkConnector</code> return <code>ResourceNotFoundException</code>.</p> <p>This operation is idempotent — calling delete on a connector that is already deleting or has been deleted succeeds without error. You can delete connectors in <code>ACTIVE</code> or <code>FAILED</code> states. Before deleting a connector, ensure that no Lambda MicroVMs are using it, as they will lose VPC egress connectivity immediately.</p>
338
+
339
+ Raises:
340
+ capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
341
+ capo_lambda_core.errors.resource_conflict_exception.ResourceConflictException: <p>The request could not be completed due to a conflict with the current state of the resource. For example, attempting to update a connector that is not in <code>ACTIVE</code> state.</p>
342
+ capo_lambda_core.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified network connector does not exist. Verify the identifier (ID, name, or ARN) and Region.</p>
343
+ capo_lambda_core.errors.service_exception.ServiceException: <p>An internal service error occurred. Retry the request with exponential backoff.</p>
344
+ capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
345
+ capo_lambda_core.errors.UnknownServiceError: The service returned an error code this client does not model.
346
+ """
347
+
348
+ def _handler(
349
+ req: "OperationRequest[capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest]",
350
+ ) -> OperationResponse[
351
+ "capo_lambda_core.types.delete_network_connector_response.DeleteNetworkConnectorResponse"
352
+ ]:
353
+ import capo_lambda_core._operations.lambda_core_api_service.delete_network_connector
354
+
355
+ output, http_response = (
356
+ capo_lambda_core._operations.lambda_core_api_service.delete_network_connector.delete_network_connector(
357
+ req.options, req.input
358
+ )
359
+ )
360
+ return OperationResponse(output=output, response=http_response)
361
+
362
+ interceptors_, options_ = self.operation_options(config_overrides)
363
+ input_: capo_lambda_core.types.delete_network_connector_request.DeleteNetworkConnectorRequest = {
364
+ "identifier": identifier
365
+ }
366
+
367
+ response = execute_pipeline(
368
+ OperationRequest(input=input_, options=options_),
369
+ handler=_handler,
370
+ interceptors=list(interceptors_),
371
+ )
372
+ response.response.close()
373
+ return response.output
374
+
375
+ def list_network_connectors(
376
+ self,
377
+ *,
378
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
379
+ state: Optional[
380
+ "capo_lambda_core.types.network_connector_state.NetworkConnectorState"
381
+ ] = None,
382
+ marker: Optional["capo_lambda_core.types.string.String"] = None,
383
+ max_items: Optional[
384
+ "capo_lambda_core.types.max_hundred_list_items.MaxHundredListItems"
385
+ ] = None,
386
+ ) -> "capo_lambda_core.types.list_network_connectors_response.ListNetworkConnectorsResponse":
387
+ """<p>Returns a paginated list of network connectors in your account for the current Region. You can optionally filter results by connector state. Use the <code>Marker</code> parameter from a previous response to retrieve the next page of results.</p> <p>Each item in the response includes the connector ARN, name, ID, type, current state, and last modified timestamp. To retrieve full configuration details for a specific connector, use <code>GetNetworkConnector</code>.</p>
388
+
389
+ Args:
390
+ state: <p>Optional filter to return only connectors in the specified state (for example, <code>ACTIVE</code> or <code>FAILED</code>).</p>
391
+ marker: <p>The pagination token from a previous <code>ListNetworkConnectors</code> response. Use this value to retrieve the next page of results.</p>
392
+ max_items: <p>The maximum number of connectors to return per page. Valid range: 1 to 100.</p>
393
+
394
+ Raises:
395
+ capo_lambda_core.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid. Check the error message for details about which parameter failed validation.</p>
396
+ capo_lambda_core.errors.service_exception.ServiceException: <p>An internal service error occurred. Retry the request with exponential backoff.</p>
397
+ capo_lambda_core.errors.too_many_requests_exception.TooManyRequestsException: <p>The request was throttled due to exceeding the allowed request rate. Retry the request after a brief wait using exponential backoff.</p>
398
+ capo_lambda_core.errors.UnknownServiceError: The service returned an error code this client does not model.
399
+ """
400
+
401
+ def _handler(
402
+ req: "OperationRequest[capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest]",
403
+ ) -> OperationResponse[
404
+ "capo_lambda_core.types.list_network_connectors_response.ListNetworkConnectorsResponse"
405
+ ]:
406
+ import capo_lambda_core._operations.lambda_core_api_service.list_network_connectors
407
+
408
+ output, http_response = (
409
+ capo_lambda_core._operations.lambda_core_api_service.list_network_connectors.list_network_connectors(
410
+ req.options, req.input
411
+ )
412
+ )
413
+ return OperationResponse(output=output, response=http_response)
414
+
415
+ interceptors_, options_ = self.operation_options(config_overrides)
416
+ input_: capo_lambda_core.types.list_network_connectors_request.ListNetworkConnectorsRequest = {}
417
+ if state is not None:
418
+ input_["state"] = state
419
+ if marker is not None:
420
+ input_["marker"] = marker
421
+ if max_items is not None:
422
+ input_["max_items"] = max_items
423
+
424
+ response = execute_pipeline(
425
+ OperationRequest(input=input_, options=options_),
426
+ handler=_handler,
427
+ interceptors=list(interceptors_),
428
+ )
429
+ response.response.close()
430
+ return response.output
431
+
432
+ def iter_list_network_connectors(
433
+ self,
434
+ *,
435
+ config_overrides: Optional[LambdaCoreClientConfig] = None,
436
+ state: Optional[
437
+ "capo_lambda_core.types.network_connector_state.NetworkConnectorState"
438
+ ] = None,
439
+ marker: Optional["capo_lambda_core.types.string.String"] = None,
440
+ max_items: Optional[
441
+ "capo_lambda_core.types.max_hundred_list_items.MaxHundredListItems"
442
+ ] = None,
443
+ ) -> "Iterator[capo_lambda_core.types.network_connector_summary.NetworkConnectorSummary]":
444
+ _token = marker
445
+ while True:
446
+ _response = self.list_network_connectors(
447
+ config_overrides=config_overrides,
448
+ state=state,
449
+ marker=_token,
450
+ max_items=max_items,
451
+ )
452
+ _page = _resolve_path(_response, ("network_connectors",))
453
+ for _item in _page or []:
454
+ yield _item
455
+ _token = _resolve_path(_response, ("next_marker",))
456
+ if not _token:
457
+ break
458
+
459
+ def __enter__(self) -> Self:
460
+ return self
461
+
462
+ def __exit__(self, exc_type: Any, exc: Any, tb: Any):
463
+ self._client.close()
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ from ._base import (
4
+ DeserializationError as DeserializationError,
5
+ )
6
+ from ._base import (
7
+ LambdaCoreError as LambdaCoreError,
8
+ )
9
+ from ._base import (
10
+ SerializationError as SerializationError,
11
+ )
12
+ from ._base import (
13
+ ServiceError as ServiceError,
14
+ )
15
+ from ._base import (
16
+ UnknownServiceError as UnknownServiceError,
17
+ )
18
+ from ._base import (
19
+ WaiterFailedError as WaiterFailedError,
20
+ )
21
+ from ._base import (
22
+ WaiterTimeoutError as WaiterTimeoutError,
23
+ )
24
+ from .invalid_parameter_value_exception import (
25
+ InvalidParameterValueException as InvalidParameterValueException,
26
+ )
27
+ from .network_connector_limit_exceeded_exception import (
28
+ NetworkConnectorLimitExceededException as NetworkConnectorLimitExceededException,
29
+ )
30
+ from .resource_conflict_exception import (
31
+ ResourceConflictException as ResourceConflictException,
32
+ )
33
+ from .resource_not_found_exception import (
34
+ ResourceNotFoundException as ResourceNotFoundException,
35
+ )
36
+ from .service_exception import ServiceException as ServiceException
37
+ from .too_many_requests_exception import (
38
+ TooManyRequestsException as TooManyRequestsException,
39
+ )
@@ -0,0 +1,94 @@
1
+ from typing import Literal
2
+
3
+
4
+ class LambdaCoreError(Exception):
5
+ """Base class for all LambdaCore service errors."""
6
+
7
+
8
+ class ServiceError(LambdaCoreError):
9
+ """Base class for all modeled service errors.
10
+
11
+ Args:
12
+ fault: ``"client"`` or ``"server"``.
13
+ is_throttling_error: Whether this error is a throttling error.
14
+ is_retryable: Whether this error is retryable.
15
+ code: The wire error code, or ``None``.
16
+ message: The error message, or ``None``.
17
+ """
18
+
19
+ code: str | None = None
20
+
21
+ def __init__(
22
+ self,
23
+ fault: Literal["client", "server"],
24
+ *,
25
+ is_throttling_error: bool,
26
+ is_retryable: bool,
27
+ code: str | None = None,
28
+ message: str | None = None,
29
+ ) -> None:
30
+ super().__init__(f"{code or '<no code>'}: {message or '<no message>'}")
31
+ self.fault = fault
32
+ self.is_throttling_error = is_throttling_error
33
+ self.is_retryable = is_retryable
34
+ self.code = code
35
+ self.message = message
36
+
37
+
38
+ class SerializationError(LambdaCoreError):
39
+ """Raised when a value cannot be serialized."""
40
+
41
+
42
+ class DeserializationError(LambdaCoreError):
43
+ """Raised when a value cannot be deserialized or a required member is missing."""
44
+
45
+
46
+ class UnknownServiceError(ServiceError):
47
+ """Raised when the server returns an error code the client does not model.
48
+
49
+ Args:
50
+ code: ``<Code>`` text from the response body, or ``None`` if absent.
51
+ message: ``<Message>`` text from the response body, or ``None``.
52
+ response: The original HTTP response object, for arbitrary inspection.
53
+ """
54
+
55
+ def __init__(
56
+ self, *, code: str | None, message: str | None, response: object
57
+ ) -> None:
58
+ _status = getattr(response, "status", 500)
59
+ _fault: Literal["client", "server"] = "client" if _status < 500 else "server"
60
+ _throttling = _status == 429
61
+ _retryable = _throttling or _status >= 500
62
+ super().__init__(
63
+ _fault,
64
+ is_throttling_error=_throttling,
65
+ is_retryable=_retryable,
66
+ code=code,
67
+ message=message,
68
+ )
69
+ self.response = response
70
+
71
+
72
+ class WaiterFailedError(LambdaCoreError):
73
+ """Raised when a waiter hits an acceptor with ``state="failure"``.
74
+
75
+ Args:
76
+ waiter_name: snake_case waiter name (e.g. ``bucket_exists``).
77
+ reason: Short description of which acceptor fired.
78
+ """
79
+
80
+ def __init__(self, waiter_name: str, reason: str) -> None:
81
+ super().__init__(f"waiter {waiter_name} failed: {reason}")
82
+ self.waiter_name = waiter_name
83
+ self.reason = reason
84
+
85
+
86
+ class WaiterTimeoutError(LambdaCoreError):
87
+ """Raised when a waiter exhausts ``max_wait_time`` without a terminal acceptor."""
88
+
89
+ def __init__(self, waiter_name: str, max_wait_time: float) -> None:
90
+ super().__init__(
91
+ f"waiter {waiter_name} timed out after {max_wait_time} seconds"
92
+ )
93
+ self.waiter_name = waiter_name
94
+ self.max_wait_time = max_wait_time
@@ -0,0 +1,59 @@
1
+ """Generated from Smithy shape ``com.amazonaws.lambdacore#InvalidParameterValueException``."""
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from typing_extensions import NotRequired, TypedDict
6
+
7
+ from capo_lambda_core.errors import ServiceError
8
+
9
+ if TYPE_CHECKING:
10
+ import capo_lambda_core.types.string
11
+
12
+
13
+ class InvalidParameterValueException_(TypedDict, closed=True):
14
+ type: NotRequired["capo_lambda_core.types.string.String"]
15
+ """<p>The exception type.</p>"""
16
+ message: NotRequired["capo_lambda_core.types.string.String"]
17
+
18
+
19
+ # --- restJson1 ser/de ---
20
+ def serialize_json(value: InvalidParameterValueException_) -> dict:
21
+ out: dict = {}
22
+ if "type" in value:
23
+ out["Type"] = value["type"]
24
+ if "message" in value:
25
+ out["message"] = value["message"]
26
+ return out
27
+
28
+
29
+ def deserialize_json(data: dict) -> InvalidParameterValueException_:
30
+ out: InvalidParameterValueException_ = {} # type: ignore[typeddict-item]
31
+ if data.get("Type") is not None:
32
+ out["type"] = data["Type"]
33
+ if data.get("message") is not None:
34
+ out["message"] = data["message"]
35
+ return out
36
+
37
+
38
+ class InvalidParameterValueException(ServiceError):
39
+ """Modeled error for Smithy shape ``com.amazonaws.lambdacore#InvalidParameterValueException``."""
40
+
41
+ code: str | None = "InvalidParameterValueException"
42
+
43
+ def __init__(
44
+ self, data: InvalidParameterValueException_, message: str | None = None
45
+ ):
46
+ super().__init__(
47
+ "client",
48
+ is_throttling_error=False,
49
+ is_retryable=False,
50
+ code="InvalidParameterValueException",
51
+ message=message,
52
+ )
53
+ self.data = data
54
+
55
+ @classmethod
56
+ def from_json(
57
+ cls, data: dict, message: str | None = None
58
+ ) -> "InvalidParameterValueException":
59
+ return cls(deserialize_json(data), message)