capo-codecatalyst 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 (233) hide show
  1. capo_codecatalyst/__init__.py +51 -0
  2. capo_codecatalyst/_async.py +25 -0
  3. capo_codecatalyst/_auth/_identity.py +14 -0
  4. capo_codecatalyst/_auth/_providers.py +154 -0
  5. capo_codecatalyst/_auth/_signers.py +43 -0
  6. capo_codecatalyst/_auth/_sigv4.py +434 -0
  7. capo_codecatalyst/_auth/_zapros_handler.py +80 -0
  8. capo_codecatalyst/_iter.py +113 -0
  9. capo_codecatalyst/_operations/code_catalyst/create_access_token.py +153 -0
  10. capo_codecatalyst/_operations/code_catalyst/create_dev_environment.py +165 -0
  11. capo_codecatalyst/_operations/code_catalyst/create_project.py +158 -0
  12. capo_codecatalyst/_operations/code_catalyst/create_source_repository.py +159 -0
  13. capo_codecatalyst/_operations/code_catalyst/create_source_repository_branch.py +165 -0
  14. capo_codecatalyst/_operations/code_catalyst/delete_access_token.py +146 -0
  15. capo_codecatalyst/_operations/code_catalyst/delete_dev_environment.py +159 -0
  16. capo_codecatalyst/_operations/code_catalyst/delete_project.py +155 -0
  17. capo_codecatalyst/_operations/code_catalyst/delete_source_repository.py +155 -0
  18. capo_codecatalyst/_operations/code_catalyst/delete_space.py +152 -0
  19. capo_codecatalyst/_operations/code_catalyst/get_dev_environment.py +159 -0
  20. capo_codecatalyst/_operations/code_catalyst/get_project.py +153 -0
  21. capo_codecatalyst/_operations/code_catalyst/get_source_repository.py +156 -0
  22. capo_codecatalyst/_operations/code_catalyst/get_source_repository_clone_urls.py +157 -0
  23. capo_codecatalyst/_operations/code_catalyst/get_space.py +152 -0
  24. capo_codecatalyst/_operations/code_catalyst/get_subscription.py +155 -0
  25. capo_codecatalyst/_operations/code_catalyst/get_user_details.py +157 -0
  26. capo_codecatalyst/_operations/code_catalyst/get_workflow.py +159 -0
  27. capo_codecatalyst/_operations/code_catalyst/get_workflow_run.py +161 -0
  28. capo_codecatalyst/_operations/code_catalyst/list_access_tokens.py +153 -0
  29. capo_codecatalyst/_operations/code_catalyst/list_dev_environment_sessions.py +164 -0
  30. capo_codecatalyst/_operations/code_catalyst/list_dev_environments.py +156 -0
  31. capo_codecatalyst/_operations/code_catalyst/list_event_logs.py +160 -0
  32. capo_codecatalyst/_operations/code_catalyst/list_projects.py +158 -0
  33. capo_codecatalyst/_operations/code_catalyst/list_source_repositories.py +159 -0
  34. capo_codecatalyst/_operations/code_catalyst/list_source_repository_branches.py +164 -0
  35. capo_codecatalyst/_operations/code_catalyst/list_spaces.py +155 -0
  36. capo_codecatalyst/_operations/code_catalyst/list_workflow_runs.py +166 -0
  37. capo_codecatalyst/_operations/code_catalyst/list_workflows.py +168 -0
  38. capo_codecatalyst/_operations/code_catalyst/start_dev_environment.py +160 -0
  39. capo_codecatalyst/_operations/code_catalyst/start_dev_environment_session.py +163 -0
  40. capo_codecatalyst/_operations/code_catalyst/start_workflow_run.py +160 -0
  41. capo_codecatalyst/_operations/code_catalyst/stop_dev_environment.py +155 -0
  42. capo_codecatalyst/_operations/code_catalyst/stop_dev_environment_session.py +156 -0
  43. capo_codecatalyst/_operations/code_catalyst/update_dev_environment.py +164 -0
  44. capo_codecatalyst/_operations/code_catalyst/update_project.py +159 -0
  45. capo_codecatalyst/_operations/code_catalyst/update_space.py +156 -0
  46. capo_codecatalyst/_operations/code_catalyst/verify_session.py +146 -0
  47. capo_codecatalyst/_pagination.py +21 -0
  48. capo_codecatalyst/_protocol/__init__.py +1 -0
  49. capo_codecatalyst/_protocol/errors.py +93 -0
  50. capo_codecatalyst/_protocol/eventstream.py +238 -0
  51. capo_codecatalyst/_protocol/serialize.py +47 -0
  52. capo_codecatalyst/_protocol/xml.py +33 -0
  53. capo_codecatalyst/_resources/code_catalyst/access_token.py +359 -0
  54. capo_codecatalyst/_resources/code_catalyst/space.py +578 -0
  55. capo_codecatalyst/_rule_engine/__init__.py +0 -0
  56. capo_codecatalyst/_rule_engine/_aws_partition.py +160 -0
  57. capo_codecatalyst/_rule_engine/_endpoint_rule_set.py +98 -0
  58. capo_codecatalyst/_rule_engine/_endpoint_runtime.py +389 -0
  59. capo_codecatalyst/_services/_aws_config.py +156 -0
  60. capo_codecatalyst/_services/_pipeline.py +195 -0
  61. capo_codecatalyst/_services/async_code_catalyst.py +214 -0
  62. capo_codecatalyst/_services/code_catalyst.py +212 -0
  63. capo_codecatalyst/errors/__init__.py +33 -0
  64. capo_codecatalyst/errors/_base.py +94 -0
  65. capo_codecatalyst/errors/access_denied_exception.py +47 -0
  66. capo_codecatalyst/errors/conflict_exception.py +45 -0
  67. capo_codecatalyst/errors/resource_not_found_exception.py +47 -0
  68. capo_codecatalyst/errors/service_quota_exceeded_exception.py +49 -0
  69. capo_codecatalyst/errors/throttling_exception.py +45 -0
  70. capo_codecatalyst/errors/validation_exception.py +45 -0
  71. capo_codecatalyst/py.typed +0 -0
  72. capo_codecatalyst/types/_prelude/blob.py +12 -0
  73. capo_codecatalyst/types/_prelude/timestamp.py +17 -0
  74. capo_codecatalyst/types/access_token_id.py +5 -0
  75. capo_codecatalyst/types/access_token_name.py +5 -0
  76. capo_codecatalyst/types/access_token_secret.py +5 -0
  77. capo_codecatalyst/types/access_token_summaries.py +31 -0
  78. capo_codecatalyst/types/access_token_summary.py +54 -0
  79. capo_codecatalyst/types/client_token.py +5 -0
  80. capo_codecatalyst/types/comparison_operator.py +5 -0
  81. capo_codecatalyst/types/create_access_token_request.py +46 -0
  82. capo_codecatalyst/types/create_access_token_response.py +63 -0
  83. capo_codecatalyst/types/create_dev_environment_request.py +123 -0
  84. capo_codecatalyst/types/create_dev_environment_response.py +52 -0
  85. capo_codecatalyst/types/create_project_request.py +43 -0
  86. capo_codecatalyst/types/create_project_response.py +49 -0
  87. capo_codecatalyst/types/create_source_repository_branch_request.py +38 -0
  88. capo_codecatalyst/types/create_source_repository_branch_response.py +60 -0
  89. capo_codecatalyst/types/create_source_repository_request.py +38 -0
  90. capo_codecatalyst/types/create_source_repository_response.py +57 -0
  91. capo_codecatalyst/types/delete_access_token_request.py +24 -0
  92. capo_codecatalyst/types/delete_access_token_response.py +18 -0
  93. capo_codecatalyst/types/delete_dev_environment_request.py +29 -0
  94. capo_codecatalyst/types/delete_dev_environment_response.py +46 -0
  95. capo_codecatalyst/types/delete_project_request.py +26 -0
  96. capo_codecatalyst/types/delete_project_response.py +44 -0
  97. capo_codecatalyst/types/delete_source_repository_request.py +29 -0
  98. capo_codecatalyst/types/delete_source_repository_response.py +48 -0
  99. capo_codecatalyst/types/delete_space_request.py +24 -0
  100. capo_codecatalyst/types/delete_space_response.py +37 -0
  101. capo_codecatalyst/types/dev_environment_access_details.py +38 -0
  102. capo_codecatalyst/types/dev_environment_repository_summaries.py +39 -0
  103. capo_codecatalyst/types/dev_environment_repository_summary.py +42 -0
  104. capo_codecatalyst/types/dev_environment_session_configuration.py +56 -0
  105. capo_codecatalyst/types/dev_environment_session_summary.py +71 -0
  106. capo_codecatalyst/types/dev_environment_session_type.py +5 -0
  107. capo_codecatalyst/types/dev_environment_sessions_summary_list.py +37 -0
  108. capo_codecatalyst/types/dev_environment_status.py +5 -0
  109. capo_codecatalyst/types/dev_environment_summary.py +163 -0
  110. capo_codecatalyst/types/dev_environment_summary_list.py +33 -0
  111. capo_codecatalyst/types/email_address.py +29 -0
  112. capo_codecatalyst/types/event_log_entries.py +31 -0
  113. capo_codecatalyst/types/event_log_entry.py +174 -0
  114. capo_codecatalyst/types/event_payload.py +29 -0
  115. capo_codecatalyst/types/execute_command_session_configuration.py +53 -0
  116. capo_codecatalyst/types/execute_command_session_configuration_arguments.py +14 -0
  117. capo_codecatalyst/types/filter.py +50 -0
  118. capo_codecatalyst/types/filter_key.py +5 -0
  119. capo_codecatalyst/types/filters.py +29 -0
  120. capo_codecatalyst/types/get_dev_environment_request.py +29 -0
  121. capo_codecatalyst/types/get_dev_environment_response.py +169 -0
  122. capo_codecatalyst/types/get_project_request.py +26 -0
  123. capo_codecatalyst/types/get_project_response.py +49 -0
  124. capo_codecatalyst/types/get_source_repository_clone_urls_request.py +29 -0
  125. capo_codecatalyst/types/get_source_repository_clone_urls_response.py +28 -0
  126. capo_codecatalyst/types/get_source_repository_request.py +29 -0
  127. capo_codecatalyst/types/get_source_repository_response.py +88 -0
  128. capo_codecatalyst/types/get_space_request.py +24 -0
  129. capo_codecatalyst/types/get_space_response.py +51 -0
  130. capo_codecatalyst/types/get_subscription_request.py +24 -0
  131. capo_codecatalyst/types/get_subscription_response.py +59 -0
  132. capo_codecatalyst/types/get_user_details_request.py +21 -0
  133. capo_codecatalyst/types/get_user_details_response.py +60 -0
  134. capo_codecatalyst/types/get_workflow_request.py +29 -0
  135. capo_codecatalyst/types/get_workflow_response.py +136 -0
  136. capo_codecatalyst/types/get_workflow_run_request.py +29 -0
  137. capo_codecatalyst/types/get_workflow_run_response.py +127 -0
  138. capo_codecatalyst/types/ide.py +29 -0
  139. capo_codecatalyst/types/ide_configuration.py +29 -0
  140. capo_codecatalyst/types/ide_configuration_list.py +31 -0
  141. capo_codecatalyst/types/ides.py +29 -0
  142. capo_codecatalyst/types/inactivity_timeout_minutes.py +5 -0
  143. capo_codecatalyst/types/instance_type.py +5 -0
  144. capo_codecatalyst/types/list_access_tokens_request.py +29 -0
  145. capo_codecatalyst/types/list_access_tokens_response.py +45 -0
  146. capo_codecatalyst/types/list_dev_environment_sessions_request.py +41 -0
  147. capo_codecatalyst/types/list_dev_environment_sessions_response.py +49 -0
  148. capo_codecatalyst/types/list_dev_environments_request.py +57 -0
  149. capo_codecatalyst/types/list_dev_environments_response.py +49 -0
  150. capo_codecatalyst/types/list_event_logs_request.py +75 -0
  151. capo_codecatalyst/types/list_event_logs_response.py +45 -0
  152. capo_codecatalyst/types/list_projects_request.py +53 -0
  153. capo_codecatalyst/types/list_projects_response.py +42 -0
  154. capo_codecatalyst/types/list_source_repositories_item.py +81 -0
  155. capo_codecatalyst/types/list_source_repositories_items.py +35 -0
  156. capo_codecatalyst/types/list_source_repositories_request.py +38 -0
  157. capo_codecatalyst/types/list_source_repositories_response.py +48 -0
  158. capo_codecatalyst/types/list_source_repository_branches_item.py +60 -0
  159. capo_codecatalyst/types/list_source_repository_branches_items.py +39 -0
  160. capo_codecatalyst/types/list_source_repository_branches_request.py +41 -0
  161. capo_codecatalyst/types/list_source_repository_branches_response.py +51 -0
  162. capo_codecatalyst/types/list_spaces_request.py +23 -0
  163. capo_codecatalyst/types/list_spaces_response.py +42 -0
  164. capo_codecatalyst/types/list_workflow_runs_request.py +54 -0
  165. capo_codecatalyst/types/list_workflow_runs_response.py +44 -0
  166. capo_codecatalyst/types/list_workflows_request.py +51 -0
  167. capo_codecatalyst/types/list_workflows_response.py +42 -0
  168. capo_codecatalyst/types/name_string.py +5 -0
  169. capo_codecatalyst/types/operation_type.py +5 -0
  170. capo_codecatalyst/types/persistent_storage.py +26 -0
  171. capo_codecatalyst/types/persistent_storage_configuration.py +28 -0
  172. capo_codecatalyst/types/project_description.py +5 -0
  173. capo_codecatalyst/types/project_display_name.py +5 -0
  174. capo_codecatalyst/types/project_information.py +29 -0
  175. capo_codecatalyst/types/project_list_filter.py +54 -0
  176. capo_codecatalyst/types/project_list_filters.py +31 -0
  177. capo_codecatalyst/types/project_summaries.py +31 -0
  178. capo_codecatalyst/types/project_summary.py +38 -0
  179. capo_codecatalyst/types/region_string.py +5 -0
  180. capo_codecatalyst/types/repositories_input.py +31 -0
  181. capo_codecatalyst/types/repository_input.py +40 -0
  182. capo_codecatalyst/types/sensitive_string.py +5 -0
  183. capo_codecatalyst/types/source_repository_branch_ref_string.py +5 -0
  184. capo_codecatalyst/types/source_repository_branch_string.py +5 -0
  185. capo_codecatalyst/types/source_repository_description_string.py +5 -0
  186. capo_codecatalyst/types/source_repository_id_string.py +5 -0
  187. capo_codecatalyst/types/source_repository_name_string.py +5 -0
  188. capo_codecatalyst/types/space_description.py +5 -0
  189. capo_codecatalyst/types/space_summaries.py +29 -0
  190. capo_codecatalyst/types/space_summary.py +51 -0
  191. capo_codecatalyst/types/start_dev_environment_request.py +63 -0
  192. capo_codecatalyst/types/start_dev_environment_response.py +54 -0
  193. capo_codecatalyst/types/start_dev_environment_session_request.py +52 -0
  194. capo_codecatalyst/types/start_dev_environment_session_response.py +77 -0
  195. capo_codecatalyst/types/start_workflow_run_request.py +35 -0
  196. capo_codecatalyst/types/start_workflow_run_response.py +53 -0
  197. capo_codecatalyst/types/status_reason.py +5 -0
  198. capo_codecatalyst/types/stop_dev_environment_request.py +29 -0
  199. capo_codecatalyst/types/stop_dev_environment_response.py +54 -0
  200. capo_codecatalyst/types/stop_dev_environment_session_request.py +31 -0
  201. capo_codecatalyst/types/stop_dev_environment_session_response.py +59 -0
  202. capo_codecatalyst/types/string_list.py +14 -0
  203. capo_codecatalyst/types/timestamp.py +20 -0
  204. capo_codecatalyst/types/update_dev_environment_request.py +76 -0
  205. capo_codecatalyst/types/update_dev_environment_response.py +93 -0
  206. capo_codecatalyst/types/update_project_request.py +35 -0
  207. capo_codecatalyst/types/update_project_response.py +46 -0
  208. capo_codecatalyst/types/update_space_request.py +33 -0
  209. capo_codecatalyst/types/update_space_response.py +40 -0
  210. capo_codecatalyst/types/user_identity.py +50 -0
  211. capo_codecatalyst/types/user_type.py +5 -0
  212. capo_codecatalyst/types/uuid.py +5 -0
  213. capo_codecatalyst/types/verify_session_response.py +23 -0
  214. capo_codecatalyst/types/workflow_definition.py +26 -0
  215. capo_codecatalyst/types/workflow_definition_summary.py +26 -0
  216. capo_codecatalyst/types/workflow_run_mode.py +5 -0
  217. capo_codecatalyst/types/workflow_run_sort_criteria.py +18 -0
  218. capo_codecatalyst/types/workflow_run_sort_criteria_list.py +35 -0
  219. capo_codecatalyst/types/workflow_run_status.py +5 -0
  220. capo_codecatalyst/types/workflow_run_status_reason.py +18 -0
  221. capo_codecatalyst/types/workflow_run_status_reasons.py +35 -0
  222. capo_codecatalyst/types/workflow_run_summaries.py +31 -0
  223. capo_codecatalyst/types/workflow_run_summary.py +119 -0
  224. capo_codecatalyst/types/workflow_sort_criteria.py +18 -0
  225. capo_codecatalyst/types/workflow_sort_criteria_list.py +33 -0
  226. capo_codecatalyst/types/workflow_status.py +5 -0
  227. capo_codecatalyst/types/workflow_summaries.py +31 -0
  228. capo_codecatalyst/types/workflow_summary.py +123 -0
  229. capo_codecatalyst-0.1.0.dist-info/METADATA +82 -0
  230. capo_codecatalyst-0.1.0.dist-info/RECORD +233 -0
  231. capo_codecatalyst-0.1.0.dist-info/WHEEL +5 -0
  232. capo_codecatalyst-0.1.0.dist-info/licenses/LICENSE +21 -0
  233. capo_codecatalyst-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,159 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codecatalyst#ListSourceRepositories``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Any
7
+ from urllib.parse import quote
8
+
9
+ import zapros
10
+ from typing_extensions import Never
11
+
12
+ import capo_codecatalyst._auth._signers
13
+ import capo_codecatalyst._auth._sigv4
14
+ import capo_codecatalyst._protocol.eventstream
15
+ import capo_codecatalyst.errors.access_denied_exception
16
+ import capo_codecatalyst.errors.conflict_exception
17
+ import capo_codecatalyst.errors.resource_not_found_exception
18
+ import capo_codecatalyst.errors.service_quota_exceeded_exception
19
+ import capo_codecatalyst.errors.throttling_exception
20
+ import capo_codecatalyst.errors.validation_exception
21
+ import capo_codecatalyst.types.list_source_repositories_items
22
+ import capo_codecatalyst.types.list_source_repositories_request
23
+ import capo_codecatalyst.types.list_source_repositories_response
24
+ from capo_codecatalyst._protocol.errors import parse_error_metadata_json
25
+ from capo_codecatalyst._rule_engine._endpoint_rule_set import EndpointParams, resolve
26
+ from capo_codecatalyst._services._pipeline import (
27
+ AsyncOperationOptions,
28
+ OperationOptions,
29
+ )
30
+ from capo_codecatalyst.errors import UnknownServiceError
31
+
32
+
33
+ def handle_error(response: zapros.Response) -> Never:
34
+ data = json.loads(response.read())
35
+ code, message = parse_error_metadata_json(response, data)
36
+ match code:
37
+ case "AccessDeniedException":
38
+ raise capo_codecatalyst.errors.access_denied_exception.AccessDeniedException.from_json(
39
+ data, message
40
+ )
41
+ case "ConflictException":
42
+ raise capo_codecatalyst.errors.conflict_exception.ConflictException.from_json(
43
+ data, message
44
+ )
45
+ case "ResourceNotFoundException":
46
+ raise capo_codecatalyst.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
47
+ data, message
48
+ )
49
+ case "ServiceQuotaExceededException":
50
+ raise capo_codecatalyst.errors.service_quota_exceeded_exception.ServiceQuotaExceededException.from_json(
51
+ data, message
52
+ )
53
+ case "ThrottlingException":
54
+ raise capo_codecatalyst.errors.throttling_exception.ThrottlingException.from_json(
55
+ data, message
56
+ )
57
+ case "ValidationException":
58
+ raise capo_codecatalyst.errors.validation_exception.ValidationException.from_json(
59
+ data, message
60
+ )
61
+ case _:
62
+ raise UnknownServiceError(code=code, message=message, response=response)
63
+
64
+
65
+ def handle_response(
66
+ response: zapros.Response,
67
+ ) -> capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse:
68
+ out: capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse = capo_codecatalyst.types.list_source_repositories_response.deserialize_json(
69
+ json.loads(response.read())
70
+ )
71
+ return out
72
+
73
+
74
+ async def async_handle_response(
75
+ response: zapros.Response,
76
+ ) -> capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse:
77
+ out: capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse = capo_codecatalyst.types.list_source_repositories_response.deserialize_json(
78
+ json.loads(await response.aread())
79
+ )
80
+ return out
81
+
82
+
83
+ def get_signer(
84
+ options: AsyncOperationOptions | OperationOptions,
85
+ auth_schemes: list[dict[str, Any]] | None = None,
86
+ ) -> capo_codecatalyst._auth._signers.Signer | None:
87
+ name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
88
+ if options.bearer_provider is not None:
89
+ return capo_codecatalyst._auth._signers.HttpBearerSigner(
90
+ options.bearer_provider
91
+ )
92
+ raise RuntimeError("Auth was not resolved")
93
+
94
+
95
+ def build_request(
96
+ options: OperationOptions | AsyncOperationOptions,
97
+ input_: capo_codecatalyst.types.list_source_repositories_request.ListSourceRepositoriesRequest,
98
+ ) -> zapros.Request:
99
+ endpoint = resolve(
100
+ EndpointParams(
101
+ UseFIPS=options.use_fips, Region=options.region, Endpoint=options.endpoint
102
+ )
103
+ ) # noqa: F841
104
+ url = (
105
+ endpoint.url.rstrip("/")
106
+ + "/v1/spaces/{spaceName}/projects/{projectName}/sourceRepositories"
107
+ )
108
+ url = url.replace("{spaceName}", quote(input_["space_name"], safe=""))
109
+ url = url.replace("{projectName}", quote(input_["project_name"], safe=""))
110
+ params: list[tuple[str, str]] = []
111
+ headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
112
+ body: bytes | None = json.dumps(
113
+ capo_codecatalyst.types.list_source_repositories_request.serialize_json(input_),
114
+ allow_nan=False,
115
+ ).encode()
116
+ headers["content-type"] = "application/json"
117
+ signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
118
+ normalized_url = zapros.URL(url)
119
+ for k, v in params:
120
+ normalized_url.search_params.append(k, v)
121
+ return zapros.Request(
122
+ normalized_url, "POST", headers=headers, body=body, context={"signer": signer}
123
+ )
124
+
125
+
126
+ def list_source_repositories(
127
+ options: OperationOptions,
128
+ input_: capo_codecatalyst.types.list_source_repositories_request.ListSourceRepositoriesRequest,
129
+ ) -> tuple[
130
+ capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse,
131
+ zapros.Response,
132
+ ]:
133
+ response = options.client.handler.handle(build_request(options, input_))
134
+ try:
135
+ if response.status >= 300:
136
+ response.read()
137
+ handle_error(response)
138
+ return handle_response(response), response
139
+ except BaseException:
140
+ response.close()
141
+ raise
142
+
143
+
144
+ async def async_list_source_repositories(
145
+ options: AsyncOperationOptions,
146
+ input_: capo_codecatalyst.types.list_source_repositories_request.ListSourceRepositoriesRequest,
147
+ ) -> tuple[
148
+ capo_codecatalyst.types.list_source_repositories_response.ListSourceRepositoriesResponse,
149
+ zapros.Response,
150
+ ]:
151
+ response = await options.client.handler.ahandle(build_request(options, input_))
152
+ try:
153
+ if response.status >= 300:
154
+ await response.aread()
155
+ handle_error(response)
156
+ return await async_handle_response(response), response
157
+ except BaseException:
158
+ await response.aclose()
159
+ raise
@@ -0,0 +1,164 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codecatalyst#ListSourceRepositoryBranches``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Any
7
+ from urllib.parse import quote
8
+
9
+ import zapros
10
+ from typing_extensions import Never
11
+
12
+ import capo_codecatalyst._auth._signers
13
+ import capo_codecatalyst._auth._sigv4
14
+ import capo_codecatalyst._protocol.eventstream
15
+ import capo_codecatalyst.errors.access_denied_exception
16
+ import capo_codecatalyst.errors.conflict_exception
17
+ import capo_codecatalyst.errors.resource_not_found_exception
18
+ import capo_codecatalyst.errors.service_quota_exceeded_exception
19
+ import capo_codecatalyst.errors.throttling_exception
20
+ import capo_codecatalyst.errors.validation_exception
21
+ import capo_codecatalyst.types.list_source_repository_branches_items
22
+ import capo_codecatalyst.types.list_source_repository_branches_request
23
+ import capo_codecatalyst.types.list_source_repository_branches_response
24
+ from capo_codecatalyst._protocol.errors import parse_error_metadata_json
25
+ from capo_codecatalyst._rule_engine._endpoint_rule_set import EndpointParams, resolve
26
+ from capo_codecatalyst._services._pipeline import (
27
+ AsyncOperationOptions,
28
+ OperationOptions,
29
+ )
30
+ from capo_codecatalyst.errors import UnknownServiceError
31
+
32
+
33
+ def handle_error(response: zapros.Response) -> Never:
34
+ data = json.loads(response.read())
35
+ code, message = parse_error_metadata_json(response, data)
36
+ match code:
37
+ case "AccessDeniedException":
38
+ raise capo_codecatalyst.errors.access_denied_exception.AccessDeniedException.from_json(
39
+ data, message
40
+ )
41
+ case "ConflictException":
42
+ raise capo_codecatalyst.errors.conflict_exception.ConflictException.from_json(
43
+ data, message
44
+ )
45
+ case "ResourceNotFoundException":
46
+ raise capo_codecatalyst.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
47
+ data, message
48
+ )
49
+ case "ServiceQuotaExceededException":
50
+ raise capo_codecatalyst.errors.service_quota_exceeded_exception.ServiceQuotaExceededException.from_json(
51
+ data, message
52
+ )
53
+ case "ThrottlingException":
54
+ raise capo_codecatalyst.errors.throttling_exception.ThrottlingException.from_json(
55
+ data, message
56
+ )
57
+ case "ValidationException":
58
+ raise capo_codecatalyst.errors.validation_exception.ValidationException.from_json(
59
+ data, message
60
+ )
61
+ case _:
62
+ raise UnknownServiceError(code=code, message=message, response=response)
63
+
64
+
65
+ def handle_response(
66
+ response: zapros.Response,
67
+ ) -> capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse:
68
+ out: capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse = capo_codecatalyst.types.list_source_repository_branches_response.deserialize_json(
69
+ json.loads(response.read())
70
+ )
71
+ return out
72
+
73
+
74
+ async def async_handle_response(
75
+ response: zapros.Response,
76
+ ) -> capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse:
77
+ out: capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse = capo_codecatalyst.types.list_source_repository_branches_response.deserialize_json(
78
+ json.loads(await response.aread())
79
+ )
80
+ return out
81
+
82
+
83
+ def get_signer(
84
+ options: AsyncOperationOptions | OperationOptions,
85
+ auth_schemes: list[dict[str, Any]] | None = None,
86
+ ) -> capo_codecatalyst._auth._signers.Signer | None:
87
+ name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
88
+ if options.bearer_provider is not None:
89
+ return capo_codecatalyst._auth._signers.HttpBearerSigner(
90
+ options.bearer_provider
91
+ )
92
+ raise RuntimeError("Auth was not resolved")
93
+
94
+
95
+ def build_request(
96
+ options: OperationOptions | AsyncOperationOptions,
97
+ input_: capo_codecatalyst.types.list_source_repository_branches_request.ListSourceRepositoryBranchesRequest,
98
+ ) -> zapros.Request:
99
+ endpoint = resolve(
100
+ EndpointParams(
101
+ UseFIPS=options.use_fips, Region=options.region, Endpoint=options.endpoint
102
+ )
103
+ ) # noqa: F841
104
+ url = (
105
+ endpoint.url.rstrip("/")
106
+ + "/v1/spaces/{spaceName}/projects/{projectName}/sourceRepositories/{sourceRepositoryName}/branches"
107
+ )
108
+ url = url.replace("{spaceName}", quote(input_["space_name"], safe=""))
109
+ url = url.replace("{projectName}", quote(input_["project_name"], safe=""))
110
+ url = url.replace(
111
+ "{sourceRepositoryName}", quote(input_["source_repository_name"], safe="")
112
+ )
113
+ params: list[tuple[str, str]] = []
114
+ headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
115
+ body: bytes | None = json.dumps(
116
+ capo_codecatalyst.types.list_source_repository_branches_request.serialize_json(
117
+ input_
118
+ ),
119
+ allow_nan=False,
120
+ ).encode()
121
+ headers["content-type"] = "application/json"
122
+ signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
123
+ normalized_url = zapros.URL(url)
124
+ for k, v in params:
125
+ normalized_url.search_params.append(k, v)
126
+ return zapros.Request(
127
+ normalized_url, "POST", headers=headers, body=body, context={"signer": signer}
128
+ )
129
+
130
+
131
+ def list_source_repository_branches(
132
+ options: OperationOptions,
133
+ input_: capo_codecatalyst.types.list_source_repository_branches_request.ListSourceRepositoryBranchesRequest,
134
+ ) -> tuple[
135
+ capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse,
136
+ zapros.Response,
137
+ ]:
138
+ response = options.client.handler.handle(build_request(options, input_))
139
+ try:
140
+ if response.status >= 300:
141
+ response.read()
142
+ handle_error(response)
143
+ return handle_response(response), response
144
+ except BaseException:
145
+ response.close()
146
+ raise
147
+
148
+
149
+ async def async_list_source_repository_branches(
150
+ options: AsyncOperationOptions,
151
+ input_: capo_codecatalyst.types.list_source_repository_branches_request.ListSourceRepositoryBranchesRequest,
152
+ ) -> tuple[
153
+ capo_codecatalyst.types.list_source_repository_branches_response.ListSourceRepositoryBranchesResponse,
154
+ zapros.Response,
155
+ ]:
156
+ response = await options.client.handler.ahandle(build_request(options, input_))
157
+ try:
158
+ if response.status >= 300:
159
+ await response.aread()
160
+ handle_error(response)
161
+ return await async_handle_response(response), response
162
+ except BaseException:
163
+ await response.aclose()
164
+ raise
@@ -0,0 +1,155 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codecatalyst#ListSpaces``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Any
7
+
8
+ import zapros
9
+ from typing_extensions import Never
10
+
11
+ import capo_codecatalyst._auth._signers
12
+ import capo_codecatalyst._auth._sigv4
13
+ import capo_codecatalyst._protocol.eventstream
14
+ import capo_codecatalyst.errors.access_denied_exception
15
+ import capo_codecatalyst.errors.conflict_exception
16
+ import capo_codecatalyst.errors.resource_not_found_exception
17
+ import capo_codecatalyst.errors.service_quota_exceeded_exception
18
+ import capo_codecatalyst.errors.throttling_exception
19
+ import capo_codecatalyst.errors.validation_exception
20
+ import capo_codecatalyst.types.list_spaces_request
21
+ import capo_codecatalyst.types.list_spaces_response
22
+ import capo_codecatalyst.types.space_summaries
23
+ from capo_codecatalyst._protocol.errors import parse_error_metadata_json
24
+ from capo_codecatalyst._rule_engine._endpoint_rule_set import EndpointParams, resolve
25
+ from capo_codecatalyst._services._pipeline import (
26
+ AsyncOperationOptions,
27
+ OperationOptions,
28
+ )
29
+ from capo_codecatalyst.errors import UnknownServiceError
30
+
31
+
32
+ def handle_error(response: zapros.Response) -> Never:
33
+ data = json.loads(response.read())
34
+ code, message = parse_error_metadata_json(response, data)
35
+ match code:
36
+ case "AccessDeniedException":
37
+ raise capo_codecatalyst.errors.access_denied_exception.AccessDeniedException.from_json(
38
+ data, message
39
+ )
40
+ case "ConflictException":
41
+ raise capo_codecatalyst.errors.conflict_exception.ConflictException.from_json(
42
+ data, message
43
+ )
44
+ case "ResourceNotFoundException":
45
+ raise capo_codecatalyst.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
46
+ data, message
47
+ )
48
+ case "ServiceQuotaExceededException":
49
+ raise capo_codecatalyst.errors.service_quota_exceeded_exception.ServiceQuotaExceededException.from_json(
50
+ data, message
51
+ )
52
+ case "ThrottlingException":
53
+ raise capo_codecatalyst.errors.throttling_exception.ThrottlingException.from_json(
54
+ data, message
55
+ )
56
+ case "ValidationException":
57
+ raise capo_codecatalyst.errors.validation_exception.ValidationException.from_json(
58
+ data, message
59
+ )
60
+ case _:
61
+ raise UnknownServiceError(code=code, message=message, response=response)
62
+
63
+
64
+ def handle_response(
65
+ response: zapros.Response,
66
+ ) -> capo_codecatalyst.types.list_spaces_response.ListSpacesResponse:
67
+ out: capo_codecatalyst.types.list_spaces_response.ListSpacesResponse = (
68
+ capo_codecatalyst.types.list_spaces_response.deserialize_json(
69
+ json.loads(response.read())
70
+ )
71
+ )
72
+ return out
73
+
74
+
75
+ async def async_handle_response(
76
+ response: zapros.Response,
77
+ ) -> capo_codecatalyst.types.list_spaces_response.ListSpacesResponse:
78
+ out: capo_codecatalyst.types.list_spaces_response.ListSpacesResponse = (
79
+ capo_codecatalyst.types.list_spaces_response.deserialize_json(
80
+ json.loads(await response.aread())
81
+ )
82
+ )
83
+ return out
84
+
85
+
86
+ def get_signer(
87
+ options: AsyncOperationOptions | OperationOptions,
88
+ auth_schemes: list[dict[str, Any]] | None = None,
89
+ ) -> capo_codecatalyst._auth._signers.Signer | None:
90
+ name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
91
+ if options.bearer_provider is not None:
92
+ return capo_codecatalyst._auth._signers.HttpBearerSigner(
93
+ options.bearer_provider
94
+ )
95
+ raise RuntimeError("Auth was not resolved")
96
+
97
+
98
+ def build_request(
99
+ options: OperationOptions | AsyncOperationOptions,
100
+ input_: capo_codecatalyst.types.list_spaces_request.ListSpacesRequest,
101
+ ) -> zapros.Request:
102
+ endpoint = resolve(
103
+ EndpointParams(
104
+ UseFIPS=options.use_fips, Region=options.region, Endpoint=options.endpoint
105
+ )
106
+ ) # noqa: F841
107
+ url = endpoint.url.rstrip("/") + "/v1/spaces"
108
+ params: list[tuple[str, str]] = []
109
+ headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
110
+ body: bytes | None = json.dumps(
111
+ capo_codecatalyst.types.list_spaces_request.serialize_json(input_),
112
+ allow_nan=False,
113
+ ).encode()
114
+ headers["content-type"] = "application/json"
115
+ signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
116
+ normalized_url = zapros.URL(url)
117
+ for k, v in params:
118
+ normalized_url.search_params.append(k, v)
119
+ return zapros.Request(
120
+ normalized_url, "POST", headers=headers, body=body, context={"signer": signer}
121
+ )
122
+
123
+
124
+ def list_spaces(
125
+ options: OperationOptions,
126
+ input_: capo_codecatalyst.types.list_spaces_request.ListSpacesRequest,
127
+ ) -> tuple[
128
+ capo_codecatalyst.types.list_spaces_response.ListSpacesResponse, zapros.Response
129
+ ]:
130
+ response = options.client.handler.handle(build_request(options, input_))
131
+ try:
132
+ if response.status >= 300:
133
+ response.read()
134
+ handle_error(response)
135
+ return handle_response(response), response
136
+ except BaseException:
137
+ response.close()
138
+ raise
139
+
140
+
141
+ async def async_list_spaces(
142
+ options: AsyncOperationOptions,
143
+ input_: capo_codecatalyst.types.list_spaces_request.ListSpacesRequest,
144
+ ) -> tuple[
145
+ capo_codecatalyst.types.list_spaces_response.ListSpacesResponse, zapros.Response
146
+ ]:
147
+ response = await options.client.handler.ahandle(build_request(options, input_))
148
+ try:
149
+ if response.status >= 300:
150
+ await response.aread()
151
+ handle_error(response)
152
+ return await async_handle_response(response), response
153
+ except BaseException:
154
+ await response.aclose()
155
+ raise
@@ -0,0 +1,166 @@
1
+ """Generated from Smithy shape ``com.amazonaws.codecatalyst#ListWorkflowRuns``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from typing import Any
7
+ from urllib.parse import quote
8
+
9
+ import zapros
10
+ from typing_extensions import Never
11
+
12
+ import capo_codecatalyst._auth._signers
13
+ import capo_codecatalyst._auth._sigv4
14
+ import capo_codecatalyst._protocol.eventstream
15
+ import capo_codecatalyst.errors.access_denied_exception
16
+ import capo_codecatalyst.errors.conflict_exception
17
+ import capo_codecatalyst.errors.resource_not_found_exception
18
+ import capo_codecatalyst.errors.service_quota_exceeded_exception
19
+ import capo_codecatalyst.errors.throttling_exception
20
+ import capo_codecatalyst.errors.validation_exception
21
+ import capo_codecatalyst.types.list_workflow_runs_request
22
+ import capo_codecatalyst.types.list_workflow_runs_response
23
+ import capo_codecatalyst.types.workflow_run_sort_criteria_list
24
+ import capo_codecatalyst.types.workflow_run_summaries
25
+ from capo_codecatalyst._protocol.errors import parse_error_metadata_json
26
+ from capo_codecatalyst._rule_engine._endpoint_rule_set import EndpointParams, resolve
27
+ from capo_codecatalyst._services._pipeline import (
28
+ AsyncOperationOptions,
29
+ OperationOptions,
30
+ )
31
+ from capo_codecatalyst.errors import UnknownServiceError
32
+
33
+
34
+ def handle_error(response: zapros.Response) -> Never:
35
+ data = json.loads(response.read())
36
+ code, message = parse_error_metadata_json(response, data)
37
+ match code:
38
+ case "AccessDeniedException":
39
+ raise capo_codecatalyst.errors.access_denied_exception.AccessDeniedException.from_json(
40
+ data, message
41
+ )
42
+ case "ConflictException":
43
+ raise capo_codecatalyst.errors.conflict_exception.ConflictException.from_json(
44
+ data, message
45
+ )
46
+ case "ResourceNotFoundException":
47
+ raise capo_codecatalyst.errors.resource_not_found_exception.ResourceNotFoundException.from_json(
48
+ data, message
49
+ )
50
+ case "ServiceQuotaExceededException":
51
+ raise capo_codecatalyst.errors.service_quota_exceeded_exception.ServiceQuotaExceededException.from_json(
52
+ data, message
53
+ )
54
+ case "ThrottlingException":
55
+ raise capo_codecatalyst.errors.throttling_exception.ThrottlingException.from_json(
56
+ data, message
57
+ )
58
+ case "ValidationException":
59
+ raise capo_codecatalyst.errors.validation_exception.ValidationException.from_json(
60
+ data, message
61
+ )
62
+ case _:
63
+ raise UnknownServiceError(code=code, message=message, response=response)
64
+
65
+
66
+ def handle_response(
67
+ response: zapros.Response,
68
+ ) -> capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse:
69
+ out: capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse = capo_codecatalyst.types.list_workflow_runs_response.deserialize_json(
70
+ json.loads(response.read())
71
+ )
72
+ return out
73
+
74
+
75
+ async def async_handle_response(
76
+ response: zapros.Response,
77
+ ) -> capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse:
78
+ out: capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse = capo_codecatalyst.types.list_workflow_runs_response.deserialize_json(
79
+ json.loads(await response.aread())
80
+ )
81
+ return out
82
+
83
+
84
+ def get_signer(
85
+ options: AsyncOperationOptions | OperationOptions,
86
+ auth_schemes: list[dict[str, Any]] | None = None,
87
+ ) -> capo_codecatalyst._auth._signers.Signer | None:
88
+ name_to_schema = {s["name"]: s for s in (auth_schemes or [])} # noqa: F841
89
+ if options.bearer_provider is not None:
90
+ return capo_codecatalyst._auth._signers.HttpBearerSigner(
91
+ options.bearer_provider
92
+ )
93
+ raise RuntimeError("Auth was not resolved")
94
+
95
+
96
+ def build_request(
97
+ options: OperationOptions | AsyncOperationOptions,
98
+ input_: capo_codecatalyst.types.list_workflow_runs_request.ListWorkflowRunsRequest,
99
+ ) -> zapros.Request:
100
+ endpoint = resolve(
101
+ EndpointParams(
102
+ UseFIPS=options.use_fips, Region=options.region, Endpoint=options.endpoint
103
+ )
104
+ ) # noqa: F841
105
+ url = (
106
+ endpoint.url.rstrip("/")
107
+ + "/v1/spaces/{spaceName}/projects/{projectName}/workflowRuns"
108
+ )
109
+ url = url.replace("{spaceName}", quote(input_["space_name"], safe=""))
110
+ url = url.replace("{projectName}", quote(input_["project_name"], safe=""))
111
+ params: list[tuple[str, str]] = []
112
+ if "workflow_id" in input_:
113
+ params.append(("workflowId", input_["workflow_id"]))
114
+ if "next_token" in input_:
115
+ params.append(("nextToken", input_["next_token"]))
116
+ if "max_results" in input_:
117
+ params.append(("maxResults", str(input_["max_results"])))
118
+ headers: dict[str, str] = {k: ", ".join(v) for k, v in endpoint.headers.items()}
119
+ body: bytes | None = json.dumps(
120
+ capo_codecatalyst.types.list_workflow_runs_request.serialize_json(input_),
121
+ allow_nan=False,
122
+ ).encode()
123
+ headers["content-type"] = "application/json"
124
+ signer = get_signer(options, auth_schemes=endpoint.properties.get("authSchemes"))
125
+ normalized_url = zapros.URL(url)
126
+ for k, v in params:
127
+ normalized_url.search_params.append(k, v)
128
+ return zapros.Request(
129
+ normalized_url, "POST", headers=headers, body=body, context={"signer": signer}
130
+ )
131
+
132
+
133
+ def list_workflow_runs(
134
+ options: OperationOptions,
135
+ input_: capo_codecatalyst.types.list_workflow_runs_request.ListWorkflowRunsRequest,
136
+ ) -> tuple[
137
+ capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse,
138
+ zapros.Response,
139
+ ]:
140
+ response = options.client.handler.handle(build_request(options, input_))
141
+ try:
142
+ if response.status >= 300:
143
+ response.read()
144
+ handle_error(response)
145
+ return handle_response(response), response
146
+ except BaseException:
147
+ response.close()
148
+ raise
149
+
150
+
151
+ async def async_list_workflow_runs(
152
+ options: AsyncOperationOptions,
153
+ input_: capo_codecatalyst.types.list_workflow_runs_request.ListWorkflowRunsRequest,
154
+ ) -> tuple[
155
+ capo_codecatalyst.types.list_workflow_runs_response.ListWorkflowRunsResponse,
156
+ zapros.Response,
157
+ ]:
158
+ response = await options.client.handler.ahandle(build_request(options, input_))
159
+ try:
160
+ if response.status >= 300:
161
+ await response.aread()
162
+ handle_error(response)
163
+ return await async_handle_response(response), response
164
+ except BaseException:
165
+ await response.aclose()
166
+ raise