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,1504 @@
|
|
|
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.provider_breakdown_item import ProviderBreakdownItem
|
|
9
|
+
from ..types.provider_breakdown_response import ProviderBreakdownResponse
|
|
10
|
+
from ..types.provider_filter_options_response import ProviderFilterOptionsResponse
|
|
11
|
+
from ..types.provider_potential_savings_summary_response import ProviderPotentialSavingsSummaryResponse
|
|
12
|
+
from ..types.provider_recommendations_summary_response import ProviderRecommendationsSummaryResponse
|
|
13
|
+
from ..types.provider_saved_summary_response import ProviderSavedSummaryResponse
|
|
14
|
+
from ..types.provider_spending_summary_response import ProviderSpendingSummaryResponse
|
|
15
|
+
from ..types.provider_timeline_response import ProviderTimelineResponse
|
|
16
|
+
from ..types.recommendation_filter_options_response import RecommendationFilterOptionsResponse
|
|
17
|
+
from ..types.recommendations_overview_response import RecommendationsOverviewResponse
|
|
18
|
+
from ..types.saved_by_provider_breakdown_response import SavedByProviderBreakdownResponse
|
|
19
|
+
from ..types.saved_by_provider_item import SavedByProviderItem
|
|
20
|
+
from .raw_client import AsyncRawProvidersClient, RawProvidersClient
|
|
21
|
+
from .types.list_spending_breakdown_providers_response import ListSpendingBreakdownProvidersResponse
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ProvidersClient:
|
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
|
+
self._raw_client = RawProvidersClient(client_wrapper=client_wrapper)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def with_raw_response(self) -> RawProvidersClient:
|
|
30
|
+
"""
|
|
31
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
RawProvidersClient
|
|
36
|
+
"""
|
|
37
|
+
return self._raw_client
|
|
38
|
+
|
|
39
|
+
def get_recommendations_summary(
|
|
40
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
41
|
+
) -> ProviderRecommendationsSummaryResponse:
|
|
42
|
+
"""
|
|
43
|
+
Returns top 7 recommendations for a specific cloud provider
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
provider_id : str
|
|
48
|
+
|
|
49
|
+
request_options : typing.Optional[RequestOptions]
|
|
50
|
+
Request-specific configuration.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
ProviderRecommendationsSummaryResponse
|
|
55
|
+
Successful Response
|
|
56
|
+
|
|
57
|
+
Examples
|
|
58
|
+
--------
|
|
59
|
+
from levelfour import BaseLevelFour
|
|
60
|
+
|
|
61
|
+
client = BaseLevelFour(
|
|
62
|
+
token="YOUR_TOKEN",
|
|
63
|
+
base_url="https://yourhost.com/path/to/api",
|
|
64
|
+
)
|
|
65
|
+
client.providers.get_recommendations_summary(
|
|
66
|
+
provider_id="provider_id",
|
|
67
|
+
)
|
|
68
|
+
"""
|
|
69
|
+
_response = self._raw_client.get_recommendations_summary(provider_id, request_options=request_options)
|
|
70
|
+
return _response.data
|
|
71
|
+
|
|
72
|
+
def list_recommendations(
|
|
73
|
+
self,
|
|
74
|
+
provider_id: str,
|
|
75
|
+
*,
|
|
76
|
+
start: typing.Optional[str] = None,
|
|
77
|
+
end: typing.Optional[str] = None,
|
|
78
|
+
page: typing.Optional[int] = None,
|
|
79
|
+
page_size: typing.Optional[int] = None,
|
|
80
|
+
sort_by: typing.Optional[str] = None,
|
|
81
|
+
sort_order: typing.Optional[str] = None,
|
|
82
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
83
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
84
|
+
account: typing.Optional[typing.Sequence[str]] = None,
|
|
85
|
+
tag: typing.Optional[typing.Sequence[str]] = None,
|
|
86
|
+
display_status: typing.Optional[typing.Sequence[str]] = None,
|
|
87
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
88
|
+
) -> SyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]:
|
|
89
|
+
"""
|
|
90
|
+
Returns paginated breakdown of recommendations for a specific provider
|
|
91
|
+
|
|
92
|
+
Parameters
|
|
93
|
+
----------
|
|
94
|
+
provider_id : str
|
|
95
|
+
|
|
96
|
+
start : typing.Optional[str]
|
|
97
|
+
Start date filter (ISO 8601 format: YYYY-MM-DD)
|
|
98
|
+
|
|
99
|
+
end : typing.Optional[str]
|
|
100
|
+
End date filter (ISO 8601 format: YYYY-MM-DD)
|
|
101
|
+
|
|
102
|
+
page : typing.Optional[int]
|
|
103
|
+
Page number (1-indexed)
|
|
104
|
+
|
|
105
|
+
page_size : typing.Optional[int]
|
|
106
|
+
Items per page (max 100)
|
|
107
|
+
|
|
108
|
+
sort_by : typing.Optional[str]
|
|
109
|
+
Field to sort by (recommendation_id, service, environment, account, tag, monthly_savings, savings_percentage, status)
|
|
110
|
+
|
|
111
|
+
sort_order : typing.Optional[str]
|
|
112
|
+
Sort order (asc or desc)
|
|
113
|
+
|
|
114
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
115
|
+
Filter by service(s) - can be repeated for multiple values
|
|
116
|
+
|
|
117
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
118
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
119
|
+
|
|
120
|
+
account : typing.Optional[typing.Sequence[str]]
|
|
121
|
+
Filter by account(s) - can be repeated for multiple values
|
|
122
|
+
|
|
123
|
+
tag : typing.Optional[typing.Sequence[str]]
|
|
124
|
+
Filter by tag(s) - can be repeated for multiple values
|
|
125
|
+
|
|
126
|
+
display_status : typing.Optional[typing.Sequence[str]]
|
|
127
|
+
Filter by display status(es): available, pending, processing, optimized, rejected, unavailable
|
|
128
|
+
|
|
129
|
+
request_options : typing.Optional[RequestOptions]
|
|
130
|
+
Request-specific configuration.
|
|
131
|
+
|
|
132
|
+
Returns
|
|
133
|
+
-------
|
|
134
|
+
SyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]
|
|
135
|
+
Successful Response
|
|
136
|
+
|
|
137
|
+
Examples
|
|
138
|
+
--------
|
|
139
|
+
from levelfour import BaseLevelFour
|
|
140
|
+
|
|
141
|
+
client = BaseLevelFour(
|
|
142
|
+
token="YOUR_TOKEN",
|
|
143
|
+
base_url="https://yourhost.com/path/to/api",
|
|
144
|
+
)
|
|
145
|
+
response = client.providers.list_recommendations(
|
|
146
|
+
provider_id="provider_id",
|
|
147
|
+
)
|
|
148
|
+
for item in response:
|
|
149
|
+
yield item
|
|
150
|
+
# alternatively, you can paginate page-by-page
|
|
151
|
+
for page in response.iter_pages():
|
|
152
|
+
yield page
|
|
153
|
+
"""
|
|
154
|
+
return self._raw_client.list_recommendations(
|
|
155
|
+
provider_id,
|
|
156
|
+
start=start,
|
|
157
|
+
end=end,
|
|
158
|
+
page=page,
|
|
159
|
+
page_size=page_size,
|
|
160
|
+
sort_by=sort_by,
|
|
161
|
+
sort_order=sort_order,
|
|
162
|
+
service=service,
|
|
163
|
+
environment=environment,
|
|
164
|
+
account=account,
|
|
165
|
+
tag=tag,
|
|
166
|
+
display_status=display_status,
|
|
167
|
+
request_options=request_options,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
def get_recommendations_overview(
|
|
171
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
172
|
+
) -> RecommendationsOverviewResponse:
|
|
173
|
+
"""
|
|
174
|
+
Returns overview metrics (total spend, available/pending savings, saved ITD) for a provider
|
|
175
|
+
|
|
176
|
+
Parameters
|
|
177
|
+
----------
|
|
178
|
+
provider_id : str
|
|
179
|
+
|
|
180
|
+
request_options : typing.Optional[RequestOptions]
|
|
181
|
+
Request-specific configuration.
|
|
182
|
+
|
|
183
|
+
Returns
|
|
184
|
+
-------
|
|
185
|
+
RecommendationsOverviewResponse
|
|
186
|
+
Successful Response
|
|
187
|
+
|
|
188
|
+
Examples
|
|
189
|
+
--------
|
|
190
|
+
from levelfour import BaseLevelFour
|
|
191
|
+
|
|
192
|
+
client = BaseLevelFour(
|
|
193
|
+
token="YOUR_TOKEN",
|
|
194
|
+
base_url="https://yourhost.com/path/to/api",
|
|
195
|
+
)
|
|
196
|
+
client.providers.get_recommendations_overview(
|
|
197
|
+
provider_id="provider_id",
|
|
198
|
+
)
|
|
199
|
+
"""
|
|
200
|
+
_response = self._raw_client.get_recommendations_overview(provider_id, request_options=request_options)
|
|
201
|
+
return _response.data
|
|
202
|
+
|
|
203
|
+
def get_recommendation_filters(
|
|
204
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
205
|
+
) -> RecommendationFilterOptionsResponse:
|
|
206
|
+
"""
|
|
207
|
+
Returns distinct environments, accounts, and tags for recommendation filtering
|
|
208
|
+
|
|
209
|
+
Parameters
|
|
210
|
+
----------
|
|
211
|
+
provider_id : str
|
|
212
|
+
|
|
213
|
+
request_options : typing.Optional[RequestOptions]
|
|
214
|
+
Request-specific configuration.
|
|
215
|
+
|
|
216
|
+
Returns
|
|
217
|
+
-------
|
|
218
|
+
RecommendationFilterOptionsResponse
|
|
219
|
+
Successful Response
|
|
220
|
+
|
|
221
|
+
Examples
|
|
222
|
+
--------
|
|
223
|
+
from levelfour import BaseLevelFour
|
|
224
|
+
|
|
225
|
+
client = BaseLevelFour(
|
|
226
|
+
token="YOUR_TOKEN",
|
|
227
|
+
base_url="https://yourhost.com/path/to/api",
|
|
228
|
+
)
|
|
229
|
+
client.providers.get_recommendation_filters(
|
|
230
|
+
provider_id="provider_id",
|
|
231
|
+
)
|
|
232
|
+
"""
|
|
233
|
+
_response = self._raw_client.get_recommendation_filters(provider_id, request_options=request_options)
|
|
234
|
+
return _response.data
|
|
235
|
+
|
|
236
|
+
def list_savings_breakdown(
|
|
237
|
+
self,
|
|
238
|
+
provider_id: str,
|
|
239
|
+
*,
|
|
240
|
+
start: typing.Optional[str] = None,
|
|
241
|
+
end: typing.Optional[str] = None,
|
|
242
|
+
page: typing.Optional[int] = None,
|
|
243
|
+
page_size: typing.Optional[int] = None,
|
|
244
|
+
sort_by: typing.Optional[str] = None,
|
|
245
|
+
sort_order: typing.Optional[str] = None,
|
|
246
|
+
preset: typing.Optional[str] = None,
|
|
247
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
248
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
249
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
250
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
251
|
+
) -> SyncPager[SavedByProviderItem, SavedByProviderBreakdownResponse]:
|
|
252
|
+
"""
|
|
253
|
+
Returns paginated breakdown of saved recommendations for a specific provider with filtering and sorting
|
|
254
|
+
|
|
255
|
+
Parameters
|
|
256
|
+
----------
|
|
257
|
+
provider_id : str
|
|
258
|
+
|
|
259
|
+
start : typing.Optional[str]
|
|
260
|
+
Start date filter (ISO 8601 format: YYYY-MM-DD or YYYY-MM)
|
|
261
|
+
|
|
262
|
+
end : typing.Optional[str]
|
|
263
|
+
End date filter (ISO 8601 format: YYYY-MM-DD or YYYY-MM)
|
|
264
|
+
|
|
265
|
+
page : typing.Optional[int]
|
|
266
|
+
Page number (1-indexed)
|
|
267
|
+
|
|
268
|
+
page_size : typing.Optional[int]
|
|
269
|
+
Items per page (max 100)
|
|
270
|
+
|
|
271
|
+
sort_by : typing.Optional[str]
|
|
272
|
+
Field to sort by (period, account_id, environment, service, usage_type, usage_quantity, usage_unit, pre_optimization_cost, monthly_savings, approved_by)
|
|
273
|
+
|
|
274
|
+
sort_order : typing.Optional[str]
|
|
275
|
+
Sort order (asc or desc)
|
|
276
|
+
|
|
277
|
+
preset : typing.Optional[str]
|
|
278
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
279
|
+
|
|
280
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
281
|
+
Filter by service(s) - can be repeated for multiple values
|
|
282
|
+
|
|
283
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
284
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
285
|
+
|
|
286
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
287
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
288
|
+
|
|
289
|
+
request_options : typing.Optional[RequestOptions]
|
|
290
|
+
Request-specific configuration.
|
|
291
|
+
|
|
292
|
+
Returns
|
|
293
|
+
-------
|
|
294
|
+
SyncPager[SavedByProviderItem, SavedByProviderBreakdownResponse]
|
|
295
|
+
Successful Response
|
|
296
|
+
|
|
297
|
+
Examples
|
|
298
|
+
--------
|
|
299
|
+
from levelfour import BaseLevelFour
|
|
300
|
+
|
|
301
|
+
client = BaseLevelFour(
|
|
302
|
+
token="YOUR_TOKEN",
|
|
303
|
+
base_url="https://yourhost.com/path/to/api",
|
|
304
|
+
)
|
|
305
|
+
response = client.providers.list_savings_breakdown(
|
|
306
|
+
provider_id="provider_id",
|
|
307
|
+
)
|
|
308
|
+
for item in response:
|
|
309
|
+
yield item
|
|
310
|
+
# alternatively, you can paginate page-by-page
|
|
311
|
+
for page in response.iter_pages():
|
|
312
|
+
yield page
|
|
313
|
+
"""
|
|
314
|
+
return self._raw_client.list_savings_breakdown(
|
|
315
|
+
provider_id,
|
|
316
|
+
start=start,
|
|
317
|
+
end=end,
|
|
318
|
+
page=page,
|
|
319
|
+
page_size=page_size,
|
|
320
|
+
sort_by=sort_by,
|
|
321
|
+
sort_order=sort_order,
|
|
322
|
+
preset=preset,
|
|
323
|
+
service=service,
|
|
324
|
+
environment=environment,
|
|
325
|
+
account_id=account_id,
|
|
326
|
+
request_options=request_options,
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
def get_savings_summary(
|
|
330
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
331
|
+
) -> ProviderSavedSummaryResponse:
|
|
332
|
+
"""
|
|
333
|
+
Returns saved summary totals for a specific provider (for BigNumbers)
|
|
334
|
+
|
|
335
|
+
Parameters
|
|
336
|
+
----------
|
|
337
|
+
provider_id : str
|
|
338
|
+
|
|
339
|
+
request_options : typing.Optional[RequestOptions]
|
|
340
|
+
Request-specific configuration.
|
|
341
|
+
|
|
342
|
+
Returns
|
|
343
|
+
-------
|
|
344
|
+
ProviderSavedSummaryResponse
|
|
345
|
+
Successful Response
|
|
346
|
+
|
|
347
|
+
Examples
|
|
348
|
+
--------
|
|
349
|
+
from levelfour import BaseLevelFour
|
|
350
|
+
|
|
351
|
+
client = BaseLevelFour(
|
|
352
|
+
token="YOUR_TOKEN",
|
|
353
|
+
base_url="https://yourhost.com/path/to/api",
|
|
354
|
+
)
|
|
355
|
+
client.providers.get_savings_summary(
|
|
356
|
+
provider_id="provider_id",
|
|
357
|
+
)
|
|
358
|
+
"""
|
|
359
|
+
_response = self._raw_client.get_savings_summary(provider_id, request_options=request_options)
|
|
360
|
+
return _response.data
|
|
361
|
+
|
|
362
|
+
def get_spending_summary(
|
|
363
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
364
|
+
) -> ProviderSpendingSummaryResponse:
|
|
365
|
+
"""
|
|
366
|
+
Returns spending summary for a specific cloud provider
|
|
367
|
+
|
|
368
|
+
Parameters
|
|
369
|
+
----------
|
|
370
|
+
provider_id : str
|
|
371
|
+
|
|
372
|
+
request_options : typing.Optional[RequestOptions]
|
|
373
|
+
Request-specific configuration.
|
|
374
|
+
|
|
375
|
+
Returns
|
|
376
|
+
-------
|
|
377
|
+
ProviderSpendingSummaryResponse
|
|
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.providers.get_spending_summary(
|
|
389
|
+
provider_id="provider_id",
|
|
390
|
+
)
|
|
391
|
+
"""
|
|
392
|
+
_response = self._raw_client.get_spending_summary(provider_id, request_options=request_options)
|
|
393
|
+
return _response.data
|
|
394
|
+
|
|
395
|
+
def get_spending_filters(
|
|
396
|
+
self,
|
|
397
|
+
provider_id: str,
|
|
398
|
+
*,
|
|
399
|
+
start: typing.Optional[str] = None,
|
|
400
|
+
end: typing.Optional[str] = None,
|
|
401
|
+
tag_key: typing.Optional[typing.Sequence[str]] = None,
|
|
402
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
403
|
+
) -> ProviderFilterOptionsResponse:
|
|
404
|
+
"""
|
|
405
|
+
Returns distinct services, regions, and accounts for the date range
|
|
406
|
+
|
|
407
|
+
Parameters
|
|
408
|
+
----------
|
|
409
|
+
provider_id : str
|
|
410
|
+
|
|
411
|
+
start : typing.Optional[str]
|
|
412
|
+
Start date in ISO 8601 format
|
|
413
|
+
|
|
414
|
+
end : typing.Optional[str]
|
|
415
|
+
End date in ISO 8601 format
|
|
416
|
+
|
|
417
|
+
tag_key : typing.Optional[typing.Sequence[str]]
|
|
418
|
+
Filter tag_values by these tag keys
|
|
419
|
+
|
|
420
|
+
request_options : typing.Optional[RequestOptions]
|
|
421
|
+
Request-specific configuration.
|
|
422
|
+
|
|
423
|
+
Returns
|
|
424
|
+
-------
|
|
425
|
+
ProviderFilterOptionsResponse
|
|
426
|
+
Successful Response
|
|
427
|
+
|
|
428
|
+
Examples
|
|
429
|
+
--------
|
|
430
|
+
from levelfour import BaseLevelFour
|
|
431
|
+
|
|
432
|
+
client = BaseLevelFour(
|
|
433
|
+
token="YOUR_TOKEN",
|
|
434
|
+
base_url="https://yourhost.com/path/to/api",
|
|
435
|
+
)
|
|
436
|
+
client.providers.get_spending_filters(
|
|
437
|
+
provider_id="provider_id",
|
|
438
|
+
)
|
|
439
|
+
"""
|
|
440
|
+
_response = self._raw_client.get_spending_filters(
|
|
441
|
+
provider_id, start=start, end=end, tag_key=tag_key, request_options=request_options
|
|
442
|
+
)
|
|
443
|
+
return _response.data
|
|
444
|
+
|
|
445
|
+
def list_spending_breakdown(
|
|
446
|
+
self,
|
|
447
|
+
provider_id: str,
|
|
448
|
+
*,
|
|
449
|
+
format: typing.Optional[str] = None,
|
|
450
|
+
start: typing.Optional[str] = None,
|
|
451
|
+
end: typing.Optional[str] = None,
|
|
452
|
+
granularity: typing.Optional[str] = None,
|
|
453
|
+
page: typing.Optional[int] = None,
|
|
454
|
+
page_size: typing.Optional[int] = None,
|
|
455
|
+
sort_by: typing.Optional[str] = None,
|
|
456
|
+
sort_order: typing.Optional[str] = None,
|
|
457
|
+
sort_by_date: typing.Optional[str] = None,
|
|
458
|
+
preset: typing.Optional[str] = None,
|
|
459
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
460
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
461
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
462
|
+
region: typing.Optional[typing.Sequence[str]] = None,
|
|
463
|
+
tag_key: typing.Optional[typing.Sequence[str]] = None,
|
|
464
|
+
tag_value: typing.Optional[typing.Sequence[str]] = None,
|
|
465
|
+
group_by: typing.Optional[typing.Sequence[str]] = None,
|
|
466
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
467
|
+
) -> ListSpendingBreakdownProvidersResponse:
|
|
468
|
+
"""
|
|
469
|
+
Returns service breakdown in different formats: table (paginated), chart (aggregated), csv (export), raw (all records)
|
|
470
|
+
|
|
471
|
+
Parameters
|
|
472
|
+
----------
|
|
473
|
+
provider_id : str
|
|
474
|
+
|
|
475
|
+
format : typing.Optional[str]
|
|
476
|
+
Response format: table (paginated UI), chart (aggregated stacked bar), csv (export), raw (all records)
|
|
477
|
+
|
|
478
|
+
start : typing.Optional[str]
|
|
479
|
+
Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Defaults to first of current month
|
|
480
|
+
|
|
481
|
+
end : typing.Optional[str]
|
|
482
|
+
End date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Defaults to today
|
|
483
|
+
|
|
484
|
+
granularity : typing.Optional[str]
|
|
485
|
+
Granularity: 'daily' or 'monthly' (used for chart format)
|
|
486
|
+
|
|
487
|
+
page : typing.Optional[int]
|
|
488
|
+
Page number (1-indexed, table format only)
|
|
489
|
+
|
|
490
|
+
page_size : typing.Optional[int]
|
|
491
|
+
Items per page (max 100, table format only)
|
|
492
|
+
|
|
493
|
+
sort_by : typing.Optional[str]
|
|
494
|
+
Field to sort by (service, environment, region, account_id, cost, previous_cost, change_percentage)
|
|
495
|
+
|
|
496
|
+
sort_order : typing.Optional[str]
|
|
497
|
+
Sort order (asc or desc)
|
|
498
|
+
|
|
499
|
+
sort_by_date : typing.Optional[str]
|
|
500
|
+
Sort by a specific date's cost (YYYY-MM-DD for daily, YYYY-MM for monthly). Overrides sort_by.
|
|
501
|
+
|
|
502
|
+
preset : typing.Optional[str]
|
|
503
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
504
|
+
|
|
505
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
506
|
+
Filter by service(s) - can be repeated for multiple values
|
|
507
|
+
|
|
508
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
509
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
510
|
+
|
|
511
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
512
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
513
|
+
|
|
514
|
+
region : typing.Optional[typing.Sequence[str]]
|
|
515
|
+
Filter by region(s) - can be repeated for multiple values
|
|
516
|
+
|
|
517
|
+
tag_key : typing.Optional[typing.Sequence[str]]
|
|
518
|
+
Filter by tag key(s) - required when group_by=tag
|
|
519
|
+
|
|
520
|
+
tag_value : typing.Optional[typing.Sequence[str]]
|
|
521
|
+
Filter by tag value(s) - can be repeated for multiple values
|
|
522
|
+
|
|
523
|
+
group_by : typing.Optional[typing.Sequence[str]]
|
|
524
|
+
Group by field(s). Valid: service, account_id, region, tag
|
|
525
|
+
|
|
526
|
+
request_options : typing.Optional[RequestOptions]
|
|
527
|
+
Request-specific configuration.
|
|
528
|
+
|
|
529
|
+
Returns
|
|
530
|
+
-------
|
|
531
|
+
ListSpendingBreakdownProvidersResponse
|
|
532
|
+
Successful Response
|
|
533
|
+
|
|
534
|
+
Examples
|
|
535
|
+
--------
|
|
536
|
+
from levelfour import BaseLevelFour
|
|
537
|
+
|
|
538
|
+
client = BaseLevelFour(
|
|
539
|
+
token="YOUR_TOKEN",
|
|
540
|
+
base_url="https://yourhost.com/path/to/api",
|
|
541
|
+
)
|
|
542
|
+
client.providers.list_spending_breakdown(
|
|
543
|
+
provider_id="provider_id",
|
|
544
|
+
)
|
|
545
|
+
"""
|
|
546
|
+
_response = self._raw_client.list_spending_breakdown(
|
|
547
|
+
provider_id,
|
|
548
|
+
format=format,
|
|
549
|
+
start=start,
|
|
550
|
+
end=end,
|
|
551
|
+
granularity=granularity,
|
|
552
|
+
page=page,
|
|
553
|
+
page_size=page_size,
|
|
554
|
+
sort_by=sort_by,
|
|
555
|
+
sort_order=sort_order,
|
|
556
|
+
sort_by_date=sort_by_date,
|
|
557
|
+
preset=preset,
|
|
558
|
+
service=service,
|
|
559
|
+
environment=environment,
|
|
560
|
+
account_id=account_id,
|
|
561
|
+
region=region,
|
|
562
|
+
tag_key=tag_key,
|
|
563
|
+
tag_value=tag_value,
|
|
564
|
+
group_by=group_by,
|
|
565
|
+
request_options=request_options,
|
|
566
|
+
)
|
|
567
|
+
return _response.data
|
|
568
|
+
|
|
569
|
+
def get_spending_timeline(
|
|
570
|
+
self,
|
|
571
|
+
provider_id: str,
|
|
572
|
+
*,
|
|
573
|
+
start: typing.Optional[str] = None,
|
|
574
|
+
end: typing.Optional[str] = None,
|
|
575
|
+
granularity: typing.Optional[str] = None,
|
|
576
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
577
|
+
) -> ProviderTimelineResponse:
|
|
578
|
+
"""
|
|
579
|
+
Returns spending timeline for a specific provider
|
|
580
|
+
|
|
581
|
+
Parameters
|
|
582
|
+
----------
|
|
583
|
+
provider_id : str
|
|
584
|
+
|
|
585
|
+
start : typing.Optional[str]
|
|
586
|
+
Start date in ISO 8601 format
|
|
587
|
+
|
|
588
|
+
end : typing.Optional[str]
|
|
589
|
+
End date in ISO 8601 format
|
|
590
|
+
|
|
591
|
+
granularity : typing.Optional[str]
|
|
592
|
+
Granularity: 'daily' or 'monthly'
|
|
593
|
+
|
|
594
|
+
request_options : typing.Optional[RequestOptions]
|
|
595
|
+
Request-specific configuration.
|
|
596
|
+
|
|
597
|
+
Returns
|
|
598
|
+
-------
|
|
599
|
+
ProviderTimelineResponse
|
|
600
|
+
Successful Response
|
|
601
|
+
|
|
602
|
+
Examples
|
|
603
|
+
--------
|
|
604
|
+
from levelfour import BaseLevelFour
|
|
605
|
+
|
|
606
|
+
client = BaseLevelFour(
|
|
607
|
+
token="YOUR_TOKEN",
|
|
608
|
+
base_url="https://yourhost.com/path/to/api",
|
|
609
|
+
)
|
|
610
|
+
client.providers.get_spending_timeline(
|
|
611
|
+
provider_id="provider_id",
|
|
612
|
+
)
|
|
613
|
+
"""
|
|
614
|
+
_response = self._raw_client.get_spending_timeline(
|
|
615
|
+
provider_id, start=start, end=end, granularity=granularity, request_options=request_options
|
|
616
|
+
)
|
|
617
|
+
return _response.data
|
|
618
|
+
|
|
619
|
+
def get_potential_savings_summary(
|
|
620
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
621
|
+
) -> ProviderPotentialSavingsSummaryResponse:
|
|
622
|
+
"""
|
|
623
|
+
Returns potential savings summary for a specific provider
|
|
624
|
+
|
|
625
|
+
Parameters
|
|
626
|
+
----------
|
|
627
|
+
provider_id : str
|
|
628
|
+
|
|
629
|
+
request_options : typing.Optional[RequestOptions]
|
|
630
|
+
Request-specific configuration.
|
|
631
|
+
|
|
632
|
+
Returns
|
|
633
|
+
-------
|
|
634
|
+
ProviderPotentialSavingsSummaryResponse
|
|
635
|
+
Successful Response
|
|
636
|
+
|
|
637
|
+
Examples
|
|
638
|
+
--------
|
|
639
|
+
from levelfour import BaseLevelFour
|
|
640
|
+
|
|
641
|
+
client = BaseLevelFour(
|
|
642
|
+
token="YOUR_TOKEN",
|
|
643
|
+
base_url="https://yourhost.com/path/to/api",
|
|
644
|
+
)
|
|
645
|
+
client.providers.get_potential_savings_summary(
|
|
646
|
+
provider_id="provider_id",
|
|
647
|
+
)
|
|
648
|
+
"""
|
|
649
|
+
_response = self._raw_client.get_potential_savings_summary(provider_id, request_options=request_options)
|
|
650
|
+
return _response.data
|
|
651
|
+
|
|
652
|
+
def list_potential_savings(
|
|
653
|
+
self,
|
|
654
|
+
provider_id: str,
|
|
655
|
+
*,
|
|
656
|
+
page: typing.Optional[int] = None,
|
|
657
|
+
page_size: typing.Optional[int] = None,
|
|
658
|
+
sort_by: typing.Optional[str] = None,
|
|
659
|
+
sort_order: typing.Optional[str] = None,
|
|
660
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
661
|
+
) -> SyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]:
|
|
662
|
+
"""
|
|
663
|
+
Returns paginated potential savings breakdown for a specific provider
|
|
664
|
+
|
|
665
|
+
Parameters
|
|
666
|
+
----------
|
|
667
|
+
provider_id : str
|
|
668
|
+
|
|
669
|
+
page : typing.Optional[int]
|
|
670
|
+
Page number (1-indexed)
|
|
671
|
+
|
|
672
|
+
page_size : typing.Optional[int]
|
|
673
|
+
Items per page
|
|
674
|
+
|
|
675
|
+
sort_by : typing.Optional[str]
|
|
676
|
+
Field to sort by
|
|
677
|
+
|
|
678
|
+
sort_order : typing.Optional[str]
|
|
679
|
+
Sort order
|
|
680
|
+
|
|
681
|
+
request_options : typing.Optional[RequestOptions]
|
|
682
|
+
Request-specific configuration.
|
|
683
|
+
|
|
684
|
+
Returns
|
|
685
|
+
-------
|
|
686
|
+
SyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]
|
|
687
|
+
Successful Response
|
|
688
|
+
|
|
689
|
+
Examples
|
|
690
|
+
--------
|
|
691
|
+
from levelfour import BaseLevelFour
|
|
692
|
+
|
|
693
|
+
client = BaseLevelFour(
|
|
694
|
+
token="YOUR_TOKEN",
|
|
695
|
+
base_url="https://yourhost.com/path/to/api",
|
|
696
|
+
)
|
|
697
|
+
response = client.providers.list_potential_savings(
|
|
698
|
+
provider_id="provider_id",
|
|
699
|
+
)
|
|
700
|
+
for item in response:
|
|
701
|
+
yield item
|
|
702
|
+
# alternatively, you can paginate page-by-page
|
|
703
|
+
for page in response.iter_pages():
|
|
704
|
+
yield page
|
|
705
|
+
"""
|
|
706
|
+
return self._raw_client.list_potential_savings(
|
|
707
|
+
provider_id,
|
|
708
|
+
page=page,
|
|
709
|
+
page_size=page_size,
|
|
710
|
+
sort_by=sort_by,
|
|
711
|
+
sort_order=sort_order,
|
|
712
|
+
request_options=request_options,
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
class AsyncProvidersClient:
|
|
717
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
718
|
+
self._raw_client = AsyncRawProvidersClient(client_wrapper=client_wrapper)
|
|
719
|
+
|
|
720
|
+
@property
|
|
721
|
+
def with_raw_response(self) -> AsyncRawProvidersClient:
|
|
722
|
+
"""
|
|
723
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
724
|
+
|
|
725
|
+
Returns
|
|
726
|
+
-------
|
|
727
|
+
AsyncRawProvidersClient
|
|
728
|
+
"""
|
|
729
|
+
return self._raw_client
|
|
730
|
+
|
|
731
|
+
async def get_recommendations_summary(
|
|
732
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
733
|
+
) -> ProviderRecommendationsSummaryResponse:
|
|
734
|
+
"""
|
|
735
|
+
Returns top 7 recommendations for a specific cloud provider
|
|
736
|
+
|
|
737
|
+
Parameters
|
|
738
|
+
----------
|
|
739
|
+
provider_id : str
|
|
740
|
+
|
|
741
|
+
request_options : typing.Optional[RequestOptions]
|
|
742
|
+
Request-specific configuration.
|
|
743
|
+
|
|
744
|
+
Returns
|
|
745
|
+
-------
|
|
746
|
+
ProviderRecommendationsSummaryResponse
|
|
747
|
+
Successful Response
|
|
748
|
+
|
|
749
|
+
Examples
|
|
750
|
+
--------
|
|
751
|
+
import asyncio
|
|
752
|
+
|
|
753
|
+
from levelfour import AsyncBaseLevelFour
|
|
754
|
+
|
|
755
|
+
client = AsyncBaseLevelFour(
|
|
756
|
+
token="YOUR_TOKEN",
|
|
757
|
+
base_url="https://yourhost.com/path/to/api",
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
async def main() -> None:
|
|
762
|
+
await client.providers.get_recommendations_summary(
|
|
763
|
+
provider_id="provider_id",
|
|
764
|
+
)
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
asyncio.run(main())
|
|
768
|
+
"""
|
|
769
|
+
_response = await self._raw_client.get_recommendations_summary(provider_id, request_options=request_options)
|
|
770
|
+
return _response.data
|
|
771
|
+
|
|
772
|
+
async def list_recommendations(
|
|
773
|
+
self,
|
|
774
|
+
provider_id: str,
|
|
775
|
+
*,
|
|
776
|
+
start: typing.Optional[str] = None,
|
|
777
|
+
end: typing.Optional[str] = None,
|
|
778
|
+
page: typing.Optional[int] = None,
|
|
779
|
+
page_size: typing.Optional[int] = None,
|
|
780
|
+
sort_by: typing.Optional[str] = None,
|
|
781
|
+
sort_order: typing.Optional[str] = None,
|
|
782
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
783
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
784
|
+
account: typing.Optional[typing.Sequence[str]] = None,
|
|
785
|
+
tag: typing.Optional[typing.Sequence[str]] = None,
|
|
786
|
+
display_status: typing.Optional[typing.Sequence[str]] = None,
|
|
787
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
788
|
+
) -> AsyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]:
|
|
789
|
+
"""
|
|
790
|
+
Returns paginated breakdown of recommendations for a specific provider
|
|
791
|
+
|
|
792
|
+
Parameters
|
|
793
|
+
----------
|
|
794
|
+
provider_id : str
|
|
795
|
+
|
|
796
|
+
start : typing.Optional[str]
|
|
797
|
+
Start date filter (ISO 8601 format: YYYY-MM-DD)
|
|
798
|
+
|
|
799
|
+
end : typing.Optional[str]
|
|
800
|
+
End date filter (ISO 8601 format: YYYY-MM-DD)
|
|
801
|
+
|
|
802
|
+
page : typing.Optional[int]
|
|
803
|
+
Page number (1-indexed)
|
|
804
|
+
|
|
805
|
+
page_size : typing.Optional[int]
|
|
806
|
+
Items per page (max 100)
|
|
807
|
+
|
|
808
|
+
sort_by : typing.Optional[str]
|
|
809
|
+
Field to sort by (recommendation_id, service, environment, account, tag, monthly_savings, savings_percentage, status)
|
|
810
|
+
|
|
811
|
+
sort_order : typing.Optional[str]
|
|
812
|
+
Sort order (asc or desc)
|
|
813
|
+
|
|
814
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
815
|
+
Filter by service(s) - can be repeated for multiple values
|
|
816
|
+
|
|
817
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
818
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
819
|
+
|
|
820
|
+
account : typing.Optional[typing.Sequence[str]]
|
|
821
|
+
Filter by account(s) - can be repeated for multiple values
|
|
822
|
+
|
|
823
|
+
tag : typing.Optional[typing.Sequence[str]]
|
|
824
|
+
Filter by tag(s) - can be repeated for multiple values
|
|
825
|
+
|
|
826
|
+
display_status : typing.Optional[typing.Sequence[str]]
|
|
827
|
+
Filter by display status(es): available, pending, processing, optimized, rejected, unavailable
|
|
828
|
+
|
|
829
|
+
request_options : typing.Optional[RequestOptions]
|
|
830
|
+
Request-specific configuration.
|
|
831
|
+
|
|
832
|
+
Returns
|
|
833
|
+
-------
|
|
834
|
+
AsyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]
|
|
835
|
+
Successful Response
|
|
836
|
+
|
|
837
|
+
Examples
|
|
838
|
+
--------
|
|
839
|
+
import asyncio
|
|
840
|
+
|
|
841
|
+
from levelfour import AsyncBaseLevelFour
|
|
842
|
+
|
|
843
|
+
client = AsyncBaseLevelFour(
|
|
844
|
+
token="YOUR_TOKEN",
|
|
845
|
+
base_url="https://yourhost.com/path/to/api",
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
async def main() -> None:
|
|
850
|
+
response = await client.providers.list_recommendations(
|
|
851
|
+
provider_id="provider_id",
|
|
852
|
+
)
|
|
853
|
+
async for item in response:
|
|
854
|
+
yield item
|
|
855
|
+
|
|
856
|
+
# alternatively, you can paginate page-by-page
|
|
857
|
+
async for page in response.iter_pages():
|
|
858
|
+
yield page
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
asyncio.run(main())
|
|
862
|
+
"""
|
|
863
|
+
return await self._raw_client.list_recommendations(
|
|
864
|
+
provider_id,
|
|
865
|
+
start=start,
|
|
866
|
+
end=end,
|
|
867
|
+
page=page,
|
|
868
|
+
page_size=page_size,
|
|
869
|
+
sort_by=sort_by,
|
|
870
|
+
sort_order=sort_order,
|
|
871
|
+
service=service,
|
|
872
|
+
environment=environment,
|
|
873
|
+
account=account,
|
|
874
|
+
tag=tag,
|
|
875
|
+
display_status=display_status,
|
|
876
|
+
request_options=request_options,
|
|
877
|
+
)
|
|
878
|
+
|
|
879
|
+
async def get_recommendations_overview(
|
|
880
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
881
|
+
) -> RecommendationsOverviewResponse:
|
|
882
|
+
"""
|
|
883
|
+
Returns overview metrics (total spend, available/pending savings, saved ITD) for a provider
|
|
884
|
+
|
|
885
|
+
Parameters
|
|
886
|
+
----------
|
|
887
|
+
provider_id : str
|
|
888
|
+
|
|
889
|
+
request_options : typing.Optional[RequestOptions]
|
|
890
|
+
Request-specific configuration.
|
|
891
|
+
|
|
892
|
+
Returns
|
|
893
|
+
-------
|
|
894
|
+
RecommendationsOverviewResponse
|
|
895
|
+
Successful Response
|
|
896
|
+
|
|
897
|
+
Examples
|
|
898
|
+
--------
|
|
899
|
+
import asyncio
|
|
900
|
+
|
|
901
|
+
from levelfour import AsyncBaseLevelFour
|
|
902
|
+
|
|
903
|
+
client = AsyncBaseLevelFour(
|
|
904
|
+
token="YOUR_TOKEN",
|
|
905
|
+
base_url="https://yourhost.com/path/to/api",
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
async def main() -> None:
|
|
910
|
+
await client.providers.get_recommendations_overview(
|
|
911
|
+
provider_id="provider_id",
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
asyncio.run(main())
|
|
916
|
+
"""
|
|
917
|
+
_response = await self._raw_client.get_recommendations_overview(provider_id, request_options=request_options)
|
|
918
|
+
return _response.data
|
|
919
|
+
|
|
920
|
+
async def get_recommendation_filters(
|
|
921
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
922
|
+
) -> RecommendationFilterOptionsResponse:
|
|
923
|
+
"""
|
|
924
|
+
Returns distinct environments, accounts, and tags for recommendation filtering
|
|
925
|
+
|
|
926
|
+
Parameters
|
|
927
|
+
----------
|
|
928
|
+
provider_id : str
|
|
929
|
+
|
|
930
|
+
request_options : typing.Optional[RequestOptions]
|
|
931
|
+
Request-specific configuration.
|
|
932
|
+
|
|
933
|
+
Returns
|
|
934
|
+
-------
|
|
935
|
+
RecommendationFilterOptionsResponse
|
|
936
|
+
Successful Response
|
|
937
|
+
|
|
938
|
+
Examples
|
|
939
|
+
--------
|
|
940
|
+
import asyncio
|
|
941
|
+
|
|
942
|
+
from levelfour import AsyncBaseLevelFour
|
|
943
|
+
|
|
944
|
+
client = AsyncBaseLevelFour(
|
|
945
|
+
token="YOUR_TOKEN",
|
|
946
|
+
base_url="https://yourhost.com/path/to/api",
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
async def main() -> None:
|
|
951
|
+
await client.providers.get_recommendation_filters(
|
|
952
|
+
provider_id="provider_id",
|
|
953
|
+
)
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
asyncio.run(main())
|
|
957
|
+
"""
|
|
958
|
+
_response = await self._raw_client.get_recommendation_filters(provider_id, request_options=request_options)
|
|
959
|
+
return _response.data
|
|
960
|
+
|
|
961
|
+
async def list_savings_breakdown(
|
|
962
|
+
self,
|
|
963
|
+
provider_id: str,
|
|
964
|
+
*,
|
|
965
|
+
start: typing.Optional[str] = None,
|
|
966
|
+
end: typing.Optional[str] = None,
|
|
967
|
+
page: typing.Optional[int] = None,
|
|
968
|
+
page_size: typing.Optional[int] = None,
|
|
969
|
+
sort_by: typing.Optional[str] = None,
|
|
970
|
+
sort_order: typing.Optional[str] = None,
|
|
971
|
+
preset: typing.Optional[str] = None,
|
|
972
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
973
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
974
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
975
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
976
|
+
) -> AsyncPager[SavedByProviderItem, SavedByProviderBreakdownResponse]:
|
|
977
|
+
"""
|
|
978
|
+
Returns paginated breakdown of saved recommendations for a specific provider with filtering and sorting
|
|
979
|
+
|
|
980
|
+
Parameters
|
|
981
|
+
----------
|
|
982
|
+
provider_id : str
|
|
983
|
+
|
|
984
|
+
start : typing.Optional[str]
|
|
985
|
+
Start date filter (ISO 8601 format: YYYY-MM-DD or YYYY-MM)
|
|
986
|
+
|
|
987
|
+
end : typing.Optional[str]
|
|
988
|
+
End date filter (ISO 8601 format: YYYY-MM-DD or YYYY-MM)
|
|
989
|
+
|
|
990
|
+
page : typing.Optional[int]
|
|
991
|
+
Page number (1-indexed)
|
|
992
|
+
|
|
993
|
+
page_size : typing.Optional[int]
|
|
994
|
+
Items per page (max 100)
|
|
995
|
+
|
|
996
|
+
sort_by : typing.Optional[str]
|
|
997
|
+
Field to sort by (period, account_id, environment, service, usage_type, usage_quantity, usage_unit, pre_optimization_cost, monthly_savings, approved_by)
|
|
998
|
+
|
|
999
|
+
sort_order : typing.Optional[str]
|
|
1000
|
+
Sort order (asc or desc)
|
|
1001
|
+
|
|
1002
|
+
preset : typing.Optional[str]
|
|
1003
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
1004
|
+
|
|
1005
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
1006
|
+
Filter by service(s) - can be repeated for multiple values
|
|
1007
|
+
|
|
1008
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
1009
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
1010
|
+
|
|
1011
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
1012
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
1013
|
+
|
|
1014
|
+
request_options : typing.Optional[RequestOptions]
|
|
1015
|
+
Request-specific configuration.
|
|
1016
|
+
|
|
1017
|
+
Returns
|
|
1018
|
+
-------
|
|
1019
|
+
AsyncPager[SavedByProviderItem, SavedByProviderBreakdownResponse]
|
|
1020
|
+
Successful Response
|
|
1021
|
+
|
|
1022
|
+
Examples
|
|
1023
|
+
--------
|
|
1024
|
+
import asyncio
|
|
1025
|
+
|
|
1026
|
+
from levelfour import AsyncBaseLevelFour
|
|
1027
|
+
|
|
1028
|
+
client = AsyncBaseLevelFour(
|
|
1029
|
+
token="YOUR_TOKEN",
|
|
1030
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1031
|
+
)
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
async def main() -> None:
|
|
1035
|
+
response = await client.providers.list_savings_breakdown(
|
|
1036
|
+
provider_id="provider_id",
|
|
1037
|
+
)
|
|
1038
|
+
async for item in response:
|
|
1039
|
+
yield item
|
|
1040
|
+
|
|
1041
|
+
# alternatively, you can paginate page-by-page
|
|
1042
|
+
async for page in response.iter_pages():
|
|
1043
|
+
yield page
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
asyncio.run(main())
|
|
1047
|
+
"""
|
|
1048
|
+
return await self._raw_client.list_savings_breakdown(
|
|
1049
|
+
provider_id,
|
|
1050
|
+
start=start,
|
|
1051
|
+
end=end,
|
|
1052
|
+
page=page,
|
|
1053
|
+
page_size=page_size,
|
|
1054
|
+
sort_by=sort_by,
|
|
1055
|
+
sort_order=sort_order,
|
|
1056
|
+
preset=preset,
|
|
1057
|
+
service=service,
|
|
1058
|
+
environment=environment,
|
|
1059
|
+
account_id=account_id,
|
|
1060
|
+
request_options=request_options,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
async def get_savings_summary(
|
|
1064
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1065
|
+
) -> ProviderSavedSummaryResponse:
|
|
1066
|
+
"""
|
|
1067
|
+
Returns saved summary totals for a specific provider (for BigNumbers)
|
|
1068
|
+
|
|
1069
|
+
Parameters
|
|
1070
|
+
----------
|
|
1071
|
+
provider_id : str
|
|
1072
|
+
|
|
1073
|
+
request_options : typing.Optional[RequestOptions]
|
|
1074
|
+
Request-specific configuration.
|
|
1075
|
+
|
|
1076
|
+
Returns
|
|
1077
|
+
-------
|
|
1078
|
+
ProviderSavedSummaryResponse
|
|
1079
|
+
Successful Response
|
|
1080
|
+
|
|
1081
|
+
Examples
|
|
1082
|
+
--------
|
|
1083
|
+
import asyncio
|
|
1084
|
+
|
|
1085
|
+
from levelfour import AsyncBaseLevelFour
|
|
1086
|
+
|
|
1087
|
+
client = AsyncBaseLevelFour(
|
|
1088
|
+
token="YOUR_TOKEN",
|
|
1089
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1090
|
+
)
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
async def main() -> None:
|
|
1094
|
+
await client.providers.get_savings_summary(
|
|
1095
|
+
provider_id="provider_id",
|
|
1096
|
+
)
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
asyncio.run(main())
|
|
1100
|
+
"""
|
|
1101
|
+
_response = await self._raw_client.get_savings_summary(provider_id, request_options=request_options)
|
|
1102
|
+
return _response.data
|
|
1103
|
+
|
|
1104
|
+
async def get_spending_summary(
|
|
1105
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1106
|
+
) -> ProviderSpendingSummaryResponse:
|
|
1107
|
+
"""
|
|
1108
|
+
Returns spending summary for a specific cloud provider
|
|
1109
|
+
|
|
1110
|
+
Parameters
|
|
1111
|
+
----------
|
|
1112
|
+
provider_id : str
|
|
1113
|
+
|
|
1114
|
+
request_options : typing.Optional[RequestOptions]
|
|
1115
|
+
Request-specific configuration.
|
|
1116
|
+
|
|
1117
|
+
Returns
|
|
1118
|
+
-------
|
|
1119
|
+
ProviderSpendingSummaryResponse
|
|
1120
|
+
Successful Response
|
|
1121
|
+
|
|
1122
|
+
Examples
|
|
1123
|
+
--------
|
|
1124
|
+
import asyncio
|
|
1125
|
+
|
|
1126
|
+
from levelfour import AsyncBaseLevelFour
|
|
1127
|
+
|
|
1128
|
+
client = AsyncBaseLevelFour(
|
|
1129
|
+
token="YOUR_TOKEN",
|
|
1130
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1131
|
+
)
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
async def main() -> None:
|
|
1135
|
+
await client.providers.get_spending_summary(
|
|
1136
|
+
provider_id="provider_id",
|
|
1137
|
+
)
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
asyncio.run(main())
|
|
1141
|
+
"""
|
|
1142
|
+
_response = await self._raw_client.get_spending_summary(provider_id, request_options=request_options)
|
|
1143
|
+
return _response.data
|
|
1144
|
+
|
|
1145
|
+
async def get_spending_filters(
|
|
1146
|
+
self,
|
|
1147
|
+
provider_id: str,
|
|
1148
|
+
*,
|
|
1149
|
+
start: typing.Optional[str] = None,
|
|
1150
|
+
end: typing.Optional[str] = None,
|
|
1151
|
+
tag_key: typing.Optional[typing.Sequence[str]] = None,
|
|
1152
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1153
|
+
) -> ProviderFilterOptionsResponse:
|
|
1154
|
+
"""
|
|
1155
|
+
Returns distinct services, regions, and accounts for the date range
|
|
1156
|
+
|
|
1157
|
+
Parameters
|
|
1158
|
+
----------
|
|
1159
|
+
provider_id : str
|
|
1160
|
+
|
|
1161
|
+
start : typing.Optional[str]
|
|
1162
|
+
Start date in ISO 8601 format
|
|
1163
|
+
|
|
1164
|
+
end : typing.Optional[str]
|
|
1165
|
+
End date in ISO 8601 format
|
|
1166
|
+
|
|
1167
|
+
tag_key : typing.Optional[typing.Sequence[str]]
|
|
1168
|
+
Filter tag_values by these tag keys
|
|
1169
|
+
|
|
1170
|
+
request_options : typing.Optional[RequestOptions]
|
|
1171
|
+
Request-specific configuration.
|
|
1172
|
+
|
|
1173
|
+
Returns
|
|
1174
|
+
-------
|
|
1175
|
+
ProviderFilterOptionsResponse
|
|
1176
|
+
Successful Response
|
|
1177
|
+
|
|
1178
|
+
Examples
|
|
1179
|
+
--------
|
|
1180
|
+
import asyncio
|
|
1181
|
+
|
|
1182
|
+
from levelfour import AsyncBaseLevelFour
|
|
1183
|
+
|
|
1184
|
+
client = AsyncBaseLevelFour(
|
|
1185
|
+
token="YOUR_TOKEN",
|
|
1186
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1187
|
+
)
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
async def main() -> None:
|
|
1191
|
+
await client.providers.get_spending_filters(
|
|
1192
|
+
provider_id="provider_id",
|
|
1193
|
+
)
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
asyncio.run(main())
|
|
1197
|
+
"""
|
|
1198
|
+
_response = await self._raw_client.get_spending_filters(
|
|
1199
|
+
provider_id, start=start, end=end, tag_key=tag_key, request_options=request_options
|
|
1200
|
+
)
|
|
1201
|
+
return _response.data
|
|
1202
|
+
|
|
1203
|
+
async def list_spending_breakdown(
|
|
1204
|
+
self,
|
|
1205
|
+
provider_id: str,
|
|
1206
|
+
*,
|
|
1207
|
+
format: typing.Optional[str] = None,
|
|
1208
|
+
start: typing.Optional[str] = None,
|
|
1209
|
+
end: typing.Optional[str] = None,
|
|
1210
|
+
granularity: typing.Optional[str] = None,
|
|
1211
|
+
page: typing.Optional[int] = None,
|
|
1212
|
+
page_size: typing.Optional[int] = None,
|
|
1213
|
+
sort_by: typing.Optional[str] = None,
|
|
1214
|
+
sort_order: typing.Optional[str] = None,
|
|
1215
|
+
sort_by_date: typing.Optional[str] = None,
|
|
1216
|
+
preset: typing.Optional[str] = None,
|
|
1217
|
+
service: typing.Optional[typing.Sequence[str]] = None,
|
|
1218
|
+
environment: typing.Optional[typing.Sequence[str]] = None,
|
|
1219
|
+
account_id: typing.Optional[typing.Sequence[str]] = None,
|
|
1220
|
+
region: typing.Optional[typing.Sequence[str]] = None,
|
|
1221
|
+
tag_key: typing.Optional[typing.Sequence[str]] = None,
|
|
1222
|
+
tag_value: typing.Optional[typing.Sequence[str]] = None,
|
|
1223
|
+
group_by: typing.Optional[typing.Sequence[str]] = None,
|
|
1224
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1225
|
+
) -> ListSpendingBreakdownProvidersResponse:
|
|
1226
|
+
"""
|
|
1227
|
+
Returns service breakdown in different formats: table (paginated), chart (aggregated), csv (export), raw (all records)
|
|
1228
|
+
|
|
1229
|
+
Parameters
|
|
1230
|
+
----------
|
|
1231
|
+
provider_id : str
|
|
1232
|
+
|
|
1233
|
+
format : typing.Optional[str]
|
|
1234
|
+
Response format: table (paginated UI), chart (aggregated stacked bar), csv (export), raw (all records)
|
|
1235
|
+
|
|
1236
|
+
start : typing.Optional[str]
|
|
1237
|
+
Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Defaults to first of current month
|
|
1238
|
+
|
|
1239
|
+
end : typing.Optional[str]
|
|
1240
|
+
End date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Defaults to today
|
|
1241
|
+
|
|
1242
|
+
granularity : typing.Optional[str]
|
|
1243
|
+
Granularity: 'daily' or 'monthly' (used for chart format)
|
|
1244
|
+
|
|
1245
|
+
page : typing.Optional[int]
|
|
1246
|
+
Page number (1-indexed, table format only)
|
|
1247
|
+
|
|
1248
|
+
page_size : typing.Optional[int]
|
|
1249
|
+
Items per page (max 100, table format only)
|
|
1250
|
+
|
|
1251
|
+
sort_by : typing.Optional[str]
|
|
1252
|
+
Field to sort by (service, environment, region, account_id, cost, previous_cost, change_percentage)
|
|
1253
|
+
|
|
1254
|
+
sort_order : typing.Optional[str]
|
|
1255
|
+
Sort order (asc or desc)
|
|
1256
|
+
|
|
1257
|
+
sort_by_date : typing.Optional[str]
|
|
1258
|
+
Sort by a specific date's cost (YYYY-MM-DD for daily, YYYY-MM for monthly). Overrides sort_by.
|
|
1259
|
+
|
|
1260
|
+
preset : typing.Optional[str]
|
|
1261
|
+
Date preset: '30D', '6M', or '12M' (takes precedence over start/end)
|
|
1262
|
+
|
|
1263
|
+
service : typing.Optional[typing.Sequence[str]]
|
|
1264
|
+
Filter by service(s) - can be repeated for multiple values
|
|
1265
|
+
|
|
1266
|
+
environment : typing.Optional[typing.Sequence[str]]
|
|
1267
|
+
Filter by environment(s) - can be repeated for multiple values
|
|
1268
|
+
|
|
1269
|
+
account_id : typing.Optional[typing.Sequence[str]]
|
|
1270
|
+
Filter by account ID(s) - can be repeated for multiple values
|
|
1271
|
+
|
|
1272
|
+
region : typing.Optional[typing.Sequence[str]]
|
|
1273
|
+
Filter by region(s) - can be repeated for multiple values
|
|
1274
|
+
|
|
1275
|
+
tag_key : typing.Optional[typing.Sequence[str]]
|
|
1276
|
+
Filter by tag key(s) - required when group_by=tag
|
|
1277
|
+
|
|
1278
|
+
tag_value : typing.Optional[typing.Sequence[str]]
|
|
1279
|
+
Filter by tag value(s) - can be repeated for multiple values
|
|
1280
|
+
|
|
1281
|
+
group_by : typing.Optional[typing.Sequence[str]]
|
|
1282
|
+
Group by field(s). Valid: service, account_id, region, tag
|
|
1283
|
+
|
|
1284
|
+
request_options : typing.Optional[RequestOptions]
|
|
1285
|
+
Request-specific configuration.
|
|
1286
|
+
|
|
1287
|
+
Returns
|
|
1288
|
+
-------
|
|
1289
|
+
ListSpendingBreakdownProvidersResponse
|
|
1290
|
+
Successful Response
|
|
1291
|
+
|
|
1292
|
+
Examples
|
|
1293
|
+
--------
|
|
1294
|
+
import asyncio
|
|
1295
|
+
|
|
1296
|
+
from levelfour import AsyncBaseLevelFour
|
|
1297
|
+
|
|
1298
|
+
client = AsyncBaseLevelFour(
|
|
1299
|
+
token="YOUR_TOKEN",
|
|
1300
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1301
|
+
)
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
async def main() -> None:
|
|
1305
|
+
await client.providers.list_spending_breakdown(
|
|
1306
|
+
provider_id="provider_id",
|
|
1307
|
+
)
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
asyncio.run(main())
|
|
1311
|
+
"""
|
|
1312
|
+
_response = await self._raw_client.list_spending_breakdown(
|
|
1313
|
+
provider_id,
|
|
1314
|
+
format=format,
|
|
1315
|
+
start=start,
|
|
1316
|
+
end=end,
|
|
1317
|
+
granularity=granularity,
|
|
1318
|
+
page=page,
|
|
1319
|
+
page_size=page_size,
|
|
1320
|
+
sort_by=sort_by,
|
|
1321
|
+
sort_order=sort_order,
|
|
1322
|
+
sort_by_date=sort_by_date,
|
|
1323
|
+
preset=preset,
|
|
1324
|
+
service=service,
|
|
1325
|
+
environment=environment,
|
|
1326
|
+
account_id=account_id,
|
|
1327
|
+
region=region,
|
|
1328
|
+
tag_key=tag_key,
|
|
1329
|
+
tag_value=tag_value,
|
|
1330
|
+
group_by=group_by,
|
|
1331
|
+
request_options=request_options,
|
|
1332
|
+
)
|
|
1333
|
+
return _response.data
|
|
1334
|
+
|
|
1335
|
+
async def get_spending_timeline(
|
|
1336
|
+
self,
|
|
1337
|
+
provider_id: str,
|
|
1338
|
+
*,
|
|
1339
|
+
start: typing.Optional[str] = None,
|
|
1340
|
+
end: typing.Optional[str] = None,
|
|
1341
|
+
granularity: typing.Optional[str] = None,
|
|
1342
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1343
|
+
) -> ProviderTimelineResponse:
|
|
1344
|
+
"""
|
|
1345
|
+
Returns spending timeline for a specific provider
|
|
1346
|
+
|
|
1347
|
+
Parameters
|
|
1348
|
+
----------
|
|
1349
|
+
provider_id : str
|
|
1350
|
+
|
|
1351
|
+
start : typing.Optional[str]
|
|
1352
|
+
Start date in ISO 8601 format
|
|
1353
|
+
|
|
1354
|
+
end : typing.Optional[str]
|
|
1355
|
+
End date in ISO 8601 format
|
|
1356
|
+
|
|
1357
|
+
granularity : typing.Optional[str]
|
|
1358
|
+
Granularity: 'daily' or 'monthly'
|
|
1359
|
+
|
|
1360
|
+
request_options : typing.Optional[RequestOptions]
|
|
1361
|
+
Request-specific configuration.
|
|
1362
|
+
|
|
1363
|
+
Returns
|
|
1364
|
+
-------
|
|
1365
|
+
ProviderTimelineResponse
|
|
1366
|
+
Successful Response
|
|
1367
|
+
|
|
1368
|
+
Examples
|
|
1369
|
+
--------
|
|
1370
|
+
import asyncio
|
|
1371
|
+
|
|
1372
|
+
from levelfour import AsyncBaseLevelFour
|
|
1373
|
+
|
|
1374
|
+
client = AsyncBaseLevelFour(
|
|
1375
|
+
token="YOUR_TOKEN",
|
|
1376
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1377
|
+
)
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
async def main() -> None:
|
|
1381
|
+
await client.providers.get_spending_timeline(
|
|
1382
|
+
provider_id="provider_id",
|
|
1383
|
+
)
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
asyncio.run(main())
|
|
1387
|
+
"""
|
|
1388
|
+
_response = await self._raw_client.get_spending_timeline(
|
|
1389
|
+
provider_id, start=start, end=end, granularity=granularity, request_options=request_options
|
|
1390
|
+
)
|
|
1391
|
+
return _response.data
|
|
1392
|
+
|
|
1393
|
+
async def get_potential_savings_summary(
|
|
1394
|
+
self, provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1395
|
+
) -> ProviderPotentialSavingsSummaryResponse:
|
|
1396
|
+
"""
|
|
1397
|
+
Returns potential savings summary for a specific provider
|
|
1398
|
+
|
|
1399
|
+
Parameters
|
|
1400
|
+
----------
|
|
1401
|
+
provider_id : str
|
|
1402
|
+
|
|
1403
|
+
request_options : typing.Optional[RequestOptions]
|
|
1404
|
+
Request-specific configuration.
|
|
1405
|
+
|
|
1406
|
+
Returns
|
|
1407
|
+
-------
|
|
1408
|
+
ProviderPotentialSavingsSummaryResponse
|
|
1409
|
+
Successful Response
|
|
1410
|
+
|
|
1411
|
+
Examples
|
|
1412
|
+
--------
|
|
1413
|
+
import asyncio
|
|
1414
|
+
|
|
1415
|
+
from levelfour import AsyncBaseLevelFour
|
|
1416
|
+
|
|
1417
|
+
client = AsyncBaseLevelFour(
|
|
1418
|
+
token="YOUR_TOKEN",
|
|
1419
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1420
|
+
)
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
async def main() -> None:
|
|
1424
|
+
await client.providers.get_potential_savings_summary(
|
|
1425
|
+
provider_id="provider_id",
|
|
1426
|
+
)
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
asyncio.run(main())
|
|
1430
|
+
"""
|
|
1431
|
+
_response = await self._raw_client.get_potential_savings_summary(provider_id, request_options=request_options)
|
|
1432
|
+
return _response.data
|
|
1433
|
+
|
|
1434
|
+
async def list_potential_savings(
|
|
1435
|
+
self,
|
|
1436
|
+
provider_id: str,
|
|
1437
|
+
*,
|
|
1438
|
+
page: typing.Optional[int] = None,
|
|
1439
|
+
page_size: typing.Optional[int] = None,
|
|
1440
|
+
sort_by: typing.Optional[str] = None,
|
|
1441
|
+
sort_order: typing.Optional[str] = None,
|
|
1442
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1443
|
+
) -> AsyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]:
|
|
1444
|
+
"""
|
|
1445
|
+
Returns paginated potential savings breakdown for a specific provider
|
|
1446
|
+
|
|
1447
|
+
Parameters
|
|
1448
|
+
----------
|
|
1449
|
+
provider_id : str
|
|
1450
|
+
|
|
1451
|
+
page : typing.Optional[int]
|
|
1452
|
+
Page number (1-indexed)
|
|
1453
|
+
|
|
1454
|
+
page_size : typing.Optional[int]
|
|
1455
|
+
Items per page
|
|
1456
|
+
|
|
1457
|
+
sort_by : typing.Optional[str]
|
|
1458
|
+
Field to sort by
|
|
1459
|
+
|
|
1460
|
+
sort_order : typing.Optional[str]
|
|
1461
|
+
Sort order
|
|
1462
|
+
|
|
1463
|
+
request_options : typing.Optional[RequestOptions]
|
|
1464
|
+
Request-specific configuration.
|
|
1465
|
+
|
|
1466
|
+
Returns
|
|
1467
|
+
-------
|
|
1468
|
+
AsyncPager[ProviderBreakdownItem, ProviderBreakdownResponse]
|
|
1469
|
+
Successful Response
|
|
1470
|
+
|
|
1471
|
+
Examples
|
|
1472
|
+
--------
|
|
1473
|
+
import asyncio
|
|
1474
|
+
|
|
1475
|
+
from levelfour import AsyncBaseLevelFour
|
|
1476
|
+
|
|
1477
|
+
client = AsyncBaseLevelFour(
|
|
1478
|
+
token="YOUR_TOKEN",
|
|
1479
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1480
|
+
)
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
async def main() -> None:
|
|
1484
|
+
response = await client.providers.list_potential_savings(
|
|
1485
|
+
provider_id="provider_id",
|
|
1486
|
+
)
|
|
1487
|
+
async for item in response:
|
|
1488
|
+
yield item
|
|
1489
|
+
|
|
1490
|
+
# alternatively, you can paginate page-by-page
|
|
1491
|
+
async for page in response.iter_pages():
|
|
1492
|
+
yield page
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
asyncio.run(main())
|
|
1496
|
+
"""
|
|
1497
|
+
return await self._raw_client.list_potential_savings(
|
|
1498
|
+
provider_id,
|
|
1499
|
+
page=page,
|
|
1500
|
+
page_size=page_size,
|
|
1501
|
+
sort_by=sort_by,
|
|
1502
|
+
sort_order=sort_order,
|
|
1503
|
+
request_options=request_options,
|
|
1504
|
+
)
|