capo-lambda-microvms 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 (180) hide show
  1. capo_lambda_microvms/__init__.py +73 -0
  2. capo_lambda_microvms/_async.py +25 -0
  3. capo_lambda_microvms/_auth/_identity.py +16 -0
  4. capo_lambda_microvms/_auth/_providers.py +886 -0
  5. capo_lambda_microvms/_auth/_signers.py +125 -0
  6. capo_lambda_microvms/_auth/_sigv4.py +579 -0
  7. capo_lambda_microvms/_auth/_zapros_handler.py +80 -0
  8. capo_lambda_microvms/_body.py +221 -0
  9. capo_lambda_microvms/_iter.py +113 -0
  10. capo_lambda_microvms/_operations/lambda_microvms/create_microvm_auth_token.py +181 -0
  11. capo_lambda_microvms/_operations/lambda_microvms/create_microvm_image.py +190 -0
  12. capo_lambda_microvms/_operations/lambda_microvms/create_microvm_shell_auth_token.py +181 -0
  13. capo_lambda_microvms/_operations/lambda_microvms/delete_microvm_image.py +170 -0
  14. capo_lambda_microvms/_operations/lambda_microvms/delete_microvm_image_version.py +174 -0
  15. capo_lambda_microvms/_operations/lambda_microvms/get_microvm.py +171 -0
  16. capo_lambda_microvms/_operations/lambda_microvms/get_microvm_image.py +170 -0
  17. capo_lambda_microvms/_operations/lambda_microvms/get_microvm_image_build.py +177 -0
  18. capo_lambda_microvms/_operations/lambda_microvms/get_microvm_image_version.py +179 -0
  19. capo_lambda_microvms/_operations/lambda_microvms/list_managed_microvm_image_versions.py +172 -0
  20. capo_lambda_microvms/_operations/lambda_microvms/list_managed_microvm_images.py +162 -0
  21. capo_lambda_microvms/_operations/lambda_microvms/list_microvm_image_builds.py +196 -0
  22. capo_lambda_microvms/_operations/lambda_microvms/list_microvm_image_versions.py +172 -0
  23. capo_lambda_microvms/_operations/lambda_microvms/list_microvm_images.py +164 -0
  24. capo_lambda_microvms/_operations/lambda_microvms/list_microvms.py +175 -0
  25. capo_lambda_microvms/_operations/lambda_microvms/list_tags.py +182 -0
  26. capo_lambda_microvms/_operations/lambda_microvms/resume_microvm.py +167 -0
  27. capo_lambda_microvms/_operations/lambda_microvms/run_microvm.py +187 -0
  28. capo_lambda_microvms/_operations/lambda_microvms/suspend_microvm.py +167 -0
  29. capo_lambda_microvms/_operations/lambda_microvms/tag_resource.py +164 -0
  30. capo_lambda_microvms/_operations/lambda_microvms/terminate_microvm.py +167 -0
  31. capo_lambda_microvms/_operations/lambda_microvms/untag_resource.py +162 -0
  32. capo_lambda_microvms/_operations/lambda_microvms/update_microvm_image.py +191 -0
  33. capo_lambda_microvms/_operations/lambda_microvms/update_microvm_image_version.py +190 -0
  34. capo_lambda_microvms/_pagination.py +21 -0
  35. capo_lambda_microvms/_protocol/__init__.py +1 -0
  36. capo_lambda_microvms/_protocol/errors.py +93 -0
  37. capo_lambda_microvms/_protocol/eventstream.py +240 -0
  38. capo_lambda_microvms/_protocol/serialize.py +47 -0
  39. capo_lambda_microvms/_protocol/xml.py +33 -0
  40. capo_lambda_microvms/_resources/lambda_microvms/microvm.py +983 -0
  41. capo_lambda_microvms/_resources/lambda_microvms/microvm_image.py +1394 -0
  42. capo_lambda_microvms/_rule_engine/__init__.py +0 -0
  43. capo_lambda_microvms/_rule_engine/_aws_partition.py +160 -0
  44. capo_lambda_microvms/_rule_engine/_endpoint_rule_set.py +135 -0
  45. capo_lambda_microvms/_rule_engine/_endpoint_runtime.py +389 -0
  46. capo_lambda_microvms/_services/_aws_config.py +160 -0
  47. capo_lambda_microvms/_services/_pipeline.py +247 -0
  48. capo_lambda_microvms/_services/async_lambda_microvms.py +1822 -0
  49. capo_lambda_microvms/_services/lambda_microvms.py +1798 -0
  50. capo_lambda_microvms/errors/__init__.py +49 -0
  51. capo_lambda_microvms/errors/_base.py +94 -0
  52. capo_lambda_microvms/errors/access_denied_exception.py +46 -0
  53. capo_lambda_microvms/errors/conflict_exception.py +56 -0
  54. capo_lambda_microvms/errors/insufficient_capacity_exception.py +49 -0
  55. capo_lambda_microvms/errors/internal_server_exception.py +48 -0
  56. capo_lambda_microvms/errors/invalid_parameter_value_exception.py +54 -0
  57. capo_lambda_microvms/errors/resource_conflict_exception.py +52 -0
  58. capo_lambda_microvms/errors/resource_not_found_exception.py +59 -0
  59. capo_lambda_microvms/errors/service_exception.py +50 -0
  60. capo_lambda_microvms/errors/service_quota_exceeded_exception.py +72 -0
  61. capo_lambda_microvms/errors/throttling_exception.py +58 -0
  62. capo_lambda_microvms/errors/too_many_requests_exception.py +52 -0
  63. capo_lambda_microvms/errors/validation_exception.py +44 -0
  64. capo_lambda_microvms/py.typed +0 -0
  65. capo_lambda_microvms/types/_prelude/blob.py +12 -0
  66. capo_lambda_microvms/types/_prelude/timestamp.py +17 -0
  67. capo_lambda_microvms/types/architecture.py +14 -0
  68. capo_lambda_microvms/types/auth_token_key.py +5 -0
  69. capo_lambda_microvms/types/auth_token_value.py +5 -0
  70. capo_lambda_microvms/types/build_state.py +19 -0
  71. capo_lambda_microvms/types/capability.py +15 -0
  72. capo_lambda_microvms/types/capability_list.py +29 -0
  73. capo_lambda_microvms/types/chipset.py +14 -0
  74. capo_lambda_microvms/types/cloud_watch_logging.py +34 -0
  75. capo_lambda_microvms/types/code_artifact.py +32 -0
  76. capo_lambda_microvms/types/cpu_configuration.py +39 -0
  77. capo_lambda_microvms/types/cpu_configuration_list.py +31 -0
  78. capo_lambda_microvms/types/create_microvm_auth_token_request.py +62 -0
  79. capo_lambda_microvms/types/create_microvm_auth_token_response.py +39 -0
  80. capo_lambda_microvms/types/create_microvm_image_request.py +219 -0
  81. capo_lambda_microvms/types/create_microvm_image_response.py +294 -0
  82. capo_lambda_microvms/types/create_microvm_shell_auth_token_request.py +38 -0
  83. capo_lambda_microvms/types/create_microvm_shell_auth_token_response.py +41 -0
  84. capo_lambda_microvms/types/delete_microvm_image_input.py +26 -0
  85. capo_lambda_microvms/types/delete_microvm_image_output.py +49 -0
  86. capo_lambda_microvms/types/delete_microvm_image_version_input.py +29 -0
  87. capo_lambda_microvms/types/delete_microvm_image_version_output.py +65 -0
  88. capo_lambda_microvms/types/environment_variable_key.py +5 -0
  89. capo_lambda_microvms/types/environment_variable_map.py +29 -0
  90. capo_lambda_microvms/types/environment_variable_value.py +5 -0
  91. capo_lambda_microvms/types/get_microvm_image_build_input.py +31 -0
  92. capo_lambda_microvms/types/get_microvm_image_build_output.py +144 -0
  93. capo_lambda_microvms/types/get_microvm_image_input.py +26 -0
  94. capo_lambda_microvms/types/get_microvm_image_output.py +117 -0
  95. capo_lambda_microvms/types/get_microvm_image_version_input.py +29 -0
  96. capo_lambda_microvms/types/get_microvm_image_version_output.py +308 -0
  97. capo_lambda_microvms/types/get_microvm_request.py +26 -0
  98. capo_lambda_microvms/types/get_microvm_response.py +188 -0
  99. capo_lambda_microvms/types/hook_state.py +18 -0
  100. capo_lambda_microvms/types/hooks.py +65 -0
  101. capo_lambda_microvms/types/idle_policy.py +40 -0
  102. capo_lambda_microvms/types/image_name.py +6 -0
  103. capo_lambda_microvms/types/list_managed_microvm_image_versions_input.py +31 -0
  104. capo_lambda_microvms/types/list_managed_microvm_image_versions_output.py +52 -0
  105. capo_lambda_microvms/types/list_managed_microvm_images_input.py +26 -0
  106. capo_lambda_microvms/types/list_managed_microvm_images_output.py +50 -0
  107. capo_lambda_microvms/types/list_microvm_image_builds_input.py +44 -0
  108. capo_lambda_microvms/types/list_microvm_image_builds_output.py +50 -0
  109. capo_lambda_microvms/types/list_microvm_image_versions_input.py +31 -0
  110. capo_lambda_microvms/types/list_microvm_image_versions_output.py +50 -0
  111. capo_lambda_microvms/types/list_microvm_images_request.py +31 -0
  112. capo_lambda_microvms/types/list_microvm_images_response.py +48 -0
  113. capo_lambda_microvms/types/list_microvms_request.py +33 -0
  114. capo_lambda_microvms/types/list_microvms_response.py +46 -0
  115. capo_lambda_microvms/types/list_of_port_specification.py +31 -0
  116. capo_lambda_microvms/types/list_tags_request.py +24 -0
  117. capo_lambda_microvms/types/list_tags_response.py +32 -0
  118. capo_lambda_microvms/types/logging.py +65 -0
  119. capo_lambda_microvms/types/logging_disabled.py +18 -0
  120. capo_lambda_microvms/types/managed_microvm_image_summary.py +66 -0
  121. capo_lambda_microvms/types/managed_microvm_image_summary_list.py +39 -0
  122. capo_lambda_microvms/types/managed_microvm_image_version.py +94 -0
  123. capo_lambda_microvms/types/managed_microvm_image_version_list.py +39 -0
  124. capo_lambda_microvms/types/managed_microvm_image_version_status.py +18 -0
  125. capo_lambda_microvms/types/microvm_hooks.py +108 -0
  126. capo_lambda_microvms/types/microvm_identifier.py +6 -0
  127. capo_lambda_microvms/types/microvm_image_arn.py +6 -0
  128. capo_lambda_microvms/types/microvm_image_build_summaries.py +37 -0
  129. capo_lambda_microvms/types/microvm_image_build_summary.py +125 -0
  130. capo_lambda_microvms/types/microvm_image_hooks.py +66 -0
  131. capo_lambda_microvms/types/microvm_image_identifier.py +6 -0
  132. capo_lambda_microvms/types/microvm_image_state.py +24 -0
  133. capo_lambda_microvms/types/microvm_image_summaries.py +35 -0
  134. capo_lambda_microvms/types/microvm_image_summary.py +90 -0
  135. capo_lambda_microvms/types/microvm_image_version_state.py +22 -0
  136. capo_lambda_microvms/types/microvm_image_version_status.py +17 -0
  137. capo_lambda_microvms/types/microvm_image_version_summary.py +300 -0
  138. capo_lambda_microvms/types/microvm_image_version_summary_list.py +39 -0
  139. capo_lambda_microvms/types/microvm_item.py +82 -0
  140. capo_lambda_microvms/types/microvm_item_list.py +29 -0
  141. capo_lambda_microvms/types/microvm_state.py +22 -0
  142. capo_lambda_microvms/types/network_connector.py +5 -0
  143. capo_lambda_microvms/types/network_connector_list.py +19 -0
  144. capo_lambda_microvms/types/non_blank_string.py +6 -0
  145. capo_lambda_microvms/types/port_number.py +6 -0
  146. capo_lambda_microvms/types/port_range.py +38 -0
  147. capo_lambda_microvms/types/port_specification.py +63 -0
  148. capo_lambda_microvms/types/positive_integer.py +5 -0
  149. capo_lambda_microvms/types/resources.py +26 -0
  150. capo_lambda_microvms/types/resources_list.py +29 -0
  151. capo_lambda_microvms/types/resume_microvm_request.py +26 -0
  152. capo_lambda_microvms/types/resume_microvm_response.py +18 -0
  153. capo_lambda_microvms/types/role_arn.py +6 -0
  154. capo_lambda_microvms/types/run_hook_payload.py +5 -0
  155. capo_lambda_microvms/types/run_microvm_request.py +139 -0
  156. capo_lambda_microvms/types/run_microvm_response.py +188 -0
  157. capo_lambda_microvms/types/snapshot_build.py +35 -0
  158. capo_lambda_microvms/types/string.py +5 -0
  159. capo_lambda_microvms/types/suspend_microvm_request.py +26 -0
  160. capo_lambda_microvms/types/suspend_microvm_response.py +18 -0
  161. capo_lambda_microvms/types/tag_key.py +5 -0
  162. capo_lambda_microvms/types/tag_key_list.py +17 -0
  163. capo_lambda_microvms/types/tag_resource_request.py +38 -0
  164. capo_lambda_microvms/types/tag_value.py +5 -0
  165. capo_lambda_microvms/types/taggable_resource.py +6 -0
  166. capo_lambda_microvms/types/tags.py +29 -0
  167. capo_lambda_microvms/types/terminate_microvm_request.py +26 -0
  168. capo_lambda_microvms/types/terminate_microvm_response.py +18 -0
  169. capo_lambda_microvms/types/token_parts.py +29 -0
  170. capo_lambda_microvms/types/untag_resource_request.py +27 -0
  171. capo_lambda_microvms/types/update_microvm_image_request.py +205 -0
  172. capo_lambda_microvms/types/update_microvm_image_response.py +284 -0
  173. capo_lambda_microvms/types/update_microvm_image_version_request.py +51 -0
  174. capo_lambda_microvms/types/update_microvm_image_version_response.py +312 -0
  175. capo_lambda_microvms/types/version.py +5 -0
  176. capo_lambda_microvms-0.1.0.dist-info/METADATA +103 -0
  177. capo_lambda_microvms-0.1.0.dist-info/RECORD +180 -0
  178. capo_lambda_microvms-0.1.0.dist-info/WHEEL +5 -0
  179. capo_lambda_microvms-0.1.0.dist-info/licenses/LICENSE +21 -0
  180. capo_lambda_microvms-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,983 @@
1
+ from __future__ import annotations
2
+
3
+ import uuid
4
+ from typing import TYPE_CHECKING, Optional
5
+
6
+ import capo_lambda_microvms._auth._signers
7
+ import capo_lambda_microvms._auth._sigv4
8
+ from capo_lambda_microvms._services._pipeline import (
9
+ AsyncOperationRequest,
10
+ AsyncOperationResponse,
11
+ OperationRequest,
12
+ OperationResponse,
13
+ aexecute_pipeline,
14
+ execute_pipeline,
15
+ )
16
+
17
+ if TYPE_CHECKING:
18
+ import capo_lambda_microvms.types.create_microvm_auth_token_request
19
+ import capo_lambda_microvms.types.create_microvm_auth_token_response
20
+ import capo_lambda_microvms.types.create_microvm_shell_auth_token_request
21
+ import capo_lambda_microvms.types.create_microvm_shell_auth_token_response
22
+ import capo_lambda_microvms.types.get_microvm_request
23
+ import capo_lambda_microvms.types.get_microvm_response
24
+ import capo_lambda_microvms.types.idle_policy
25
+ import capo_lambda_microvms.types.list_microvms_request
26
+ import capo_lambda_microvms.types.list_microvms_response
27
+ import capo_lambda_microvms.types.list_of_port_specification
28
+ import capo_lambda_microvms.types.logging
29
+ import capo_lambda_microvms.types.microvm_identifier
30
+ import capo_lambda_microvms.types.microvm_image_identifier
31
+ import capo_lambda_microvms.types.microvm_item
32
+ import capo_lambda_microvms.types.network_connector_list
33
+ import capo_lambda_microvms.types.positive_integer
34
+ import capo_lambda_microvms.types.resume_microvm_request
35
+ import capo_lambda_microvms.types.resume_microvm_response
36
+ import capo_lambda_microvms.types.role_arn
37
+ import capo_lambda_microvms.types.run_hook_payload
38
+ import capo_lambda_microvms.types.run_microvm_request
39
+ import capo_lambda_microvms.types.run_microvm_response
40
+ import capo_lambda_microvms.types.string
41
+ import capo_lambda_microvms.types.suspend_microvm_request
42
+ import capo_lambda_microvms.types.suspend_microvm_response
43
+ import capo_lambda_microvms.types.terminate_microvm_request
44
+ import capo_lambda_microvms.types.terminate_microvm_response
45
+ import capo_lambda_microvms.types.version
46
+ from capo_lambda_microvms._services.async_lambda_microvms import (
47
+ AsyncLambdaMicrovmsClient,
48
+ AsyncLambdaMicrovmsClientConfig,
49
+ )
50
+ from capo_lambda_microvms._services.lambda_microvms import (
51
+ LambdaMicrovmsClient,
52
+ LambdaMicrovmsClientConfig,
53
+ )
54
+
55
+
56
+ class Microvm:
57
+ def __init__(self, service: LambdaMicrovmsClient) -> None:
58
+ self._service = service
59
+
60
+ def create(
61
+ self,
62
+ image_identifier: "capo_lambda_microvms.types.microvm_image_identifier.MicrovmImageIdentifier",
63
+ *,
64
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
65
+ ingress_network_connectors: Optional[
66
+ "capo_lambda_microvms.types.network_connector_list.NetworkConnectorList"
67
+ ] = None,
68
+ egress_network_connectors: Optional[
69
+ "capo_lambda_microvms.types.network_connector_list.NetworkConnectorList"
70
+ ] = None,
71
+ image_version: Optional["capo_lambda_microvms.types.version.Version"] = None,
72
+ execution_role_arn: Optional[
73
+ "capo_lambda_microvms.types.role_arn.RoleArn"
74
+ ] = None,
75
+ idle_policy: Optional[
76
+ "capo_lambda_microvms.types.idle_policy.IdlePolicy"
77
+ ] = None,
78
+ logging: Optional["capo_lambda_microvms.types.logging.Logging"] = None,
79
+ run_hook_payload: Optional[
80
+ "capo_lambda_microvms.types.run_hook_payload.RunHookPayload"
81
+ ] = None,
82
+ maximum_duration_in_seconds: Optional[int] = None,
83
+ client_token: Optional[str] = None,
84
+ ) -> "capo_lambda_microvms.types.run_microvm_response.RunMicrovmResponse":
85
+ r"""<p>Runs a new MicroVM from the specified image. The MicroVM starts in PENDING state and transitions to RUNNING once provisioning completes. To connect, generate an authentication token using CreateMicrovmAuthToken.</p>
86
+
87
+ Args:
88
+ ingress_network_connectors: <p>The list of ingress network connectors to configure for the MicroVM.</p>
89
+ egress_network_connectors: <p>The list of egress network connectors to configure for the MicroVM.</p>
90
+ image_identifier: <p>The identifier (ARN or ID) of the MicroVM image to run.</p>
91
+ image_version: <p>The version of the MicroVM image to run.</p>
92
+ execution_role_arn: <p>The ARN of the IAM role to be assumed by the MicroVM during execution.</p>
93
+ idle_policy: <p>Configuration to control auto-suspend and auto-resume behavior.</p>
94
+ logging: <p>The logging configuration for this MicroVM instance. Specify {\"cloudWatch\": {\"logGroup\": \"...\"}} to stream application logs to a custom CloudWatch log group, or {\"disabled\": {}} to turn off logging.</p>
95
+ run_hook_payload: <p>Per-MicroVM initialization data delivered as the request body of the /run lifecycle hook. Use to pass tenant-specific configuration such as session IDs or secret references. Maximum: 16,384 bytes.</p>
96
+ maximum_duration_in_seconds: <p>The maximum duration in seconds that the MicroVM can exist before being terminated by the platform. Valid range: 1–28,800 (8 hours).</p>
97
+ client_token: <p>A unique, case-sensitive identifier you provide to ensure the idempotency of the request.</p>
98
+
99
+ Raises:
100
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
101
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
102
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
103
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
104
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
105
+ capo_lambda_microvms.errors.insufficient_capacity_exception.InsufficientCapacityException: <p>There is insufficient capacity to fulfill the request. Retry the request later.</p>
106
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
107
+ capo_lambda_microvms.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded a service quota for Lambda MicroVMs.</p>
108
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
109
+ """
110
+
111
+ def _handler(
112
+ req: "OperationRequest[capo_lambda_microvms.types.run_microvm_request.RunMicrovmRequest]",
113
+ ) -> OperationResponse[
114
+ "capo_lambda_microvms.types.run_microvm_response.RunMicrovmResponse"
115
+ ]:
116
+ import capo_lambda_microvms._operations.lambda_microvms.run_microvm
117
+
118
+ output, http_response = (
119
+ capo_lambda_microvms._operations.lambda_microvms.run_microvm.run_microvm(
120
+ req.options, req.input
121
+ )
122
+ )
123
+ return OperationResponse(output=output, response=http_response)
124
+
125
+ interceptors_, options_ = self._service.operation_options(config_overrides)
126
+ input_: capo_lambda_microvms.types.run_microvm_request.RunMicrovmRequest = {
127
+ "image_identifier": image_identifier
128
+ }
129
+ if ingress_network_connectors is not None:
130
+ input_["ingress_network_connectors"] = ingress_network_connectors
131
+ if egress_network_connectors is not None:
132
+ input_["egress_network_connectors"] = egress_network_connectors
133
+ if image_version is not None:
134
+ input_["image_version"] = image_version
135
+ if execution_role_arn is not None:
136
+ input_["execution_role_arn"] = execution_role_arn
137
+ if idle_policy is not None:
138
+ input_["idle_policy"] = idle_policy
139
+ if logging is not None:
140
+ input_["logging"] = logging
141
+ if run_hook_payload is not None:
142
+ input_["run_hook_payload"] = run_hook_payload
143
+ if maximum_duration_in_seconds is not None:
144
+ input_["maximum_duration_in_seconds"] = maximum_duration_in_seconds
145
+ if client_token is None:
146
+ client_token = str(uuid.uuid4())
147
+ input_["client_token"] = client_token
148
+
149
+ response = execute_pipeline(
150
+ OperationRequest(input=input_, options=options_),
151
+ handler=_handler,
152
+ interceptors=list(interceptors_),
153
+ )
154
+ response.response.close()
155
+ return response.output
156
+
157
+ def read(
158
+ self,
159
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
160
+ *,
161
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
162
+ ) -> "capo_lambda_microvms.types.get_microvm_response.GetMicrovmResponse":
163
+ """<p>Retrieves the details of a specific MicroVM, including its state, endpoint, image information, and configuration. The state field is eventually consistent — determine readiness by connecting to the endpoint.</p>
164
+
165
+ Args:
166
+ microvm_identifier: <p>The ID of the MicroVM to retrieve.</p>
167
+
168
+ Raises:
169
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
170
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
171
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
172
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
173
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
174
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
175
+ """
176
+
177
+ def _handler(
178
+ req: "OperationRequest[capo_lambda_microvms.types.get_microvm_request.GetMicrovmRequest]",
179
+ ) -> OperationResponse[
180
+ "capo_lambda_microvms.types.get_microvm_response.GetMicrovmResponse"
181
+ ]:
182
+ import capo_lambda_microvms._operations.lambda_microvms.get_microvm
183
+
184
+ output, http_response = (
185
+ capo_lambda_microvms._operations.lambda_microvms.get_microvm.get_microvm(
186
+ req.options, req.input
187
+ )
188
+ )
189
+ return OperationResponse(output=output, response=http_response)
190
+
191
+ interceptors_, options_ = self._service.operation_options(config_overrides)
192
+ input_: capo_lambda_microvms.types.get_microvm_request.GetMicrovmRequest = {
193
+ "microvm_identifier": microvm_identifier
194
+ }
195
+
196
+ response = execute_pipeline(
197
+ OperationRequest(input=input_, options=options_),
198
+ handler=_handler,
199
+ interceptors=list(interceptors_),
200
+ )
201
+ response.response.close()
202
+ return response.output
203
+
204
+ def delete(
205
+ self,
206
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
207
+ *,
208
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
209
+ ) -> (
210
+ "capo_lambda_microvms.types.terminate_microvm_response.TerminateMicrovmResponse"
211
+ ):
212
+ """<p>Terminates a MicroVM. This operation is idempotent; terminating a MicroVM that has already been terminated succeeds without error.</p>
213
+
214
+ Args:
215
+ microvm_identifier: <p>The ID of the MicroVM to terminate.</p>
216
+
217
+ Raises:
218
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
219
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
220
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
221
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
222
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
223
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
224
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
225
+ """
226
+
227
+ def _handler(
228
+ req: "OperationRequest[capo_lambda_microvms.types.terminate_microvm_request.TerminateMicrovmRequest]",
229
+ ) -> OperationResponse[
230
+ "capo_lambda_microvms.types.terminate_microvm_response.TerminateMicrovmResponse"
231
+ ]:
232
+ import capo_lambda_microvms._operations.lambda_microvms.terminate_microvm
233
+
234
+ output, http_response = (
235
+ capo_lambda_microvms._operations.lambda_microvms.terminate_microvm.terminate_microvm(
236
+ req.options, req.input
237
+ )
238
+ )
239
+ return OperationResponse(output=output, response=http_response)
240
+
241
+ interceptors_, options_ = self._service.operation_options(config_overrides)
242
+ input_: capo_lambda_microvms.types.terminate_microvm_request.TerminateMicrovmRequest = {
243
+ "microvm_identifier": microvm_identifier
244
+ }
245
+
246
+ response = execute_pipeline(
247
+ OperationRequest(input=input_, options=options_),
248
+ handler=_handler,
249
+ interceptors=list(interceptors_),
250
+ )
251
+ response.response.close()
252
+ return response.output
253
+
254
+ def list(
255
+ self,
256
+ *,
257
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
258
+ max_results: Optional[int] = None,
259
+ next_token: Optional["capo_lambda_microvms.types.string.String"] = None,
260
+ image_identifier: Optional[
261
+ "capo_lambda_microvms.types.microvm_image_identifier.MicrovmImageIdentifier"
262
+ ] = None,
263
+ image_version: Optional[str] = None,
264
+ ) -> "capo_lambda_microvms.types.list_microvms_response.ListMicrovmsResponse":
265
+ """<p>Lists MicroVMs in the account with optional filtering by image and version. We recommend using pagination to ensure that the operation returns quickly and successfully.</p>
266
+
267
+ Args:
268
+ max_results: <p>The maximum number of results to return in a single call.</p>
269
+ next_token: <p>The pagination token from a previous call. Use this token to retrieve the next page of results.</p>
270
+ image_identifier: <p>Optional filter to list only MicroVMs running the specified image.</p>
271
+ image_version: <p>Optional filter to list only MicroVMs running the specified image version.</p>
272
+
273
+ Raises:
274
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
275
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
276
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
277
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
278
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
279
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
280
+ """
281
+
282
+ def _handler(
283
+ req: "OperationRequest[capo_lambda_microvms.types.list_microvms_request.ListMicrovmsRequest]",
284
+ ) -> OperationResponse[
285
+ "capo_lambda_microvms.types.list_microvms_response.ListMicrovmsResponse"
286
+ ]:
287
+ import capo_lambda_microvms._operations.lambda_microvms.list_microvms
288
+
289
+ output, http_response = (
290
+ capo_lambda_microvms._operations.lambda_microvms.list_microvms.list_microvms(
291
+ req.options, req.input
292
+ )
293
+ )
294
+ return OperationResponse(output=output, response=http_response)
295
+
296
+ interceptors_, options_ = self._service.operation_options(config_overrides)
297
+ input_: capo_lambda_microvms.types.list_microvms_request.ListMicrovmsRequest = {}
298
+ if max_results is not None:
299
+ input_["max_results"] = max_results
300
+ if next_token is not None:
301
+ input_["next_token"] = next_token
302
+ if image_identifier is not None:
303
+ input_["image_identifier"] = image_identifier
304
+ if image_version is not None:
305
+ input_["image_version"] = image_version
306
+
307
+ response = execute_pipeline(
308
+ OperationRequest(input=input_, options=options_),
309
+ handler=_handler,
310
+ interceptors=list(interceptors_),
311
+ )
312
+ response.response.close()
313
+ return response.output
314
+
315
+ def create_microvm_auth_token(
316
+ self,
317
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
318
+ expiration_in_minutes: "capo_lambda_microvms.types.positive_integer.PositiveInteger",
319
+ allowed_ports: "capo_lambda_microvms.types.list_of_port_specification.ListOfPortSpecification",
320
+ *,
321
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
322
+ ) -> "capo_lambda_microvms.types.create_microvm_auth_token_response.CreateMicrovmAuthTokenResponse":
323
+ """<p>Creates an authentication token for accessing a running MicroVM. The token grants access to the specified ports on the MicroVM endpoint.</p>
324
+
325
+ Args:
326
+ microvm_identifier: <p>The ID of the MicroVM to create an authentication token for.</p>
327
+ expiration_in_minutes: <p>The duration in minutes before the authentication token expires. Maximum: 60 minutes.</p>
328
+ allowed_ports: <p>The list of port specifications that the authentication token grants access to on the MicroVM.</p>
329
+
330
+ Raises:
331
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
332
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
333
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
334
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
335
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
336
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
337
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
338
+ """
339
+
340
+ def _handler(
341
+ req: "OperationRequest[capo_lambda_microvms.types.create_microvm_auth_token_request.CreateMicrovmAuthTokenRequest]",
342
+ ) -> OperationResponse[
343
+ "capo_lambda_microvms.types.create_microvm_auth_token_response.CreateMicrovmAuthTokenResponse"
344
+ ]:
345
+ import capo_lambda_microvms._operations.lambda_microvms.create_microvm_auth_token
346
+
347
+ output, http_response = (
348
+ capo_lambda_microvms._operations.lambda_microvms.create_microvm_auth_token.create_microvm_auth_token(
349
+ req.options, req.input
350
+ )
351
+ )
352
+ return OperationResponse(output=output, response=http_response)
353
+
354
+ interceptors_, options_ = self._service.operation_options(config_overrides)
355
+ input_: capo_lambda_microvms.types.create_microvm_auth_token_request.CreateMicrovmAuthTokenRequest = {
356
+ "microvm_identifier": microvm_identifier,
357
+ "expiration_in_minutes": expiration_in_minutes,
358
+ "allowed_ports": allowed_ports,
359
+ }
360
+
361
+ response = execute_pipeline(
362
+ OperationRequest(input=input_, options=options_),
363
+ handler=_handler,
364
+ interceptors=list(interceptors_),
365
+ )
366
+ response.response.close()
367
+ return response.output
368
+
369
+ def create_microvm_shell_auth_token(
370
+ self,
371
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
372
+ expiration_in_minutes: "capo_lambda_microvms.types.positive_integer.PositiveInteger",
373
+ *,
374
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
375
+ ) -> "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse":
376
+ """<p>Creates a shell authentication token for interactive shell access to a running MicroVM. The MicroVM must have been run with the SHELL_INGRESS network connector attached.</p>
377
+
378
+ Args:
379
+ microvm_identifier: <p>The ID of the MicroVM to create a shell authentication token for.</p>
380
+ expiration_in_minutes: <p>The duration in minutes before the shell authentication token expires.</p>
381
+
382
+ Raises:
383
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
384
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
385
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
386
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
387
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
388
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
389
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
390
+ """
391
+
392
+ def _handler(
393
+ req: "OperationRequest[capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest]",
394
+ ) -> OperationResponse[
395
+ "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse"
396
+ ]:
397
+ import capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token
398
+
399
+ output, http_response = (
400
+ capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token.create_microvm_shell_auth_token(
401
+ req.options, req.input
402
+ )
403
+ )
404
+ return OperationResponse(output=output, response=http_response)
405
+
406
+ interceptors_, options_ = self._service.operation_options(config_overrides)
407
+ input_: capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest = {
408
+ "microvm_identifier": microvm_identifier,
409
+ "expiration_in_minutes": expiration_in_minutes,
410
+ }
411
+
412
+ response = execute_pipeline(
413
+ OperationRequest(input=input_, options=options_),
414
+ handler=_handler,
415
+ interceptors=list(interceptors_),
416
+ )
417
+ response.response.close()
418
+ return response.output
419
+
420
+ def resume_microvm(
421
+ self,
422
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
423
+ *,
424
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
425
+ ) -> "capo_lambda_microvms.types.resume_microvm_response.ResumeMicrovmResponse":
426
+ """<p>Resumes a suspended MicroVM, restoring it to RUNNING state with all state intact. The MicroVM must be in SUSPENDED state.</p>
427
+
428
+ Args:
429
+ microvm_identifier: <p>The ID of the MicroVM to resume.</p>
430
+
431
+ Raises:
432
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
433
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
434
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
435
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
436
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
437
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
438
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
439
+ """
440
+
441
+ def _handler(
442
+ req: "OperationRequest[capo_lambda_microvms.types.resume_microvm_request.ResumeMicrovmRequest]",
443
+ ) -> OperationResponse[
444
+ "capo_lambda_microvms.types.resume_microvm_response.ResumeMicrovmResponse"
445
+ ]:
446
+ import capo_lambda_microvms._operations.lambda_microvms.resume_microvm
447
+
448
+ output, http_response = (
449
+ capo_lambda_microvms._operations.lambda_microvms.resume_microvm.resume_microvm(
450
+ req.options, req.input
451
+ )
452
+ )
453
+ return OperationResponse(output=output, response=http_response)
454
+
455
+ interceptors_, options_ = self._service.operation_options(config_overrides)
456
+ input_: capo_lambda_microvms.types.resume_microvm_request.ResumeMicrovmRequest = {
457
+ "microvm_identifier": microvm_identifier
458
+ }
459
+
460
+ response = execute_pipeline(
461
+ OperationRequest(input=input_, options=options_),
462
+ handler=_handler,
463
+ interceptors=list(interceptors_),
464
+ )
465
+ response.response.close()
466
+ return response.output
467
+
468
+ def suspend_microvm(
469
+ self,
470
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
471
+ *,
472
+ config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
473
+ ) -> "capo_lambda_microvms.types.suspend_microvm_response.SuspendMicrovmResponse":
474
+ """<p>Suspends a running MicroVM, preserving its full memory and disk state. The MicroVM transitions through SUSPENDING to SUSPENDED. To restore, call ResumeMicrovm or send traffic to the endpoint if autoResumeEnabled is true.</p>
475
+
476
+ Args:
477
+ microvm_identifier: <p>The ID of the MicroVM to suspend.</p>
478
+
479
+ Raises:
480
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
481
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
482
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
483
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
484
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
485
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
486
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
487
+ """
488
+
489
+ def _handler(
490
+ req: "OperationRequest[capo_lambda_microvms.types.suspend_microvm_request.SuspendMicrovmRequest]",
491
+ ) -> OperationResponse[
492
+ "capo_lambda_microvms.types.suspend_microvm_response.SuspendMicrovmResponse"
493
+ ]:
494
+ import capo_lambda_microvms._operations.lambda_microvms.suspend_microvm
495
+
496
+ output, http_response = (
497
+ capo_lambda_microvms._operations.lambda_microvms.suspend_microvm.suspend_microvm(
498
+ req.options, req.input
499
+ )
500
+ )
501
+ return OperationResponse(output=output, response=http_response)
502
+
503
+ interceptors_, options_ = self._service.operation_options(config_overrides)
504
+ input_: capo_lambda_microvms.types.suspend_microvm_request.SuspendMicrovmRequest = {
505
+ "microvm_identifier": microvm_identifier
506
+ }
507
+
508
+ response = execute_pipeline(
509
+ OperationRequest(input=input_, options=options_),
510
+ handler=_handler,
511
+ interceptors=list(interceptors_),
512
+ )
513
+ response.response.close()
514
+ return response.output
515
+
516
+
517
+ class AsyncMicrovm:
518
+ def __init__(self, service: AsyncLambdaMicrovmsClient) -> None:
519
+ self._service = service
520
+
521
+ async def create(
522
+ self,
523
+ image_identifier: "capo_lambda_microvms.types.microvm_image_identifier.MicrovmImageIdentifier",
524
+ *,
525
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
526
+ ingress_network_connectors: Optional[
527
+ "capo_lambda_microvms.types.network_connector_list.NetworkConnectorList"
528
+ ] = None,
529
+ egress_network_connectors: Optional[
530
+ "capo_lambda_microvms.types.network_connector_list.NetworkConnectorList"
531
+ ] = None,
532
+ image_version: Optional["capo_lambda_microvms.types.version.Version"] = None,
533
+ execution_role_arn: Optional[
534
+ "capo_lambda_microvms.types.role_arn.RoleArn"
535
+ ] = None,
536
+ idle_policy: Optional[
537
+ "capo_lambda_microvms.types.idle_policy.IdlePolicy"
538
+ ] = None,
539
+ logging: Optional["capo_lambda_microvms.types.logging.Logging"] = None,
540
+ run_hook_payload: Optional[
541
+ "capo_lambda_microvms.types.run_hook_payload.RunHookPayload"
542
+ ] = None,
543
+ maximum_duration_in_seconds: Optional[int] = None,
544
+ client_token: Optional[str] = None,
545
+ ) -> "capo_lambda_microvms.types.run_microvm_response.RunMicrovmResponse":
546
+ r"""<p>Runs a new MicroVM from the specified image. The MicroVM starts in PENDING state and transitions to RUNNING once provisioning completes. To connect, generate an authentication token using CreateMicrovmAuthToken.</p>
547
+
548
+ Args:
549
+ ingress_network_connectors: <p>The list of ingress network connectors to configure for the MicroVM.</p>
550
+ egress_network_connectors: <p>The list of egress network connectors to configure for the MicroVM.</p>
551
+ image_identifier: <p>The identifier (ARN or ID) of the MicroVM image to run.</p>
552
+ image_version: <p>The version of the MicroVM image to run.</p>
553
+ execution_role_arn: <p>The ARN of the IAM role to be assumed by the MicroVM during execution.</p>
554
+ idle_policy: <p>Configuration to control auto-suspend and auto-resume behavior.</p>
555
+ logging: <p>The logging configuration for this MicroVM instance. Specify {\"cloudWatch\": {\"logGroup\": \"...\"}} to stream application logs to a custom CloudWatch log group, or {\"disabled\": {}} to turn off logging.</p>
556
+ run_hook_payload: <p>Per-MicroVM initialization data delivered as the request body of the /run lifecycle hook. Use to pass tenant-specific configuration such as session IDs or secret references. Maximum: 16,384 bytes.</p>
557
+ maximum_duration_in_seconds: <p>The maximum duration in seconds that the MicroVM can exist before being terminated by the platform. Valid range: 1–28,800 (8 hours).</p>
558
+ client_token: <p>A unique, case-sensitive identifier you provide to ensure the idempotency of the request.</p>
559
+
560
+ Raises:
561
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
562
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
563
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
564
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
565
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
566
+ capo_lambda_microvms.errors.insufficient_capacity_exception.InsufficientCapacityException: <p>There is insufficient capacity to fulfill the request. Retry the request later.</p>
567
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
568
+ capo_lambda_microvms.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded a service quota for Lambda MicroVMs.</p>
569
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
570
+ """
571
+
572
+ async def _handler(
573
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.run_microvm_request.RunMicrovmRequest]",
574
+ ) -> AsyncOperationResponse[
575
+ "capo_lambda_microvms.types.run_microvm_response.RunMicrovmResponse"
576
+ ]:
577
+ import capo_lambda_microvms._operations.lambda_microvms.run_microvm
578
+
579
+ (
580
+ output,
581
+ http_response,
582
+ ) = await capo_lambda_microvms._operations.lambda_microvms.run_microvm.async_run_microvm(
583
+ req.options, req.input
584
+ )
585
+ return AsyncOperationResponse(output=output, response=http_response)
586
+
587
+ interceptors_, options_ = self._service.operation_options(config_overrides)
588
+ input_: capo_lambda_microvms.types.run_microvm_request.RunMicrovmRequest = {
589
+ "image_identifier": image_identifier
590
+ }
591
+ if ingress_network_connectors is not None:
592
+ input_["ingress_network_connectors"] = ingress_network_connectors
593
+ if egress_network_connectors is not None:
594
+ input_["egress_network_connectors"] = egress_network_connectors
595
+ if image_version is not None:
596
+ input_["image_version"] = image_version
597
+ if execution_role_arn is not None:
598
+ input_["execution_role_arn"] = execution_role_arn
599
+ if idle_policy is not None:
600
+ input_["idle_policy"] = idle_policy
601
+ if logging is not None:
602
+ input_["logging"] = logging
603
+ if run_hook_payload is not None:
604
+ input_["run_hook_payload"] = run_hook_payload
605
+ if maximum_duration_in_seconds is not None:
606
+ input_["maximum_duration_in_seconds"] = maximum_duration_in_seconds
607
+ if client_token is None:
608
+ client_token = str(uuid.uuid4())
609
+ input_["client_token"] = client_token
610
+
611
+ response = await aexecute_pipeline(
612
+ AsyncOperationRequest(input=input_, options=options_),
613
+ handler=_handler,
614
+ interceptors=list(interceptors_),
615
+ )
616
+ await response.response.aclose()
617
+ return response.output
618
+
619
+ async def read(
620
+ self,
621
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
622
+ *,
623
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
624
+ ) -> "capo_lambda_microvms.types.get_microvm_response.GetMicrovmResponse":
625
+ """<p>Retrieves the details of a specific MicroVM, including its state, endpoint, image information, and configuration. The state field is eventually consistent — determine readiness by connecting to the endpoint.</p>
626
+
627
+ Args:
628
+ microvm_identifier: <p>The ID of the MicroVM to retrieve.</p>
629
+
630
+ Raises:
631
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
632
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
633
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
634
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
635
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
636
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
637
+ """
638
+
639
+ async def _handler(
640
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.get_microvm_request.GetMicrovmRequest]",
641
+ ) -> AsyncOperationResponse[
642
+ "capo_lambda_microvms.types.get_microvm_response.GetMicrovmResponse"
643
+ ]:
644
+ import capo_lambda_microvms._operations.lambda_microvms.get_microvm
645
+
646
+ (
647
+ output,
648
+ http_response,
649
+ ) = await capo_lambda_microvms._operations.lambda_microvms.get_microvm.async_get_microvm(
650
+ req.options, req.input
651
+ )
652
+ return AsyncOperationResponse(output=output, response=http_response)
653
+
654
+ interceptors_, options_ = self._service.operation_options(config_overrides)
655
+ input_: capo_lambda_microvms.types.get_microvm_request.GetMicrovmRequest = {
656
+ "microvm_identifier": microvm_identifier
657
+ }
658
+
659
+ response = await aexecute_pipeline(
660
+ AsyncOperationRequest(input=input_, options=options_),
661
+ handler=_handler,
662
+ interceptors=list(interceptors_),
663
+ )
664
+ await response.response.aclose()
665
+ return response.output
666
+
667
+ async def delete(
668
+ self,
669
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
670
+ *,
671
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
672
+ ) -> (
673
+ "capo_lambda_microvms.types.terminate_microvm_response.TerminateMicrovmResponse"
674
+ ):
675
+ """<p>Terminates a MicroVM. This operation is idempotent; terminating a MicroVM that has already been terminated succeeds without error.</p>
676
+
677
+ Args:
678
+ microvm_identifier: <p>The ID of the MicroVM to terminate.</p>
679
+
680
+ Raises:
681
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
682
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
683
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
684
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
685
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
686
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
687
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
688
+ """
689
+
690
+ async def _handler(
691
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.terminate_microvm_request.TerminateMicrovmRequest]",
692
+ ) -> AsyncOperationResponse[
693
+ "capo_lambda_microvms.types.terminate_microvm_response.TerminateMicrovmResponse"
694
+ ]:
695
+ import capo_lambda_microvms._operations.lambda_microvms.terminate_microvm
696
+
697
+ (
698
+ output,
699
+ http_response,
700
+ ) = await capo_lambda_microvms._operations.lambda_microvms.terminate_microvm.async_terminate_microvm(
701
+ req.options, req.input
702
+ )
703
+ return AsyncOperationResponse(output=output, response=http_response)
704
+
705
+ interceptors_, options_ = self._service.operation_options(config_overrides)
706
+ input_: capo_lambda_microvms.types.terminate_microvm_request.TerminateMicrovmRequest = {
707
+ "microvm_identifier": microvm_identifier
708
+ }
709
+
710
+ response = await aexecute_pipeline(
711
+ AsyncOperationRequest(input=input_, options=options_),
712
+ handler=_handler,
713
+ interceptors=list(interceptors_),
714
+ )
715
+ await response.response.aclose()
716
+ return response.output
717
+
718
+ async def list(
719
+ self,
720
+ *,
721
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
722
+ max_results: Optional[int] = None,
723
+ next_token: Optional["capo_lambda_microvms.types.string.String"] = None,
724
+ image_identifier: Optional[
725
+ "capo_lambda_microvms.types.microvm_image_identifier.MicrovmImageIdentifier"
726
+ ] = None,
727
+ image_version: Optional[str] = None,
728
+ ) -> "capo_lambda_microvms.types.list_microvms_response.ListMicrovmsResponse":
729
+ """<p>Lists MicroVMs in the account with optional filtering by image and version. We recommend using pagination to ensure that the operation returns quickly and successfully.</p>
730
+
731
+ Args:
732
+ max_results: <p>The maximum number of results to return in a single call.</p>
733
+ next_token: <p>The pagination token from a previous call. Use this token to retrieve the next page of results.</p>
734
+ image_identifier: <p>Optional filter to list only MicroVMs running the specified image.</p>
735
+ image_version: <p>Optional filter to list only MicroVMs running the specified image version.</p>
736
+
737
+ Raises:
738
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
739
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
740
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
741
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
742
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
743
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
744
+ """
745
+
746
+ async def _handler(
747
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.list_microvms_request.ListMicrovmsRequest]",
748
+ ) -> AsyncOperationResponse[
749
+ "capo_lambda_microvms.types.list_microvms_response.ListMicrovmsResponse"
750
+ ]:
751
+ import capo_lambda_microvms._operations.lambda_microvms.list_microvms
752
+
753
+ (
754
+ output,
755
+ http_response,
756
+ ) = await capo_lambda_microvms._operations.lambda_microvms.list_microvms.async_list_microvms(
757
+ req.options, req.input
758
+ )
759
+ return AsyncOperationResponse(output=output, response=http_response)
760
+
761
+ interceptors_, options_ = self._service.operation_options(config_overrides)
762
+ input_: capo_lambda_microvms.types.list_microvms_request.ListMicrovmsRequest = {}
763
+ if max_results is not None:
764
+ input_["max_results"] = max_results
765
+ if next_token is not None:
766
+ input_["next_token"] = next_token
767
+ if image_identifier is not None:
768
+ input_["image_identifier"] = image_identifier
769
+ if image_version is not None:
770
+ input_["image_version"] = image_version
771
+
772
+ response = await aexecute_pipeline(
773
+ AsyncOperationRequest(input=input_, options=options_),
774
+ handler=_handler,
775
+ interceptors=list(interceptors_),
776
+ )
777
+ await response.response.aclose()
778
+ return response.output
779
+
780
+ async def create_microvm_auth_token(
781
+ self,
782
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
783
+ expiration_in_minutes: "capo_lambda_microvms.types.positive_integer.PositiveInteger",
784
+ allowed_ports: "capo_lambda_microvms.types.list_of_port_specification.ListOfPortSpecification",
785
+ *,
786
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
787
+ ) -> "capo_lambda_microvms.types.create_microvm_auth_token_response.CreateMicrovmAuthTokenResponse":
788
+ """<p>Creates an authentication token for accessing a running MicroVM. The token grants access to the specified ports on the MicroVM endpoint.</p>
789
+
790
+ Args:
791
+ microvm_identifier: <p>The ID of the MicroVM to create an authentication token for.</p>
792
+ expiration_in_minutes: <p>The duration in minutes before the authentication token expires. Maximum: 60 minutes.</p>
793
+ allowed_ports: <p>The list of port specifications that the authentication token grants access to on the MicroVM.</p>
794
+
795
+ Raises:
796
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
797
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
798
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
799
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
800
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
801
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
802
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
803
+ """
804
+
805
+ async def _handler(
806
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.create_microvm_auth_token_request.CreateMicrovmAuthTokenRequest]",
807
+ ) -> AsyncOperationResponse[
808
+ "capo_lambda_microvms.types.create_microvm_auth_token_response.CreateMicrovmAuthTokenResponse"
809
+ ]:
810
+ import capo_lambda_microvms._operations.lambda_microvms.create_microvm_auth_token
811
+
812
+ (
813
+ output,
814
+ http_response,
815
+ ) = await capo_lambda_microvms._operations.lambda_microvms.create_microvm_auth_token.async_create_microvm_auth_token(
816
+ req.options, req.input
817
+ )
818
+ return AsyncOperationResponse(output=output, response=http_response)
819
+
820
+ interceptors_, options_ = self._service.operation_options(config_overrides)
821
+ input_: capo_lambda_microvms.types.create_microvm_auth_token_request.CreateMicrovmAuthTokenRequest = {
822
+ "microvm_identifier": microvm_identifier,
823
+ "expiration_in_minutes": expiration_in_minutes,
824
+ "allowed_ports": allowed_ports,
825
+ }
826
+
827
+ response = await aexecute_pipeline(
828
+ AsyncOperationRequest(input=input_, options=options_),
829
+ handler=_handler,
830
+ interceptors=list(interceptors_),
831
+ )
832
+ await response.response.aclose()
833
+ return response.output
834
+
835
+ async def create_microvm_shell_auth_token(
836
+ self,
837
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
838
+ expiration_in_minutes: "capo_lambda_microvms.types.positive_integer.PositiveInteger",
839
+ *,
840
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
841
+ ) -> "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse":
842
+ """<p>Creates a shell authentication token for interactive shell access to a running MicroVM. The MicroVM must have been run with the SHELL_INGRESS network connector attached.</p>
843
+
844
+ Args:
845
+ microvm_identifier: <p>The ID of the MicroVM to create a shell authentication token for.</p>
846
+ expiration_in_minutes: <p>The duration in minutes before the shell authentication token expires.</p>
847
+
848
+ Raises:
849
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
850
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
851
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
852
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
853
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
854
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
855
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
856
+ """
857
+
858
+ async def _handler(
859
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest]",
860
+ ) -> AsyncOperationResponse[
861
+ "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse"
862
+ ]:
863
+ import capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token
864
+
865
+ (
866
+ output,
867
+ http_response,
868
+ ) = await capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token.async_create_microvm_shell_auth_token(
869
+ req.options, req.input
870
+ )
871
+ return AsyncOperationResponse(output=output, response=http_response)
872
+
873
+ interceptors_, options_ = self._service.operation_options(config_overrides)
874
+ input_: capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest = {
875
+ "microvm_identifier": microvm_identifier,
876
+ "expiration_in_minutes": expiration_in_minutes,
877
+ }
878
+
879
+ response = await aexecute_pipeline(
880
+ AsyncOperationRequest(input=input_, options=options_),
881
+ handler=_handler,
882
+ interceptors=list(interceptors_),
883
+ )
884
+ await response.response.aclose()
885
+ return response.output
886
+
887
+ async def resume_microvm(
888
+ self,
889
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
890
+ *,
891
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
892
+ ) -> "capo_lambda_microvms.types.resume_microvm_response.ResumeMicrovmResponse":
893
+ """<p>Resumes a suspended MicroVM, restoring it to RUNNING state with all state intact. The MicroVM must be in SUSPENDED state.</p>
894
+
895
+ Args:
896
+ microvm_identifier: <p>The ID of the MicroVM to resume.</p>
897
+
898
+ Raises:
899
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
900
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
901
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
902
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
903
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
904
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
905
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
906
+ """
907
+
908
+ async def _handler(
909
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.resume_microvm_request.ResumeMicrovmRequest]",
910
+ ) -> AsyncOperationResponse[
911
+ "capo_lambda_microvms.types.resume_microvm_response.ResumeMicrovmResponse"
912
+ ]:
913
+ import capo_lambda_microvms._operations.lambda_microvms.resume_microvm
914
+
915
+ (
916
+ output,
917
+ http_response,
918
+ ) = await capo_lambda_microvms._operations.lambda_microvms.resume_microvm.async_resume_microvm(
919
+ req.options, req.input
920
+ )
921
+ return AsyncOperationResponse(output=output, response=http_response)
922
+
923
+ interceptors_, options_ = self._service.operation_options(config_overrides)
924
+ input_: capo_lambda_microvms.types.resume_microvm_request.ResumeMicrovmRequest = {
925
+ "microvm_identifier": microvm_identifier
926
+ }
927
+
928
+ response = await aexecute_pipeline(
929
+ AsyncOperationRequest(input=input_, options=options_),
930
+ handler=_handler,
931
+ interceptors=list(interceptors_),
932
+ )
933
+ await response.response.aclose()
934
+ return response.output
935
+
936
+ async def suspend_microvm(
937
+ self,
938
+ microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
939
+ *,
940
+ config_overrides: Optional[AsyncLambdaMicrovmsClientConfig] = None,
941
+ ) -> "capo_lambda_microvms.types.suspend_microvm_response.SuspendMicrovmResponse":
942
+ """<p>Suspends a running MicroVM, preserving its full memory and disk state. The MicroVM transitions through SUSPENDING to SUSPENDED. To restore, call ResumeMicrovm or send traffic to the endpoint if autoResumeEnabled is true.</p>
943
+
944
+ Args:
945
+ microvm_identifier: <p>The ID of the MicroVM to suspend.</p>
946
+
947
+ Raises:
948
+ capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
949
+ capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
950
+ capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
951
+ capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
952
+ capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
953
+ capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
954
+ capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
955
+ """
956
+
957
+ async def _handler(
958
+ req: "AsyncOperationRequest[capo_lambda_microvms.types.suspend_microvm_request.SuspendMicrovmRequest]",
959
+ ) -> AsyncOperationResponse[
960
+ "capo_lambda_microvms.types.suspend_microvm_response.SuspendMicrovmResponse"
961
+ ]:
962
+ import capo_lambda_microvms._operations.lambda_microvms.suspend_microvm
963
+
964
+ (
965
+ output,
966
+ http_response,
967
+ ) = await capo_lambda_microvms._operations.lambda_microvms.suspend_microvm.async_suspend_microvm(
968
+ req.options, req.input
969
+ )
970
+ return AsyncOperationResponse(output=output, response=http_response)
971
+
972
+ interceptors_, options_ = self._service.operation_options(config_overrides)
973
+ input_: capo_lambda_microvms.types.suspend_microvm_request.SuspendMicrovmRequest = {
974
+ "microvm_identifier": microvm_identifier
975
+ }
976
+
977
+ response = await aexecute_pipeline(
978
+ AsyncOperationRequest(input=input_, options=options_),
979
+ handler=_handler,
980
+ interceptors=list(interceptors_),
981
+ )
982
+ await response.response.aclose()
983
+ return response.output