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,1018 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.pagination import AsyncPager, SyncPager
7
+ from ..core.request_options import RequestOptions
8
+ from ..types.accept_terms_response import AcceptTermsResponse
9
+ from ..types.complete_wizard_response import CompleteWizardResponse
10
+ from ..types.implementation_method_response import ImplementationMethodResponse
11
+ from ..types.processing_recommendations_response import ProcessingRecommendationsResponse
12
+ from ..types.providers_summary_response import ProvidersSummaryResponse
13
+ from ..types.recommendation_detail_response import RecommendationDetailResponse
14
+ from ..types.recommendation_item import RecommendationItem
15
+ from ..types.recommendation_wizard_response import RecommendationWizardResponse
16
+ from ..types.recommendations_breakdown_response import RecommendationsBreakdownResponse
17
+ from ..types.recommendations_overview_response import RecommendationsOverviewResponse
18
+ from ..types.savings_decision_response import SavingsDecisionResponse
19
+ from ..types.update_tag_response import UpdateTagResponse
20
+ from .raw_client import AsyncRawRecommendationsClient, RawRecommendationsClient
21
+
22
+ # this is used as the default value for optional parameters
23
+ OMIT = typing.cast(typing.Any, ...)
24
+
25
+
26
+ class RecommendationsClient:
27
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
28
+ self._raw_client = RawRecommendationsClient(client_wrapper=client_wrapper)
29
+
30
+ @property
31
+ def with_raw_response(self) -> RawRecommendationsClient:
32
+ """
33
+ Retrieves a raw implementation of this client that returns raw responses.
34
+
35
+ Returns
36
+ -------
37
+ RawRecommendationsClient
38
+ """
39
+ return self._raw_client
40
+
41
+ def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> ProvidersSummaryResponse:
42
+ """
43
+ Returns provider-level aggregation for the carousel view (AWS, GCP, Azure, K8s)
44
+
45
+ Parameters
46
+ ----------
47
+ request_options : typing.Optional[RequestOptions]
48
+ Request-specific configuration.
49
+
50
+ Returns
51
+ -------
52
+ ProvidersSummaryResponse
53
+ Successful Response
54
+
55
+ Examples
56
+ --------
57
+ from levelfour import BaseLevelFour
58
+
59
+ client = BaseLevelFour(
60
+ token="YOUR_TOKEN",
61
+ base_url="https://yourhost.com/path/to/api",
62
+ )
63
+ client.recommendations.get_summary()
64
+ """
65
+ _response = self._raw_client.get_summary(request_options=request_options)
66
+ return _response.data
67
+
68
+ def get_potential_savings_summary(
69
+ self, *, request_options: typing.Optional[RequestOptions] = None
70
+ ) -> ProvidersSummaryResponse:
71
+ """
72
+ Returns potential savings summary grouped by provider (from dashboard_potential_savings)
73
+
74
+ Parameters
75
+ ----------
76
+ request_options : typing.Optional[RequestOptions]
77
+ Request-specific configuration.
78
+
79
+ Returns
80
+ -------
81
+ ProvidersSummaryResponse
82
+ Successful Response
83
+
84
+ Examples
85
+ --------
86
+ from levelfour import BaseLevelFour
87
+
88
+ client = BaseLevelFour(
89
+ token="YOUR_TOKEN",
90
+ base_url="https://yourhost.com/path/to/api",
91
+ )
92
+ client.recommendations.get_potential_savings_summary()
93
+ """
94
+ _response = self._raw_client.get_potential_savings_summary(request_options=request_options)
95
+ return _response.data
96
+
97
+ def list(
98
+ self,
99
+ *,
100
+ page: typing.Optional[int] = None,
101
+ page_size: typing.Optional[int] = None,
102
+ sort_by: typing.Optional[str] = None,
103
+ sort_order: typing.Optional[str] = None,
104
+ request_options: typing.Optional[RequestOptions] = None,
105
+ ) -> SyncPager[RecommendationItem, RecommendationsBreakdownResponse]:
106
+ """
107
+ Returns paginated list of all recommendations with actions
108
+
109
+ Parameters
110
+ ----------
111
+ page : typing.Optional[int]
112
+ Page number (1-indexed)
113
+
114
+ page_size : typing.Optional[int]
115
+ Items per page (max 100)
116
+
117
+ sort_by : typing.Optional[str]
118
+ Field to sort by (recommendation_id, service, environment, monthly_savings, annual_savings, savings_percentage, analysis_period, created_at)
119
+
120
+ sort_order : typing.Optional[str]
121
+ Sort order (asc or desc)
122
+
123
+ request_options : typing.Optional[RequestOptions]
124
+ Request-specific configuration.
125
+
126
+ Returns
127
+ -------
128
+ SyncPager[RecommendationItem, RecommendationsBreakdownResponse]
129
+ Successful Response
130
+
131
+ Examples
132
+ --------
133
+ from levelfour import BaseLevelFour
134
+
135
+ client = BaseLevelFour(
136
+ token="YOUR_TOKEN",
137
+ base_url="https://yourhost.com/path/to/api",
138
+ )
139
+ response = client.recommendations.list()
140
+ for item in response:
141
+ yield item
142
+ # alternatively, you can paginate page-by-page
143
+ for page in response.iter_pages():
144
+ yield page
145
+ """
146
+ return self._raw_client.list(
147
+ page=page, page_size=page_size, sort_by=sort_by, sort_order=sort_order, request_options=request_options
148
+ )
149
+
150
+ def get_overview(
151
+ self, *, request_options: typing.Optional[RequestOptions] = None
152
+ ) -> RecommendationsOverviewResponse:
153
+ """
154
+ Returns recommendations overview metrics across all providers (for dashboard)
155
+
156
+ Parameters
157
+ ----------
158
+ request_options : typing.Optional[RequestOptions]
159
+ Request-specific configuration.
160
+
161
+ Returns
162
+ -------
163
+ RecommendationsOverviewResponse
164
+ Successful Response
165
+
166
+ Examples
167
+ --------
168
+ from levelfour import BaseLevelFour
169
+
170
+ client = BaseLevelFour(
171
+ token="YOUR_TOKEN",
172
+ base_url="https://yourhost.com/path/to/api",
173
+ )
174
+ client.recommendations.get_overview()
175
+ """
176
+ _response = self._raw_client.get_overview(request_options=request_options)
177
+ return _response.data
178
+
179
+ def get_processing(
180
+ self, *, request_options: typing.Optional[RequestOptions] = None
181
+ ) -> ProcessingRecommendationsResponse:
182
+ """
183
+ Returns all recommendations currently in processing status
184
+
185
+ Parameters
186
+ ----------
187
+ request_options : typing.Optional[RequestOptions]
188
+ Request-specific configuration.
189
+
190
+ Returns
191
+ -------
192
+ ProcessingRecommendationsResponse
193
+ Successful Response
194
+
195
+ Examples
196
+ --------
197
+ from levelfour import BaseLevelFour
198
+
199
+ client = BaseLevelFour(
200
+ token="YOUR_TOKEN",
201
+ base_url="https://yourhost.com/path/to/api",
202
+ )
203
+ client.recommendations.get_processing()
204
+ """
205
+ _response = self._raw_client.get_processing(request_options=request_options)
206
+ return _response.data
207
+
208
+ def get_details(
209
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
210
+ ) -> RecommendationDetailResponse:
211
+ """
212
+ Returns complete details for a specific recommendation
213
+
214
+ Parameters
215
+ ----------
216
+ recommendation_id : str
217
+
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ RecommendationDetailResponse
224
+ Successful Response
225
+
226
+ Examples
227
+ --------
228
+ from levelfour import BaseLevelFour
229
+
230
+ client = BaseLevelFour(
231
+ token="YOUR_TOKEN",
232
+ base_url="https://yourhost.com/path/to/api",
233
+ )
234
+ client.recommendations.get_details(
235
+ recommendation_id="recommendation_id",
236
+ )
237
+ """
238
+ _response = self._raw_client.get_details(recommendation_id, request_options=request_options)
239
+ return _response.data
240
+
241
+ def get_wizard(
242
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
243
+ ) -> RecommendationWizardResponse:
244
+ """
245
+ Returns recommendation details for the Save Now wizard flow
246
+
247
+ Parameters
248
+ ----------
249
+ recommendation_id : str
250
+
251
+ request_options : typing.Optional[RequestOptions]
252
+ Request-specific configuration.
253
+
254
+ Returns
255
+ -------
256
+ RecommendationWizardResponse
257
+ Successful Response
258
+
259
+ Examples
260
+ --------
261
+ from levelfour import BaseLevelFour
262
+
263
+ client = BaseLevelFour(
264
+ token="YOUR_TOKEN",
265
+ base_url="https://yourhost.com/path/to/api",
266
+ )
267
+ client.recommendations.get_wizard(
268
+ recommendation_id="recommendation_id",
269
+ )
270
+ """
271
+ _response = self._raw_client.get_wizard(recommendation_id, request_options=request_options)
272
+ return _response.data
273
+
274
+ def accept_terms(
275
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
276
+ ) -> AcceptTermsResponse:
277
+ """
278
+ Records user acceptance of terms and conditions for a recommendation
279
+
280
+ Parameters
281
+ ----------
282
+ recommendation_id : str
283
+
284
+ request_options : typing.Optional[RequestOptions]
285
+ Request-specific configuration.
286
+
287
+ Returns
288
+ -------
289
+ AcceptTermsResponse
290
+ Successful Response
291
+
292
+ Examples
293
+ --------
294
+ from levelfour import BaseLevelFour
295
+
296
+ client = BaseLevelFour(
297
+ token="YOUR_TOKEN",
298
+ base_url="https://yourhost.com/path/to/api",
299
+ )
300
+ client.recommendations.accept_terms(
301
+ recommendation_id="recommendation_id",
302
+ )
303
+ """
304
+ _response = self._raw_client.accept_terms(recommendation_id, request_options=request_options)
305
+ return _response.data
306
+
307
+ def update_tag(
308
+ self,
309
+ recommendation_id: str,
310
+ *,
311
+ tag: typing.Optional[str] = OMIT,
312
+ request_options: typing.Optional[RequestOptions] = None,
313
+ ) -> UpdateTagResponse:
314
+ """
315
+ Updates the tag value for a recommendation
316
+
317
+ Parameters
318
+ ----------
319
+ recommendation_id : str
320
+
321
+ tag : typing.Optional[str]
322
+ New tag value. Send null to clear.
323
+
324
+ request_options : typing.Optional[RequestOptions]
325
+ Request-specific configuration.
326
+
327
+ Returns
328
+ -------
329
+ UpdateTagResponse
330
+ Successful Response
331
+
332
+ Examples
333
+ --------
334
+ from levelfour import BaseLevelFour
335
+
336
+ client = BaseLevelFour(
337
+ token="YOUR_TOKEN",
338
+ base_url="https://yourhost.com/path/to/api",
339
+ )
340
+ client.recommendations.update_tag(
341
+ recommendation_id="recommendation_id",
342
+ )
343
+ """
344
+ _response = self._raw_client.update_tag(recommendation_id, tag=tag, request_options=request_options)
345
+ return _response.data
346
+
347
+ def make_decision(
348
+ self,
349
+ recommendation_id: str,
350
+ *,
351
+ decision: str,
352
+ reason: typing.Optional[str] = OMIT,
353
+ explanation: typing.Optional[str] = OMIT,
354
+ request_options: typing.Optional[RequestOptions] = None,
355
+ ) -> SavingsDecisionResponse:
356
+ """
357
+ Records user decision to accept or reject a savings recommendation
358
+
359
+ Parameters
360
+ ----------
361
+ recommendation_id : str
362
+
363
+ decision : str
364
+ Decision: 'accepted' or 'rejected'
365
+
366
+ reason : typing.Optional[str]
367
+ Rejection reason: operational, strategy, not_applicable, other (required if rejected)
368
+
369
+ explanation : typing.Optional[str]
370
+ Free text explanation (optional, used when reason is 'other')
371
+
372
+ request_options : typing.Optional[RequestOptions]
373
+ Request-specific configuration.
374
+
375
+ Returns
376
+ -------
377
+ SavingsDecisionResponse
378
+ Successful Response
379
+
380
+ Examples
381
+ --------
382
+ from levelfour import BaseLevelFour
383
+
384
+ client = BaseLevelFour(
385
+ token="YOUR_TOKEN",
386
+ base_url="https://yourhost.com/path/to/api",
387
+ )
388
+ client.recommendations.make_decision(
389
+ recommendation_id="recommendation_id",
390
+ decision="decision",
391
+ )
392
+ """
393
+ _response = self._raw_client.make_decision(
394
+ recommendation_id,
395
+ decision=decision,
396
+ reason=reason,
397
+ explanation=explanation,
398
+ request_options=request_options,
399
+ )
400
+ return _response.data
401
+
402
+ def set_implementation(
403
+ self, recommendation_id: str, *, method: str, request_options: typing.Optional[RequestOptions] = None
404
+ ) -> ImplementationMethodResponse:
405
+ """
406
+ Records the chosen implementation method for a recommendation
407
+
408
+ Parameters
409
+ ----------
410
+ recommendation_id : str
411
+
412
+ method : str
413
+ Implementation method: 'one-click', 'iac', 'one-click-plus-iac', 'manual'
414
+
415
+ request_options : typing.Optional[RequestOptions]
416
+ Request-specific configuration.
417
+
418
+ Returns
419
+ -------
420
+ ImplementationMethodResponse
421
+ Successful Response
422
+
423
+ Examples
424
+ --------
425
+ from levelfour import BaseLevelFour
426
+
427
+ client = BaseLevelFour(
428
+ token="YOUR_TOKEN",
429
+ base_url="https://yourhost.com/path/to/api",
430
+ )
431
+ client.recommendations.set_implementation(
432
+ recommendation_id="recommendation_id",
433
+ method="method",
434
+ )
435
+ """
436
+ _response = self._raw_client.set_implementation(
437
+ recommendation_id, method=method, request_options=request_options
438
+ )
439
+ return _response.data
440
+
441
+ def complete_wizard(
442
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
443
+ ) -> CompleteWizardResponse:
444
+ """
445
+ Completes the wizard flow and triggers the appropriate workflow
446
+
447
+ Parameters
448
+ ----------
449
+ recommendation_id : str
450
+
451
+ request_options : typing.Optional[RequestOptions]
452
+ Request-specific configuration.
453
+
454
+ Returns
455
+ -------
456
+ CompleteWizardResponse
457
+ Successful Response
458
+
459
+ Examples
460
+ --------
461
+ from levelfour import BaseLevelFour
462
+
463
+ client = BaseLevelFour(
464
+ token="YOUR_TOKEN",
465
+ base_url="https://yourhost.com/path/to/api",
466
+ )
467
+ client.recommendations.complete_wizard(
468
+ recommendation_id="recommendation_id",
469
+ )
470
+ """
471
+ _response = self._raw_client.complete_wizard(recommendation_id, request_options=request_options)
472
+ return _response.data
473
+
474
+
475
+ class AsyncRecommendationsClient:
476
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
477
+ self._raw_client = AsyncRawRecommendationsClient(client_wrapper=client_wrapper)
478
+
479
+ @property
480
+ def with_raw_response(self) -> AsyncRawRecommendationsClient:
481
+ """
482
+ Retrieves a raw implementation of this client that returns raw responses.
483
+
484
+ Returns
485
+ -------
486
+ AsyncRawRecommendationsClient
487
+ """
488
+ return self._raw_client
489
+
490
+ async def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> ProvidersSummaryResponse:
491
+ """
492
+ Returns provider-level aggregation for the carousel view (AWS, GCP, Azure, K8s)
493
+
494
+ Parameters
495
+ ----------
496
+ request_options : typing.Optional[RequestOptions]
497
+ Request-specific configuration.
498
+
499
+ Returns
500
+ -------
501
+ ProvidersSummaryResponse
502
+ Successful Response
503
+
504
+ Examples
505
+ --------
506
+ import asyncio
507
+
508
+ from levelfour import AsyncBaseLevelFour
509
+
510
+ client = AsyncBaseLevelFour(
511
+ token="YOUR_TOKEN",
512
+ base_url="https://yourhost.com/path/to/api",
513
+ )
514
+
515
+
516
+ async def main() -> None:
517
+ await client.recommendations.get_summary()
518
+
519
+
520
+ asyncio.run(main())
521
+ """
522
+ _response = await self._raw_client.get_summary(request_options=request_options)
523
+ return _response.data
524
+
525
+ async def get_potential_savings_summary(
526
+ self, *, request_options: typing.Optional[RequestOptions] = None
527
+ ) -> ProvidersSummaryResponse:
528
+ """
529
+ Returns potential savings summary grouped by provider (from dashboard_potential_savings)
530
+
531
+ Parameters
532
+ ----------
533
+ request_options : typing.Optional[RequestOptions]
534
+ Request-specific configuration.
535
+
536
+ Returns
537
+ -------
538
+ ProvidersSummaryResponse
539
+ Successful Response
540
+
541
+ Examples
542
+ --------
543
+ import asyncio
544
+
545
+ from levelfour import AsyncBaseLevelFour
546
+
547
+ client = AsyncBaseLevelFour(
548
+ token="YOUR_TOKEN",
549
+ base_url="https://yourhost.com/path/to/api",
550
+ )
551
+
552
+
553
+ async def main() -> None:
554
+ await client.recommendations.get_potential_savings_summary()
555
+
556
+
557
+ asyncio.run(main())
558
+ """
559
+ _response = await self._raw_client.get_potential_savings_summary(request_options=request_options)
560
+ return _response.data
561
+
562
+ async def list(
563
+ self,
564
+ *,
565
+ page: typing.Optional[int] = None,
566
+ page_size: typing.Optional[int] = None,
567
+ sort_by: typing.Optional[str] = None,
568
+ sort_order: typing.Optional[str] = None,
569
+ request_options: typing.Optional[RequestOptions] = None,
570
+ ) -> AsyncPager[RecommendationItem, RecommendationsBreakdownResponse]:
571
+ """
572
+ Returns paginated list of all recommendations with actions
573
+
574
+ Parameters
575
+ ----------
576
+ page : typing.Optional[int]
577
+ Page number (1-indexed)
578
+
579
+ page_size : typing.Optional[int]
580
+ Items per page (max 100)
581
+
582
+ sort_by : typing.Optional[str]
583
+ Field to sort by (recommendation_id, service, environment, monthly_savings, annual_savings, savings_percentage, analysis_period, created_at)
584
+
585
+ sort_order : typing.Optional[str]
586
+ Sort order (asc or desc)
587
+
588
+ request_options : typing.Optional[RequestOptions]
589
+ Request-specific configuration.
590
+
591
+ Returns
592
+ -------
593
+ AsyncPager[RecommendationItem, RecommendationsBreakdownResponse]
594
+ Successful Response
595
+
596
+ Examples
597
+ --------
598
+ import asyncio
599
+
600
+ from levelfour import AsyncBaseLevelFour
601
+
602
+ client = AsyncBaseLevelFour(
603
+ token="YOUR_TOKEN",
604
+ base_url="https://yourhost.com/path/to/api",
605
+ )
606
+
607
+
608
+ async def main() -> None:
609
+ response = await client.recommendations.list()
610
+ async for item in response:
611
+ yield item
612
+
613
+ # alternatively, you can paginate page-by-page
614
+ async for page in response.iter_pages():
615
+ yield page
616
+
617
+
618
+ asyncio.run(main())
619
+ """
620
+ return await self._raw_client.list(
621
+ page=page, page_size=page_size, sort_by=sort_by, sort_order=sort_order, request_options=request_options
622
+ )
623
+
624
+ async def get_overview(
625
+ self, *, request_options: typing.Optional[RequestOptions] = None
626
+ ) -> RecommendationsOverviewResponse:
627
+ """
628
+ Returns recommendations overview metrics across all providers (for dashboard)
629
+
630
+ Parameters
631
+ ----------
632
+ request_options : typing.Optional[RequestOptions]
633
+ Request-specific configuration.
634
+
635
+ Returns
636
+ -------
637
+ RecommendationsOverviewResponse
638
+ Successful Response
639
+
640
+ Examples
641
+ --------
642
+ import asyncio
643
+
644
+ from levelfour import AsyncBaseLevelFour
645
+
646
+ client = AsyncBaseLevelFour(
647
+ token="YOUR_TOKEN",
648
+ base_url="https://yourhost.com/path/to/api",
649
+ )
650
+
651
+
652
+ async def main() -> None:
653
+ await client.recommendations.get_overview()
654
+
655
+
656
+ asyncio.run(main())
657
+ """
658
+ _response = await self._raw_client.get_overview(request_options=request_options)
659
+ return _response.data
660
+
661
+ async def get_processing(
662
+ self, *, request_options: typing.Optional[RequestOptions] = None
663
+ ) -> ProcessingRecommendationsResponse:
664
+ """
665
+ Returns all recommendations currently in processing status
666
+
667
+ Parameters
668
+ ----------
669
+ request_options : typing.Optional[RequestOptions]
670
+ Request-specific configuration.
671
+
672
+ Returns
673
+ -------
674
+ ProcessingRecommendationsResponse
675
+ Successful Response
676
+
677
+ Examples
678
+ --------
679
+ import asyncio
680
+
681
+ from levelfour import AsyncBaseLevelFour
682
+
683
+ client = AsyncBaseLevelFour(
684
+ token="YOUR_TOKEN",
685
+ base_url="https://yourhost.com/path/to/api",
686
+ )
687
+
688
+
689
+ async def main() -> None:
690
+ await client.recommendations.get_processing()
691
+
692
+
693
+ asyncio.run(main())
694
+ """
695
+ _response = await self._raw_client.get_processing(request_options=request_options)
696
+ return _response.data
697
+
698
+ async def get_details(
699
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
700
+ ) -> RecommendationDetailResponse:
701
+ """
702
+ Returns complete details for a specific recommendation
703
+
704
+ Parameters
705
+ ----------
706
+ recommendation_id : str
707
+
708
+ request_options : typing.Optional[RequestOptions]
709
+ Request-specific configuration.
710
+
711
+ Returns
712
+ -------
713
+ RecommendationDetailResponse
714
+ Successful Response
715
+
716
+ Examples
717
+ --------
718
+ import asyncio
719
+
720
+ from levelfour import AsyncBaseLevelFour
721
+
722
+ client = AsyncBaseLevelFour(
723
+ token="YOUR_TOKEN",
724
+ base_url="https://yourhost.com/path/to/api",
725
+ )
726
+
727
+
728
+ async def main() -> None:
729
+ await client.recommendations.get_details(
730
+ recommendation_id="recommendation_id",
731
+ )
732
+
733
+
734
+ asyncio.run(main())
735
+ """
736
+ _response = await self._raw_client.get_details(recommendation_id, request_options=request_options)
737
+ return _response.data
738
+
739
+ async def get_wizard(
740
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
741
+ ) -> RecommendationWizardResponse:
742
+ """
743
+ Returns recommendation details for the Save Now wizard flow
744
+
745
+ Parameters
746
+ ----------
747
+ recommendation_id : str
748
+
749
+ request_options : typing.Optional[RequestOptions]
750
+ Request-specific configuration.
751
+
752
+ Returns
753
+ -------
754
+ RecommendationWizardResponse
755
+ Successful Response
756
+
757
+ Examples
758
+ --------
759
+ import asyncio
760
+
761
+ from levelfour import AsyncBaseLevelFour
762
+
763
+ client = AsyncBaseLevelFour(
764
+ token="YOUR_TOKEN",
765
+ base_url="https://yourhost.com/path/to/api",
766
+ )
767
+
768
+
769
+ async def main() -> None:
770
+ await client.recommendations.get_wizard(
771
+ recommendation_id="recommendation_id",
772
+ )
773
+
774
+
775
+ asyncio.run(main())
776
+ """
777
+ _response = await self._raw_client.get_wizard(recommendation_id, request_options=request_options)
778
+ return _response.data
779
+
780
+ async def accept_terms(
781
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
782
+ ) -> AcceptTermsResponse:
783
+ """
784
+ Records user acceptance of terms and conditions for a recommendation
785
+
786
+ Parameters
787
+ ----------
788
+ recommendation_id : str
789
+
790
+ request_options : typing.Optional[RequestOptions]
791
+ Request-specific configuration.
792
+
793
+ Returns
794
+ -------
795
+ AcceptTermsResponse
796
+ Successful Response
797
+
798
+ Examples
799
+ --------
800
+ import asyncio
801
+
802
+ from levelfour import AsyncBaseLevelFour
803
+
804
+ client = AsyncBaseLevelFour(
805
+ token="YOUR_TOKEN",
806
+ base_url="https://yourhost.com/path/to/api",
807
+ )
808
+
809
+
810
+ async def main() -> None:
811
+ await client.recommendations.accept_terms(
812
+ recommendation_id="recommendation_id",
813
+ )
814
+
815
+
816
+ asyncio.run(main())
817
+ """
818
+ _response = await self._raw_client.accept_terms(recommendation_id, request_options=request_options)
819
+ return _response.data
820
+
821
+ async def update_tag(
822
+ self,
823
+ recommendation_id: str,
824
+ *,
825
+ tag: typing.Optional[str] = OMIT,
826
+ request_options: typing.Optional[RequestOptions] = None,
827
+ ) -> UpdateTagResponse:
828
+ """
829
+ Updates the tag value for a recommendation
830
+
831
+ Parameters
832
+ ----------
833
+ recommendation_id : str
834
+
835
+ tag : typing.Optional[str]
836
+ New tag value. Send null to clear.
837
+
838
+ request_options : typing.Optional[RequestOptions]
839
+ Request-specific configuration.
840
+
841
+ Returns
842
+ -------
843
+ UpdateTagResponse
844
+ Successful Response
845
+
846
+ Examples
847
+ --------
848
+ import asyncio
849
+
850
+ from levelfour import AsyncBaseLevelFour
851
+
852
+ client = AsyncBaseLevelFour(
853
+ token="YOUR_TOKEN",
854
+ base_url="https://yourhost.com/path/to/api",
855
+ )
856
+
857
+
858
+ async def main() -> None:
859
+ await client.recommendations.update_tag(
860
+ recommendation_id="recommendation_id",
861
+ )
862
+
863
+
864
+ asyncio.run(main())
865
+ """
866
+ _response = await self._raw_client.update_tag(recommendation_id, tag=tag, request_options=request_options)
867
+ return _response.data
868
+
869
+ async def make_decision(
870
+ self,
871
+ recommendation_id: str,
872
+ *,
873
+ decision: str,
874
+ reason: typing.Optional[str] = OMIT,
875
+ explanation: typing.Optional[str] = OMIT,
876
+ request_options: typing.Optional[RequestOptions] = None,
877
+ ) -> SavingsDecisionResponse:
878
+ """
879
+ Records user decision to accept or reject a savings recommendation
880
+
881
+ Parameters
882
+ ----------
883
+ recommendation_id : str
884
+
885
+ decision : str
886
+ Decision: 'accepted' or 'rejected'
887
+
888
+ reason : typing.Optional[str]
889
+ Rejection reason: operational, strategy, not_applicable, other (required if rejected)
890
+
891
+ explanation : typing.Optional[str]
892
+ Free text explanation (optional, used when reason is 'other')
893
+
894
+ request_options : typing.Optional[RequestOptions]
895
+ Request-specific configuration.
896
+
897
+ Returns
898
+ -------
899
+ SavingsDecisionResponse
900
+ Successful Response
901
+
902
+ Examples
903
+ --------
904
+ import asyncio
905
+
906
+ from levelfour import AsyncBaseLevelFour
907
+
908
+ client = AsyncBaseLevelFour(
909
+ token="YOUR_TOKEN",
910
+ base_url="https://yourhost.com/path/to/api",
911
+ )
912
+
913
+
914
+ async def main() -> None:
915
+ await client.recommendations.make_decision(
916
+ recommendation_id="recommendation_id",
917
+ decision="decision",
918
+ )
919
+
920
+
921
+ asyncio.run(main())
922
+ """
923
+ _response = await self._raw_client.make_decision(
924
+ recommendation_id,
925
+ decision=decision,
926
+ reason=reason,
927
+ explanation=explanation,
928
+ request_options=request_options,
929
+ )
930
+ return _response.data
931
+
932
+ async def set_implementation(
933
+ self, recommendation_id: str, *, method: str, request_options: typing.Optional[RequestOptions] = None
934
+ ) -> ImplementationMethodResponse:
935
+ """
936
+ Records the chosen implementation method for a recommendation
937
+
938
+ Parameters
939
+ ----------
940
+ recommendation_id : str
941
+
942
+ method : str
943
+ Implementation method: 'one-click', 'iac', 'one-click-plus-iac', 'manual'
944
+
945
+ request_options : typing.Optional[RequestOptions]
946
+ Request-specific configuration.
947
+
948
+ Returns
949
+ -------
950
+ ImplementationMethodResponse
951
+ Successful Response
952
+
953
+ Examples
954
+ --------
955
+ import asyncio
956
+
957
+ from levelfour import AsyncBaseLevelFour
958
+
959
+ client = AsyncBaseLevelFour(
960
+ token="YOUR_TOKEN",
961
+ base_url="https://yourhost.com/path/to/api",
962
+ )
963
+
964
+
965
+ async def main() -> None:
966
+ await client.recommendations.set_implementation(
967
+ recommendation_id="recommendation_id",
968
+ method="method",
969
+ )
970
+
971
+
972
+ asyncio.run(main())
973
+ """
974
+ _response = await self._raw_client.set_implementation(
975
+ recommendation_id, method=method, request_options=request_options
976
+ )
977
+ return _response.data
978
+
979
+ async def complete_wizard(
980
+ self, recommendation_id: str, *, request_options: typing.Optional[RequestOptions] = None
981
+ ) -> CompleteWizardResponse:
982
+ """
983
+ Completes the wizard flow and triggers the appropriate workflow
984
+
985
+ Parameters
986
+ ----------
987
+ recommendation_id : str
988
+
989
+ request_options : typing.Optional[RequestOptions]
990
+ Request-specific configuration.
991
+
992
+ Returns
993
+ -------
994
+ CompleteWizardResponse
995
+ Successful Response
996
+
997
+ Examples
998
+ --------
999
+ import asyncio
1000
+
1001
+ from levelfour import AsyncBaseLevelFour
1002
+
1003
+ client = AsyncBaseLevelFour(
1004
+ token="YOUR_TOKEN",
1005
+ base_url="https://yourhost.com/path/to/api",
1006
+ )
1007
+
1008
+
1009
+ async def main() -> None:
1010
+ await client.recommendations.complete_wizard(
1011
+ recommendation_id="recommendation_id",
1012
+ )
1013
+
1014
+
1015
+ asyncio.run(main())
1016
+ """
1017
+ _response = await self._raw_client.complete_wizard(recommendation_id, request_options=request_options)
1018
+ return _response.data