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.
- levelfour/__init__.py +495 -0
- levelfour/api_keys/__init__.py +34 -0
- levelfour/api_keys/client.py +337 -0
- levelfour/api_keys/raw_client.py +621 -0
- levelfour/api_keys/types/__init__.py +34 -0
- levelfour/api_keys/types/create_api_key_request_scope.py +5 -0
- levelfour/async_levelfour_client.py +39 -0
- levelfour/base_client.py +346 -0
- levelfour/client.py +54 -0
- levelfour/core/__init__.py +127 -0
- levelfour/core/api_error.py +23 -0
- levelfour/core/client_wrapper.py +105 -0
- levelfour/core/datetime_utils.py +70 -0
- levelfour/core/file.py +67 -0
- levelfour/core/force_multipart.py +18 -0
- levelfour/core/http_client.py +776 -0
- levelfour/core/http_response.py +59 -0
- levelfour/core/http_sse/__init__.py +42 -0
- levelfour/core/http_sse/_api.py +112 -0
- levelfour/core/http_sse/_decoders.py +61 -0
- levelfour/core/http_sse/_exceptions.py +7 -0
- levelfour/core/http_sse/_models.py +17 -0
- levelfour/core/jsonable_encoder.py +108 -0
- levelfour/core/logging.py +107 -0
- levelfour/core/pagination.py +82 -0
- levelfour/core/pydantic_utilities.py +577 -0
- levelfour/core/query_encoder.py +58 -0
- levelfour/core/remove_none_from_dict.py +11 -0
- levelfour/core/request_options.py +35 -0
- levelfour/core/serialization.py +276 -0
- levelfour/errors/__init__.py +40 -0
- levelfour/errors/forbidden_error.py +11 -0
- levelfour/errors/unauthorized_error.py +11 -0
- levelfour/errors/unprocessable_entity_error.py +11 -0
- levelfour/evaluation/__init__.py +4 -0
- levelfour/evaluation/client.py +102 -0
- levelfour/evaluation/raw_client.py +141 -0
- levelfour/exceptions.py +63 -0
- levelfour/health/__init__.py +4 -0
- levelfour/health/client.py +163 -0
- levelfour/health/raw_client.py +164 -0
- levelfour/integrations/__init__.py +0 -0
- levelfour/integrations/django.py +26 -0
- levelfour/integrations/fastapi.py +39 -0
- levelfour/integrations/telemetry.py +66 -0
- levelfour/levelfour_client.py +47 -0
- levelfour/pagination.py +84 -0
- levelfour/pr_analysis/__init__.py +4 -0
- levelfour/pr_analysis/client.py +408 -0
- levelfour/pr_analysis/raw_client.py +620 -0
- levelfour/pr_analysis_actions/__init__.py +4 -0
- levelfour/pr_analysis_actions/client.py +588 -0
- levelfour/pr_analysis_actions/raw_client.py +939 -0
- levelfour/pr_analysis_installations/__init__.py +4 -0
- levelfour/pr_analysis_installations/client.py +470 -0
- levelfour/pr_analysis_installations/raw_client.py +868 -0
- levelfour/providers/__init__.py +34 -0
- levelfour/providers/client.py +1504 -0
- levelfour/providers/raw_client.py +2398 -0
- levelfour/providers/types/__init__.py +36 -0
- levelfour/providers/types/list_spending_breakdown_providers_response.py +11 -0
- levelfour/py.typed +0 -0
- levelfour/recommendations/__init__.py +4 -0
- levelfour/recommendations/client.py +1018 -0
- levelfour/recommendations/raw_client.py +1810 -0
- levelfour/savings/__init__.py +4 -0
- levelfour/savings/client.py +401 -0
- levelfour/savings/raw_client.py +624 -0
- levelfour/spending/__init__.py +34 -0
- levelfour/spending/client.py +437 -0
- levelfour/spending/raw_client.py +684 -0
- levelfour/spending/types/__init__.py +34 -0
- levelfour/spending/types/list_breakdown_spending_response.py +12 -0
- levelfour/types/__init__.py +413 -0
- levelfour/types/accept_terms_data.py +25 -0
- levelfour/types/accept_terms_response.py +27 -0
- levelfour/types/action_request.py +42 -0
- levelfour/types/api_key_created_data.py +28 -0
- levelfour/types/api_key_data.py +27 -0
- levelfour/types/authentication_error.py +5 -0
- levelfour/types/authorization_error.py +5 -0
- levelfour/types/bad_request_error.py +5 -0
- levelfour/types/comparison_item.py +32 -0
- levelfour/types/complete_wizard_data.py +27 -0
- levelfour/types/complete_wizard_response.py +27 -0
- levelfour/types/conflict_error.py +5 -0
- levelfour/types/cost_breakdown_data.py +35 -0
- levelfour/types/cost_breakdown_item.py +71 -0
- levelfour/types/cost_breakdown_raw_data.py +37 -0
- levelfour/types/cost_breakdown_raw_response.py +27 -0
- levelfour/types/cost_breakdown_response.py +27 -0
- levelfour/types/costs_breakdown_chart_data.py +48 -0
- levelfour/types/costs_breakdown_chart_response.py +27 -0
- levelfour/types/costs_breakdown_data_point.py +46 -0
- levelfour/types/costs_breakdown_grouped_chart_data.py +52 -0
- levelfour/types/costs_breakdown_grouped_chart_response.py +27 -0
- levelfour/types/costs_breakdown_grouped_data_point.py +36 -0
- levelfour/types/costs_breakdown_totals.py +41 -0
- levelfour/types/create_api_key_response.py +23 -0
- levelfour/types/daily_spending_breakdown_data.py +42 -0
- levelfour/types/daily_spending_breakdown_response.py +27 -0
- levelfour/types/daily_spending_data_point.py +31 -0
- levelfour/types/dashboard_summary_data.py +72 -0
- levelfour/types/dashboard_summary_response.py +27 -0
- levelfour/types/delete_endpoint_data.py +20 -0
- levelfour/types/delete_endpoint_response.py +23 -0
- levelfour/types/endpoint_data.py +23 -0
- levelfour/types/error_response.py +23 -0
- levelfour/types/error_response_error.py +21 -0
- levelfour/types/evaluation_status_data.py +71 -0
- levelfour/types/evaluation_status_response.py +27 -0
- levelfour/types/execution_log_command.py +21 -0
- levelfour/types/execution_log_entry.py +23 -0
- levelfour/types/execution_step_schema.py +23 -0
- levelfour/types/http_validation_error.py +20 -0
- levelfour/types/implementation_method_data.py +25 -0
- levelfour/types/implementation_method_response.py +27 -0
- levelfour/types/implementation_step.py +27 -0
- levelfour/types/internal_server_error.py +5 -0
- levelfour/types/list_api_keys_data.py +21 -0
- levelfour/types/list_api_keys_response.py +23 -0
- levelfour/types/list_endpoints_response.py +23 -0
- levelfour/types/metric_data_point.py +27 -0
- levelfour/types/metric_series.py +40 -0
- levelfour/types/metric_series_entry.py +25 -0
- levelfour/types/monthly_spending_data.py +27 -0
- levelfour/types/monthly_spending_data_point.py +31 -0
- levelfour/types/monthly_spending_response.py +27 -0
- levelfour/types/not_found_error.py +5 -0
- levelfour/types/pagination_meta.py +51 -0
- levelfour/types/processing_recommendation_item.py +61 -0
- levelfour/types/processing_recommendations_data.py +28 -0
- levelfour/types/processing_recommendations_response.py +27 -0
- levelfour/types/provider.py +46 -0
- levelfour/types/provider_breakdown_data.py +31 -0
- levelfour/types/provider_breakdown_item.py +77 -0
- levelfour/types/provider_breakdown_response.py +27 -0
- levelfour/types/provider_filter_options_data.py +51 -0
- levelfour/types/provider_filter_options_response.py +27 -0
- levelfour/types/provider_potential_savings_summary_data.py +46 -0
- levelfour/types/provider_potential_savings_summary_response.py +27 -0
- levelfour/types/provider_recommendations_summary_data.py +37 -0
- levelfour/types/provider_recommendations_summary_response.py +27 -0
- levelfour/types/provider_saved_summary_data.py +56 -0
- levelfour/types/provider_saved_summary_response.py +27 -0
- levelfour/types/provider_service_breakdown_data.py +65 -0
- levelfour/types/provider_service_breakdown_item.py +72 -0
- levelfour/types/provider_service_breakdown_raw_data.py +62 -0
- levelfour/types/provider_service_breakdown_raw_response.py +27 -0
- levelfour/types/provider_service_breakdown_response.py +27 -0
- levelfour/types/provider_service_costs_breakdown_data.py +62 -0
- levelfour/types/provider_service_costs_breakdown_response.py +27 -0
- levelfour/types/provider_service_costs_data_point.py +36 -0
- levelfour/types/provider_spending.py +61 -0
- levelfour/types/provider_spending_summary_data.py +67 -0
- levelfour/types/provider_spending_summary_response.py +27 -0
- levelfour/types/provider_timeline_data.py +57 -0
- levelfour/types/provider_timeline_response.py +27 -0
- levelfour/types/provider_top_service.py +36 -0
- levelfour/types/providers_summary_data.py +24 -0
- levelfour/types/providers_summary_response.py +27 -0
- levelfour/types/rate_limit_error.py +5 -0
- levelfour/types/recommendation_actions.py +60 -0
- levelfour/types/recommendation_detail.py +42 -0
- levelfour/types/recommendation_detail_response.py +27 -0
- levelfour/types/recommendation_filter_options_data.py +41 -0
- levelfour/types/recommendation_filter_options_response.py +27 -0
- levelfour/types/recommendation_item.py +36 -0
- levelfour/types/recommendation_wizard_data.py +173 -0
- levelfour/types/recommendation_wizard_data_metrics.py +7 -0
- levelfour/types/recommendation_wizard_response.py +27 -0
- levelfour/types/recommendations_breakdown_data.py +26 -0
- levelfour/types/recommendations_breakdown_response.py +27 -0
- levelfour/types/recommendations_overview_data.py +51 -0
- levelfour/types/recommendations_overview_response.py +27 -0
- levelfour/types/register_endpoint_response.py +23 -0
- levelfour/types/resource_change.py +42 -0
- levelfour/types/resource_snapshot.py +21 -0
- levelfour/types/revoke_api_key_data.py +20 -0
- levelfour/types/revoke_api_key_response.py +23 -0
- levelfour/types/risk_assessment.py +29 -0
- levelfour/types/risk_factor.py +27 -0
- levelfour/types/saved_breakdown_data.py +31 -0
- levelfour/types/saved_breakdown_response.py +27 -0
- levelfour/types/saved_by_provider_breakdown_data.py +31 -0
- levelfour/types/saved_by_provider_breakdown_response.py +27 -0
- levelfour/types/saved_by_provider_item.py +76 -0
- levelfour/types/saved_item.py +35 -0
- levelfour/types/saved_provider_summary.py +36 -0
- levelfour/types/saved_summary_data.py +57 -0
- levelfour/types/saved_summary_response.py +27 -0
- levelfour/types/savings_decision_data.py +28 -0
- levelfour/types/savings_decision_response.py +27 -0
- levelfour/types/spending_by_date_item.py +36 -0
- levelfour/types/top_recommendation.py +56 -0
- levelfour/types/trigger_info.py +22 -0
- levelfour/types/update_tag_data.py +20 -0
- levelfour/types/update_tag_response.py +23 -0
- levelfour/types/validation_error.py +24 -0
- levelfour/types/validation_error_loc_item.py +5 -0
- levelfour/webhooks/__init__.py +4 -0
- levelfour/webhooks/client.py +273 -0
- levelfour/webhooks/raw_client.py +483 -0
- levelfour/webhooks/verifier.py +61 -0
- levelfour-0.1.0.dist-info/METADATA +12 -0
- levelfour-0.1.0.dist-info/RECORD +208 -0
- levelfour-0.1.0.dist-info/WHEEL +5 -0
- levelfour-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,401 @@
|
|
|
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.saved_breakdown_response import SavedBreakdownResponse
|
|
9
|
+
from ..types.saved_item import SavedItem
|
|
10
|
+
from ..types.saved_summary_response import SavedSummaryResponse
|
|
11
|
+
from .raw_client import AsyncRawSavingsClient, RawSavingsClient
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SavingsClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._raw_client = RawSavingsClient(client_wrapper=client_wrapper)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def with_raw_response(self) -> RawSavingsClient:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
RawSavingsClient
|
|
29
|
+
"""
|
|
30
|
+
return self._raw_client
|
|
31
|
+
|
|
32
|
+
def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> SavedSummaryResponse:
|
|
33
|
+
"""
|
|
34
|
+
Returns enhanced BigNumbers data for the Savings Audit page
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
|
39
|
+
Request-specific configuration.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
SavedSummaryResponse
|
|
44
|
+
Successful Response
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
--------
|
|
48
|
+
from levelfour import BaseLevelFour
|
|
49
|
+
|
|
50
|
+
client = BaseLevelFour(
|
|
51
|
+
token="YOUR_TOKEN",
|
|
52
|
+
base_url="https://yourhost.com/path/to/api",
|
|
53
|
+
)
|
|
54
|
+
client.savings.get_summary()
|
|
55
|
+
"""
|
|
56
|
+
_response = self._raw_client.get_summary(request_options=request_options)
|
|
57
|
+
return _response.data
|
|
58
|
+
|
|
59
|
+
def list_breakdown(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
page: typing.Optional[int] = None,
|
|
63
|
+
page_size: typing.Optional[int] = None,
|
|
64
|
+
sort_by: typing.Optional[str] = None,
|
|
65
|
+
sort_order: typing.Optional[str] = None,
|
|
66
|
+
start: typing.Optional[str] = None,
|
|
67
|
+
end: typing.Optional[str] = None,
|
|
68
|
+
preset: typing.Optional[str] = None,
|
|
69
|
+
provider: typing.Optional[str] = None,
|
|
70
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
71
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
72
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
73
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
74
|
+
) -> SyncPager[SavedItem, SavedBreakdownResponse]:
|
|
75
|
+
"""
|
|
76
|
+
Returns paginated list of all implemented savings with filtering
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
page : typing.Optional[int]
|
|
81
|
+
Page number (1-indexed)
|
|
82
|
+
|
|
83
|
+
page_size : typing.Optional[int]
|
|
84
|
+
Items per page (max 100)
|
|
85
|
+
|
|
86
|
+
sort_by : typing.Optional[str]
|
|
87
|
+
Field to sort by (period, account_id, environment, service, usage_type, usage_quantity, usage_unit, pre_optimization_cost, post_optimization_cost, monthly_savings, roi, approved_by)
|
|
88
|
+
|
|
89
|
+
sort_order : typing.Optional[str]
|
|
90
|
+
Sort order (asc or desc)
|
|
91
|
+
|
|
92
|
+
start : typing.Optional[str]
|
|
93
|
+
Start date filter (YYYY-MM-DD or YYYY-MM format)
|
|
94
|
+
|
|
95
|
+
end : typing.Optional[str]
|
|
96
|
+
End date filter (YYYY-MM-DD or YYYY-MM format)
|
|
97
|
+
|
|
98
|
+
preset : typing.Optional[str]
|
|
99
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
100
|
+
|
|
101
|
+
provider : typing.Optional[str]
|
|
102
|
+
Filter by provider ID (aws, gcp, azure, k8s)
|
|
103
|
+
|
|
104
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
105
|
+
Filter by service(s) - can be repeated for multiple values
|
|
106
|
+
|
|
107
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
108
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
109
|
+
|
|
110
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
111
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
112
|
+
|
|
113
|
+
request_options : typing.Optional[RequestOptions]
|
|
114
|
+
Request-specific configuration.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
SyncPager[SavedItem, SavedBreakdownResponse]
|
|
119
|
+
Successful Response
|
|
120
|
+
|
|
121
|
+
Examples
|
|
122
|
+
--------
|
|
123
|
+
from levelfour import BaseLevelFour
|
|
124
|
+
|
|
125
|
+
client = BaseLevelFour(
|
|
126
|
+
token="YOUR_TOKEN",
|
|
127
|
+
base_url="https://yourhost.com/path/to/api",
|
|
128
|
+
)
|
|
129
|
+
response = client.savings.list_breakdown()
|
|
130
|
+
for item in response:
|
|
131
|
+
yield item
|
|
132
|
+
# alternatively, you can paginate page-by-page
|
|
133
|
+
for page in response.iter_pages():
|
|
134
|
+
yield page
|
|
135
|
+
"""
|
|
136
|
+
return self._raw_client.list_breakdown(
|
|
137
|
+
page=page,
|
|
138
|
+
page_size=page_size,
|
|
139
|
+
sort_by=sort_by,
|
|
140
|
+
sort_order=sort_order,
|
|
141
|
+
start=start,
|
|
142
|
+
end=end,
|
|
143
|
+
preset=preset,
|
|
144
|
+
provider=provider,
|
|
145
|
+
service=service,
|
|
146
|
+
environment=environment,
|
|
147
|
+
account_id=account_id,
|
|
148
|
+
request_options=request_options,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
def create_execution_request(
|
|
152
|
+
self,
|
|
153
|
+
*,
|
|
154
|
+
recommendation_id: str,
|
|
155
|
+
implementation_method: str,
|
|
156
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
157
|
+
) -> typing.Any:
|
|
158
|
+
"""
|
|
159
|
+
Triggers execution of a savings recommendation by updating its status to processing
|
|
160
|
+
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
recommendation_id : str
|
|
164
|
+
Recommendation ID to execute
|
|
165
|
+
|
|
166
|
+
implementation_method : str
|
|
167
|
+
Implementation method: 'one-click', 'iac', or 'one-click-plus-iac'
|
|
168
|
+
|
|
169
|
+
request_options : typing.Optional[RequestOptions]
|
|
170
|
+
Request-specific configuration.
|
|
171
|
+
|
|
172
|
+
Returns
|
|
173
|
+
-------
|
|
174
|
+
typing.Any
|
|
175
|
+
Successful Response
|
|
176
|
+
|
|
177
|
+
Examples
|
|
178
|
+
--------
|
|
179
|
+
from levelfour import BaseLevelFour
|
|
180
|
+
|
|
181
|
+
client = BaseLevelFour(
|
|
182
|
+
token="YOUR_TOKEN",
|
|
183
|
+
base_url="https://yourhost.com/path/to/api",
|
|
184
|
+
)
|
|
185
|
+
client.savings.create_execution_request(
|
|
186
|
+
recommendation_id="recommendation_id",
|
|
187
|
+
implementation_method="implementation_method",
|
|
188
|
+
)
|
|
189
|
+
"""
|
|
190
|
+
_response = self._raw_client.create_execution_request(
|
|
191
|
+
recommendation_id=recommendation_id,
|
|
192
|
+
implementation_method=implementation_method,
|
|
193
|
+
request_options=request_options,
|
|
194
|
+
)
|
|
195
|
+
return _response.data
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class AsyncSavingsClient:
|
|
199
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
200
|
+
self._raw_client = AsyncRawSavingsClient(client_wrapper=client_wrapper)
|
|
201
|
+
|
|
202
|
+
@property
|
|
203
|
+
def with_raw_response(self) -> AsyncRawSavingsClient:
|
|
204
|
+
"""
|
|
205
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
206
|
+
|
|
207
|
+
Returns
|
|
208
|
+
-------
|
|
209
|
+
AsyncRawSavingsClient
|
|
210
|
+
"""
|
|
211
|
+
return self._raw_client
|
|
212
|
+
|
|
213
|
+
async def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> SavedSummaryResponse:
|
|
214
|
+
"""
|
|
215
|
+
Returns enhanced BigNumbers data for the Savings Audit page
|
|
216
|
+
|
|
217
|
+
Parameters
|
|
218
|
+
----------
|
|
219
|
+
request_options : typing.Optional[RequestOptions]
|
|
220
|
+
Request-specific configuration.
|
|
221
|
+
|
|
222
|
+
Returns
|
|
223
|
+
-------
|
|
224
|
+
SavedSummaryResponse
|
|
225
|
+
Successful Response
|
|
226
|
+
|
|
227
|
+
Examples
|
|
228
|
+
--------
|
|
229
|
+
import asyncio
|
|
230
|
+
|
|
231
|
+
from levelfour import AsyncBaseLevelFour
|
|
232
|
+
|
|
233
|
+
client = AsyncBaseLevelFour(
|
|
234
|
+
token="YOUR_TOKEN",
|
|
235
|
+
base_url="https://yourhost.com/path/to/api",
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
async def main() -> None:
|
|
240
|
+
await client.savings.get_summary()
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
asyncio.run(main())
|
|
244
|
+
"""
|
|
245
|
+
_response = await self._raw_client.get_summary(request_options=request_options)
|
|
246
|
+
return _response.data
|
|
247
|
+
|
|
248
|
+
async def list_breakdown(
|
|
249
|
+
self,
|
|
250
|
+
*,
|
|
251
|
+
page: typing.Optional[int] = None,
|
|
252
|
+
page_size: typing.Optional[int] = None,
|
|
253
|
+
sort_by: typing.Optional[str] = None,
|
|
254
|
+
sort_order: typing.Optional[str] = None,
|
|
255
|
+
start: typing.Optional[str] = None,
|
|
256
|
+
end: typing.Optional[str] = None,
|
|
257
|
+
preset: typing.Optional[str] = None,
|
|
258
|
+
provider: typing.Optional[str] = None,
|
|
259
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
260
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
261
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
262
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
263
|
+
) -> AsyncPager[SavedItem, SavedBreakdownResponse]:
|
|
264
|
+
"""
|
|
265
|
+
Returns paginated list of all implemented savings with filtering
|
|
266
|
+
|
|
267
|
+
Parameters
|
|
268
|
+
----------
|
|
269
|
+
page : typing.Optional[int]
|
|
270
|
+
Page number (1-indexed)
|
|
271
|
+
|
|
272
|
+
page_size : typing.Optional[int]
|
|
273
|
+
Items per page (max 100)
|
|
274
|
+
|
|
275
|
+
sort_by : typing.Optional[str]
|
|
276
|
+
Field to sort by (period, account_id, environment, service, usage_type, usage_quantity, usage_unit, pre_optimization_cost, post_optimization_cost, monthly_savings, roi, approved_by)
|
|
277
|
+
|
|
278
|
+
sort_order : typing.Optional[str]
|
|
279
|
+
Sort order (asc or desc)
|
|
280
|
+
|
|
281
|
+
start : typing.Optional[str]
|
|
282
|
+
Start date filter (YYYY-MM-DD or YYYY-MM format)
|
|
283
|
+
|
|
284
|
+
end : typing.Optional[str]
|
|
285
|
+
End date filter (YYYY-MM-DD or YYYY-MM format)
|
|
286
|
+
|
|
287
|
+
preset : typing.Optional[str]
|
|
288
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
289
|
+
|
|
290
|
+
provider : typing.Optional[str]
|
|
291
|
+
Filter by provider ID (aws, gcp, azure, k8s)
|
|
292
|
+
|
|
293
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
294
|
+
Filter by service(s) - can be repeated for multiple values
|
|
295
|
+
|
|
296
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
297
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
298
|
+
|
|
299
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
300
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
301
|
+
|
|
302
|
+
request_options : typing.Optional[RequestOptions]
|
|
303
|
+
Request-specific configuration.
|
|
304
|
+
|
|
305
|
+
Returns
|
|
306
|
+
-------
|
|
307
|
+
AsyncPager[SavedItem, SavedBreakdownResponse]
|
|
308
|
+
Successful Response
|
|
309
|
+
|
|
310
|
+
Examples
|
|
311
|
+
--------
|
|
312
|
+
import asyncio
|
|
313
|
+
|
|
314
|
+
from levelfour import AsyncBaseLevelFour
|
|
315
|
+
|
|
316
|
+
client = AsyncBaseLevelFour(
|
|
317
|
+
token="YOUR_TOKEN",
|
|
318
|
+
base_url="https://yourhost.com/path/to/api",
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
async def main() -> None:
|
|
323
|
+
response = await client.savings.list_breakdown()
|
|
324
|
+
async for item in response:
|
|
325
|
+
yield item
|
|
326
|
+
|
|
327
|
+
# alternatively, you can paginate page-by-page
|
|
328
|
+
async for page in response.iter_pages():
|
|
329
|
+
yield page
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
asyncio.run(main())
|
|
333
|
+
"""
|
|
334
|
+
return await self._raw_client.list_breakdown(
|
|
335
|
+
page=page,
|
|
336
|
+
page_size=page_size,
|
|
337
|
+
sort_by=sort_by,
|
|
338
|
+
sort_order=sort_order,
|
|
339
|
+
start=start,
|
|
340
|
+
end=end,
|
|
341
|
+
preset=preset,
|
|
342
|
+
provider=provider,
|
|
343
|
+
service=service,
|
|
344
|
+
environment=environment,
|
|
345
|
+
account_id=account_id,
|
|
346
|
+
request_options=request_options,
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
async def create_execution_request(
|
|
350
|
+
self,
|
|
351
|
+
*,
|
|
352
|
+
recommendation_id: str,
|
|
353
|
+
implementation_method: str,
|
|
354
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
355
|
+
) -> typing.Any:
|
|
356
|
+
"""
|
|
357
|
+
Triggers execution of a savings recommendation by updating its status to processing
|
|
358
|
+
|
|
359
|
+
Parameters
|
|
360
|
+
----------
|
|
361
|
+
recommendation_id : str
|
|
362
|
+
Recommendation ID to execute
|
|
363
|
+
|
|
364
|
+
implementation_method : str
|
|
365
|
+
Implementation method: 'one-click', 'iac', or 'one-click-plus-iac'
|
|
366
|
+
|
|
367
|
+
request_options : typing.Optional[RequestOptions]
|
|
368
|
+
Request-specific configuration.
|
|
369
|
+
|
|
370
|
+
Returns
|
|
371
|
+
-------
|
|
372
|
+
typing.Any
|
|
373
|
+
Successful Response
|
|
374
|
+
|
|
375
|
+
Examples
|
|
376
|
+
--------
|
|
377
|
+
import asyncio
|
|
378
|
+
|
|
379
|
+
from levelfour import AsyncBaseLevelFour
|
|
380
|
+
|
|
381
|
+
client = AsyncBaseLevelFour(
|
|
382
|
+
token="YOUR_TOKEN",
|
|
383
|
+
base_url="https://yourhost.com/path/to/api",
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
async def main() -> None:
|
|
388
|
+
await client.savings.create_execution_request(
|
|
389
|
+
recommendation_id="recommendation_id",
|
|
390
|
+
implementation_method="implementation_method",
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
asyncio.run(main())
|
|
395
|
+
"""
|
|
396
|
+
_response = await self._raw_client.create_execution_request(
|
|
397
|
+
recommendation_id=recommendation_id,
|
|
398
|
+
implementation_method=implementation_method,
|
|
399
|
+
request_options=request_options,
|
|
400
|
+
)
|
|
401
|
+
return _response.data
|