levelfour 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 (208) hide show
  1. levelfour/__init__.py +495 -0
  2. levelfour/api_keys/__init__.py +34 -0
  3. levelfour/api_keys/client.py +337 -0
  4. levelfour/api_keys/raw_client.py +621 -0
  5. levelfour/api_keys/types/__init__.py +34 -0
  6. levelfour/api_keys/types/create_api_key_request_scope.py +5 -0
  7. levelfour/async_levelfour_client.py +39 -0
  8. levelfour/base_client.py +346 -0
  9. levelfour/client.py +54 -0
  10. levelfour/core/__init__.py +127 -0
  11. levelfour/core/api_error.py +23 -0
  12. levelfour/core/client_wrapper.py +105 -0
  13. levelfour/core/datetime_utils.py +70 -0
  14. levelfour/core/file.py +67 -0
  15. levelfour/core/force_multipart.py +18 -0
  16. levelfour/core/http_client.py +776 -0
  17. levelfour/core/http_response.py +59 -0
  18. levelfour/core/http_sse/__init__.py +42 -0
  19. levelfour/core/http_sse/_api.py +112 -0
  20. levelfour/core/http_sse/_decoders.py +61 -0
  21. levelfour/core/http_sse/_exceptions.py +7 -0
  22. levelfour/core/http_sse/_models.py +17 -0
  23. levelfour/core/jsonable_encoder.py +108 -0
  24. levelfour/core/logging.py +107 -0
  25. levelfour/core/pagination.py +82 -0
  26. levelfour/core/pydantic_utilities.py +577 -0
  27. levelfour/core/query_encoder.py +58 -0
  28. levelfour/core/remove_none_from_dict.py +11 -0
  29. levelfour/core/request_options.py +35 -0
  30. levelfour/core/serialization.py +276 -0
  31. levelfour/errors/__init__.py +40 -0
  32. levelfour/errors/forbidden_error.py +11 -0
  33. levelfour/errors/unauthorized_error.py +11 -0
  34. levelfour/errors/unprocessable_entity_error.py +11 -0
  35. levelfour/evaluation/__init__.py +4 -0
  36. levelfour/evaluation/client.py +102 -0
  37. levelfour/evaluation/raw_client.py +141 -0
  38. levelfour/exceptions.py +63 -0
  39. levelfour/health/__init__.py +4 -0
  40. levelfour/health/client.py +163 -0
  41. levelfour/health/raw_client.py +164 -0
  42. levelfour/integrations/__init__.py +0 -0
  43. levelfour/integrations/django.py +26 -0
  44. levelfour/integrations/fastapi.py +39 -0
  45. levelfour/integrations/telemetry.py +66 -0
  46. levelfour/levelfour_client.py +47 -0
  47. levelfour/pagination.py +84 -0
  48. levelfour/pr_analysis/__init__.py +4 -0
  49. levelfour/pr_analysis/client.py +408 -0
  50. levelfour/pr_analysis/raw_client.py +620 -0
  51. levelfour/pr_analysis_actions/__init__.py +4 -0
  52. levelfour/pr_analysis_actions/client.py +588 -0
  53. levelfour/pr_analysis_actions/raw_client.py +939 -0
  54. levelfour/pr_analysis_installations/__init__.py +4 -0
  55. levelfour/pr_analysis_installations/client.py +470 -0
  56. levelfour/pr_analysis_installations/raw_client.py +868 -0
  57. levelfour/providers/__init__.py +34 -0
  58. levelfour/providers/client.py +1504 -0
  59. levelfour/providers/raw_client.py +2398 -0
  60. levelfour/providers/types/__init__.py +36 -0
  61. levelfour/providers/types/list_spending_breakdown_providers_response.py +11 -0
  62. levelfour/py.typed +0 -0
  63. levelfour/recommendations/__init__.py +4 -0
  64. levelfour/recommendations/client.py +1018 -0
  65. levelfour/recommendations/raw_client.py +1810 -0
  66. levelfour/savings/__init__.py +4 -0
  67. levelfour/savings/client.py +401 -0
  68. levelfour/savings/raw_client.py +624 -0
  69. levelfour/spending/__init__.py +34 -0
  70. levelfour/spending/client.py +437 -0
  71. levelfour/spending/raw_client.py +684 -0
  72. levelfour/spending/types/__init__.py +34 -0
  73. levelfour/spending/types/list_breakdown_spending_response.py +12 -0
  74. levelfour/types/__init__.py +413 -0
  75. levelfour/types/accept_terms_data.py +25 -0
  76. levelfour/types/accept_terms_response.py +27 -0
  77. levelfour/types/action_request.py +42 -0
  78. levelfour/types/api_key_created_data.py +28 -0
  79. levelfour/types/api_key_data.py +27 -0
  80. levelfour/types/authentication_error.py +5 -0
  81. levelfour/types/authorization_error.py +5 -0
  82. levelfour/types/bad_request_error.py +5 -0
  83. levelfour/types/comparison_item.py +32 -0
  84. levelfour/types/complete_wizard_data.py +27 -0
  85. levelfour/types/complete_wizard_response.py +27 -0
  86. levelfour/types/conflict_error.py +5 -0
  87. levelfour/types/cost_breakdown_data.py +35 -0
  88. levelfour/types/cost_breakdown_item.py +71 -0
  89. levelfour/types/cost_breakdown_raw_data.py +37 -0
  90. levelfour/types/cost_breakdown_raw_response.py +27 -0
  91. levelfour/types/cost_breakdown_response.py +27 -0
  92. levelfour/types/costs_breakdown_chart_data.py +48 -0
  93. levelfour/types/costs_breakdown_chart_response.py +27 -0
  94. levelfour/types/costs_breakdown_data_point.py +46 -0
  95. levelfour/types/costs_breakdown_grouped_chart_data.py +52 -0
  96. levelfour/types/costs_breakdown_grouped_chart_response.py +27 -0
  97. levelfour/types/costs_breakdown_grouped_data_point.py +36 -0
  98. levelfour/types/costs_breakdown_totals.py +41 -0
  99. levelfour/types/create_api_key_response.py +23 -0
  100. levelfour/types/daily_spending_breakdown_data.py +42 -0
  101. levelfour/types/daily_spending_breakdown_response.py +27 -0
  102. levelfour/types/daily_spending_data_point.py +31 -0
  103. levelfour/types/dashboard_summary_data.py +72 -0
  104. levelfour/types/dashboard_summary_response.py +27 -0
  105. levelfour/types/delete_endpoint_data.py +20 -0
  106. levelfour/types/delete_endpoint_response.py +23 -0
  107. levelfour/types/endpoint_data.py +23 -0
  108. levelfour/types/error_response.py +23 -0
  109. levelfour/types/error_response_error.py +21 -0
  110. levelfour/types/evaluation_status_data.py +71 -0
  111. levelfour/types/evaluation_status_response.py +27 -0
  112. levelfour/types/execution_log_command.py +21 -0
  113. levelfour/types/execution_log_entry.py +23 -0
  114. levelfour/types/execution_step_schema.py +23 -0
  115. levelfour/types/http_validation_error.py +20 -0
  116. levelfour/types/implementation_method_data.py +25 -0
  117. levelfour/types/implementation_method_response.py +27 -0
  118. levelfour/types/implementation_step.py +27 -0
  119. levelfour/types/internal_server_error.py +5 -0
  120. levelfour/types/list_api_keys_data.py +21 -0
  121. levelfour/types/list_api_keys_response.py +23 -0
  122. levelfour/types/list_endpoints_response.py +23 -0
  123. levelfour/types/metric_data_point.py +27 -0
  124. levelfour/types/metric_series.py +40 -0
  125. levelfour/types/metric_series_entry.py +25 -0
  126. levelfour/types/monthly_spending_data.py +27 -0
  127. levelfour/types/monthly_spending_data_point.py +31 -0
  128. levelfour/types/monthly_spending_response.py +27 -0
  129. levelfour/types/not_found_error.py +5 -0
  130. levelfour/types/pagination_meta.py +51 -0
  131. levelfour/types/processing_recommendation_item.py +61 -0
  132. levelfour/types/processing_recommendations_data.py +28 -0
  133. levelfour/types/processing_recommendations_response.py +27 -0
  134. levelfour/types/provider.py +46 -0
  135. levelfour/types/provider_breakdown_data.py +31 -0
  136. levelfour/types/provider_breakdown_item.py +77 -0
  137. levelfour/types/provider_breakdown_response.py +27 -0
  138. levelfour/types/provider_filter_options_data.py +51 -0
  139. levelfour/types/provider_filter_options_response.py +27 -0
  140. levelfour/types/provider_potential_savings_summary_data.py +46 -0
  141. levelfour/types/provider_potential_savings_summary_response.py +27 -0
  142. levelfour/types/provider_recommendations_summary_data.py +37 -0
  143. levelfour/types/provider_recommendations_summary_response.py +27 -0
  144. levelfour/types/provider_saved_summary_data.py +56 -0
  145. levelfour/types/provider_saved_summary_response.py +27 -0
  146. levelfour/types/provider_service_breakdown_data.py +65 -0
  147. levelfour/types/provider_service_breakdown_item.py +72 -0
  148. levelfour/types/provider_service_breakdown_raw_data.py +62 -0
  149. levelfour/types/provider_service_breakdown_raw_response.py +27 -0
  150. levelfour/types/provider_service_breakdown_response.py +27 -0
  151. levelfour/types/provider_service_costs_breakdown_data.py +62 -0
  152. levelfour/types/provider_service_costs_breakdown_response.py +27 -0
  153. levelfour/types/provider_service_costs_data_point.py +36 -0
  154. levelfour/types/provider_spending.py +61 -0
  155. levelfour/types/provider_spending_summary_data.py +67 -0
  156. levelfour/types/provider_spending_summary_response.py +27 -0
  157. levelfour/types/provider_timeline_data.py +57 -0
  158. levelfour/types/provider_timeline_response.py +27 -0
  159. levelfour/types/provider_top_service.py +36 -0
  160. levelfour/types/providers_summary_data.py +24 -0
  161. levelfour/types/providers_summary_response.py +27 -0
  162. levelfour/types/rate_limit_error.py +5 -0
  163. levelfour/types/recommendation_actions.py +60 -0
  164. levelfour/types/recommendation_detail.py +42 -0
  165. levelfour/types/recommendation_detail_response.py +27 -0
  166. levelfour/types/recommendation_filter_options_data.py +41 -0
  167. levelfour/types/recommendation_filter_options_response.py +27 -0
  168. levelfour/types/recommendation_item.py +36 -0
  169. levelfour/types/recommendation_wizard_data.py +173 -0
  170. levelfour/types/recommendation_wizard_data_metrics.py +7 -0
  171. levelfour/types/recommendation_wizard_response.py +27 -0
  172. levelfour/types/recommendations_breakdown_data.py +26 -0
  173. levelfour/types/recommendations_breakdown_response.py +27 -0
  174. levelfour/types/recommendations_overview_data.py +51 -0
  175. levelfour/types/recommendations_overview_response.py +27 -0
  176. levelfour/types/register_endpoint_response.py +23 -0
  177. levelfour/types/resource_change.py +42 -0
  178. levelfour/types/resource_snapshot.py +21 -0
  179. levelfour/types/revoke_api_key_data.py +20 -0
  180. levelfour/types/revoke_api_key_response.py +23 -0
  181. levelfour/types/risk_assessment.py +29 -0
  182. levelfour/types/risk_factor.py +27 -0
  183. levelfour/types/saved_breakdown_data.py +31 -0
  184. levelfour/types/saved_breakdown_response.py +27 -0
  185. levelfour/types/saved_by_provider_breakdown_data.py +31 -0
  186. levelfour/types/saved_by_provider_breakdown_response.py +27 -0
  187. levelfour/types/saved_by_provider_item.py +76 -0
  188. levelfour/types/saved_item.py +35 -0
  189. levelfour/types/saved_provider_summary.py +36 -0
  190. levelfour/types/saved_summary_data.py +57 -0
  191. levelfour/types/saved_summary_response.py +27 -0
  192. levelfour/types/savings_decision_data.py +28 -0
  193. levelfour/types/savings_decision_response.py +27 -0
  194. levelfour/types/spending_by_date_item.py +36 -0
  195. levelfour/types/top_recommendation.py +56 -0
  196. levelfour/types/trigger_info.py +22 -0
  197. levelfour/types/update_tag_data.py +20 -0
  198. levelfour/types/update_tag_response.py +23 -0
  199. levelfour/types/validation_error.py +24 -0
  200. levelfour/types/validation_error_loc_item.py +5 -0
  201. levelfour/webhooks/__init__.py +4 -0
  202. levelfour/webhooks/client.py +273 -0
  203. levelfour/webhooks/raw_client.py +483 -0
  204. levelfour/webhooks/verifier.py +61 -0
  205. levelfour-0.1.0.dist-info/METADATA +12 -0
  206. levelfour-0.1.0.dist-info/RECORD +208 -0
  207. levelfour-0.1.0.dist-info/WHEEL +5 -0
  208. levelfour-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,337 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from ..core.request_options import RequestOptions
8
+ from ..types.create_api_key_response import CreateApiKeyResponse
9
+ from ..types.list_api_keys_response import ListApiKeysResponse
10
+ from ..types.revoke_api_key_response import RevokeApiKeyResponse
11
+ from .raw_client import AsyncRawApiKeysClient, RawApiKeysClient
12
+ from .types.create_api_key_request_scope import CreateApiKeyRequestScope
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class ApiKeysClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawApiKeysClient(client_wrapper=client_wrapper)
21
+
22
+ @property
23
+ def with_raw_response(self) -> RawApiKeysClient:
24
+ """
25
+ Retrieves a raw implementation of this client that returns raw responses.
26
+
27
+ Returns
28
+ -------
29
+ RawApiKeysClient
30
+ """
31
+ return self._raw_client
32
+
33
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListApiKeysResponse:
34
+ """
35
+ Parameters
36
+ ----------
37
+ request_options : typing.Optional[RequestOptions]
38
+ Request-specific configuration.
39
+
40
+ Returns
41
+ -------
42
+ ListApiKeysResponse
43
+ Successful Response
44
+
45
+ Examples
46
+ --------
47
+ from levelfour import BaseLevelFour
48
+
49
+ client = BaseLevelFour(
50
+ token="YOUR_TOKEN",
51
+ base_url="https://yourhost.com/path/to/api",
52
+ )
53
+ client.api_keys.list()
54
+ """
55
+ _response = self._raw_client.list(request_options=request_options)
56
+ return _response.data
57
+
58
+ def create(
59
+ self,
60
+ *,
61
+ name: str,
62
+ scope: typing.Optional[CreateApiKeyRequestScope] = OMIT,
63
+ expires_at: typing.Optional[dt.datetime] = OMIT,
64
+ request_options: typing.Optional[RequestOptions] = None,
65
+ ) -> CreateApiKeyResponse:
66
+ """
67
+ Parameters
68
+ ----------
69
+ name : str
70
+
71
+ scope : typing.Optional[CreateApiKeyRequestScope]
72
+
73
+ expires_at : typing.Optional[dt.datetime]
74
+
75
+ request_options : typing.Optional[RequestOptions]
76
+ Request-specific configuration.
77
+
78
+ Returns
79
+ -------
80
+ CreateApiKeyResponse
81
+ Successful Response
82
+
83
+ Examples
84
+ --------
85
+ from levelfour import BaseLevelFour
86
+
87
+ client = BaseLevelFour(
88
+ token="YOUR_TOKEN",
89
+ base_url="https://yourhost.com/path/to/api",
90
+ )
91
+ client.api_keys.create(
92
+ name="name",
93
+ )
94
+ """
95
+ _response = self._raw_client.create(
96
+ name=name, scope=scope, expires_at=expires_at, request_options=request_options
97
+ )
98
+ return _response.data
99
+
100
+ def revoke(self, key_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> RevokeApiKeyResponse:
101
+ """
102
+ Parameters
103
+ ----------
104
+ key_id : str
105
+ API key UUID
106
+
107
+ request_options : typing.Optional[RequestOptions]
108
+ Request-specific configuration.
109
+
110
+ Returns
111
+ -------
112
+ RevokeApiKeyResponse
113
+ Successful Response
114
+
115
+ Examples
116
+ --------
117
+ from levelfour import BaseLevelFour
118
+
119
+ client = BaseLevelFour(
120
+ token="YOUR_TOKEN",
121
+ base_url="https://yourhost.com/path/to/api",
122
+ )
123
+ client.api_keys.revoke(
124
+ key_id="key_id",
125
+ )
126
+ """
127
+ _response = self._raw_client.revoke(key_id, request_options=request_options)
128
+ return _response.data
129
+
130
+ def rotate(self, key_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> CreateApiKeyResponse:
131
+ """
132
+ Parameters
133
+ ----------
134
+ key_id : str
135
+ API key UUID to rotate
136
+
137
+ request_options : typing.Optional[RequestOptions]
138
+ Request-specific configuration.
139
+
140
+ Returns
141
+ -------
142
+ CreateApiKeyResponse
143
+ Successful Response
144
+
145
+ Examples
146
+ --------
147
+ from levelfour import BaseLevelFour
148
+
149
+ client = BaseLevelFour(
150
+ token="YOUR_TOKEN",
151
+ base_url="https://yourhost.com/path/to/api",
152
+ )
153
+ client.api_keys.rotate(
154
+ key_id="key_id",
155
+ )
156
+ """
157
+ _response = self._raw_client.rotate(key_id, request_options=request_options)
158
+ return _response.data
159
+
160
+
161
+ class AsyncApiKeysClient:
162
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
163
+ self._raw_client = AsyncRawApiKeysClient(client_wrapper=client_wrapper)
164
+
165
+ @property
166
+ def with_raw_response(self) -> AsyncRawApiKeysClient:
167
+ """
168
+ Retrieves a raw implementation of this client that returns raw responses.
169
+
170
+ Returns
171
+ -------
172
+ AsyncRawApiKeysClient
173
+ """
174
+ return self._raw_client
175
+
176
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListApiKeysResponse:
177
+ """
178
+ Parameters
179
+ ----------
180
+ request_options : typing.Optional[RequestOptions]
181
+ Request-specific configuration.
182
+
183
+ Returns
184
+ -------
185
+ ListApiKeysResponse
186
+ Successful Response
187
+
188
+ Examples
189
+ --------
190
+ import asyncio
191
+
192
+ from levelfour import AsyncBaseLevelFour
193
+
194
+ client = AsyncBaseLevelFour(
195
+ token="YOUR_TOKEN",
196
+ base_url="https://yourhost.com/path/to/api",
197
+ )
198
+
199
+
200
+ async def main() -> None:
201
+ await client.api_keys.list()
202
+
203
+
204
+ asyncio.run(main())
205
+ """
206
+ _response = await self._raw_client.list(request_options=request_options)
207
+ return _response.data
208
+
209
+ async def create(
210
+ self,
211
+ *,
212
+ name: str,
213
+ scope: typing.Optional[CreateApiKeyRequestScope] = OMIT,
214
+ expires_at: typing.Optional[dt.datetime] = OMIT,
215
+ request_options: typing.Optional[RequestOptions] = None,
216
+ ) -> CreateApiKeyResponse:
217
+ """
218
+ Parameters
219
+ ----------
220
+ name : str
221
+
222
+ scope : typing.Optional[CreateApiKeyRequestScope]
223
+
224
+ expires_at : typing.Optional[dt.datetime]
225
+
226
+ request_options : typing.Optional[RequestOptions]
227
+ Request-specific configuration.
228
+
229
+ Returns
230
+ -------
231
+ CreateApiKeyResponse
232
+ Successful Response
233
+
234
+ Examples
235
+ --------
236
+ import asyncio
237
+
238
+ from levelfour import AsyncBaseLevelFour
239
+
240
+ client = AsyncBaseLevelFour(
241
+ token="YOUR_TOKEN",
242
+ base_url="https://yourhost.com/path/to/api",
243
+ )
244
+
245
+
246
+ async def main() -> None:
247
+ await client.api_keys.create(
248
+ name="name",
249
+ )
250
+
251
+
252
+ asyncio.run(main())
253
+ """
254
+ _response = await self._raw_client.create(
255
+ name=name, scope=scope, expires_at=expires_at, request_options=request_options
256
+ )
257
+ return _response.data
258
+
259
+ async def revoke(
260
+ self, key_id: str, *, request_options: typing.Optional[RequestOptions] = None
261
+ ) -> RevokeApiKeyResponse:
262
+ """
263
+ Parameters
264
+ ----------
265
+ key_id : str
266
+ API key UUID
267
+
268
+ request_options : typing.Optional[RequestOptions]
269
+ Request-specific configuration.
270
+
271
+ Returns
272
+ -------
273
+ RevokeApiKeyResponse
274
+ Successful Response
275
+
276
+ Examples
277
+ --------
278
+ import asyncio
279
+
280
+ from levelfour import AsyncBaseLevelFour
281
+
282
+ client = AsyncBaseLevelFour(
283
+ token="YOUR_TOKEN",
284
+ base_url="https://yourhost.com/path/to/api",
285
+ )
286
+
287
+
288
+ async def main() -> None:
289
+ await client.api_keys.revoke(
290
+ key_id="key_id",
291
+ )
292
+
293
+
294
+ asyncio.run(main())
295
+ """
296
+ _response = await self._raw_client.revoke(key_id, request_options=request_options)
297
+ return _response.data
298
+
299
+ async def rotate(
300
+ self, key_id: str, *, request_options: typing.Optional[RequestOptions] = None
301
+ ) -> CreateApiKeyResponse:
302
+ """
303
+ Parameters
304
+ ----------
305
+ key_id : str
306
+ API key UUID to rotate
307
+
308
+ request_options : typing.Optional[RequestOptions]
309
+ Request-specific configuration.
310
+
311
+ Returns
312
+ -------
313
+ CreateApiKeyResponse
314
+ Successful Response
315
+
316
+ Examples
317
+ --------
318
+ import asyncio
319
+
320
+ from levelfour import AsyncBaseLevelFour
321
+
322
+ client = AsyncBaseLevelFour(
323
+ token="YOUR_TOKEN",
324
+ base_url="https://yourhost.com/path/to/api",
325
+ )
326
+
327
+
328
+ async def main() -> None:
329
+ await client.api_keys.rotate(
330
+ key_id="key_id",
331
+ )
332
+
333
+
334
+ asyncio.run(main())
335
+ """
336
+ _response = await self._raw_client.rotate(key_id, request_options=request_options)
337
+ return _response.data