Skip to content

Commit 3722279

Browse files
Merge pull request #94 from astuto-ai/pu/update-python-client-2026-04-28
updated models for insights tracker
2 parents 20ffa9a + 1bc91ca commit 3722279

2 files changed

Lines changed: 175 additions & 2 deletions

File tree

onelens_backend_client_v2/models.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22759,3 +22759,46 @@ class GetS3TicketMetadataResponse(BaseModel):
2275922759
class GetS3TicketResponse(BaseModel):
2276022760
s3_ticket: S3TicketMixin
2276122761
assigned_to_email: Optional[str] = Field(None, title="Assigned To Email")
22762+
22763+
22764+
class InsightTrackerState(str, Enum):
22765+
OPEN = "OPEN"
22766+
CLOSED = "CLOSED"
22767+
22768+
22769+
class CostDetailBreakDownMetrics(BaseModel):
22770+
cost: float = Field(
22771+
..., description="The cost of the cost detail breakdown metrics.", title="Cost"
22772+
)
22773+
value: Optional[float] = Field(
22774+
None,
22775+
description="The value of the cost detail breakdown metrics.",
22776+
title="Value",
22777+
)
22778+
unit: Optional[str] = Field(
22779+
None, description="The unit of the cost detail breakdown metrics.", title="Unit"
22780+
)
22781+
22782+
22783+
class InsightTrackerMixin(BaseModel):
22784+
insight_id: UUID = Field(..., title="Insight Id")
22785+
state: InsightTrackerState
22786+
22787+
22788+
class BulkUpsertInsightsTrackerResponse(BaseModel):
22789+
upserted_count: int = Field(..., title="Upserted Count")
22790+
22791+
22792+
class BulkUpsertInsightsTrackerRequest(BaseModel):
22793+
tenant_id: UUID = Field(..., title="Tenant Id")
22794+
items: List[InsightTrackerMixin] = Field(..., title="Items")
22795+
22796+
22797+
class S3OptimisationCostDetailsResponse(BaseModel):
22798+
cost_details_breakdown: Dict[str, Dict[str, CostDetailBreakDownMetrics]] = Field(
22799+
..., title="Cost Details Breakdown"
22800+
)
22801+
total_cost: float = Field(..., title="Total Cost")
22802+
total_value: None = Field(..., title="Total Value")
22803+
other_costs: float = Field(..., title="Other Costs")
22804+
other_costs_value: None = Field(..., title="Other Costs Value")

onelens_backend_client_v2/rpc/s3_optimisation_service_rpc_handler.py

Lines changed: 132 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
from typing_extensions import Annotated
66

77

8+
from onelens_backend_client_v2.models import BulkUpsertInsightsTrackerRequest
9+
10+
11+
from onelens_backend_client_v2.models import BulkUpsertInsightsTrackerResponse
12+
13+
814
from onelens_backend_client_v2.models import S3BucketDetailsExportAPIRequest
915

1016

@@ -17,6 +23,9 @@
1723
from onelens_backend_client_v2.models import GetS3CostDetailsRequest
1824

1925

26+
from onelens_backend_client_v2.models import S3OptimisationCostDetailsResponse
27+
28+
2029
from onelens_backend_client_v2.models import S3OptimisationGridDataRequest
2130

2231

@@ -46,6 +55,127 @@ def __init__(self, api_client=None) -> None:
4655
api_client = ApiClient.get_default()
4756
self.api_client = api_client
4857

58+
@validate_call
59+
def bulk_upsert_s3_insights_tracker(
60+
self,
61+
request: BulkUpsertInsightsTrackerRequest,
62+
_request_timeout: Union[
63+
None,
64+
Annotated[StrictFloat, Field(gt=0)],
65+
Tuple[
66+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
67+
],
68+
] = None,
69+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
70+
_content_type: Optional[StrictStr] = None,
71+
_headers: Optional[Dict[StrictStr, Any]] = None,
72+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
73+
) -> BulkUpsertInsightsTrackerResponse:
74+
"""Bulk Upsert S3 Insights Tracker
75+
76+
77+
78+
:param request: (required)
79+
:type request: BulkUpsertInsightsTrackerRequest
80+
:param _request_timeout: timeout setting for this request. If one
81+
number provided, it will be total request
82+
timeout. It can also be a pair (tuple) of
83+
(connection, read) timeouts.
84+
:type _request_timeout: int, tuple(int, int), optional
85+
:param _request_auth: set to override the auth_settings for an a single
86+
request; this effectively ignores the
87+
authentication in the spec for a single request.
88+
:type _request_auth: dict, optional
89+
:param _content_type: force content-type for the request.
90+
:type _content_type: str, Optional
91+
:param _headers: set to override the headers for a single
92+
request; this effectively ignores the headers
93+
in the spec for a single request.
94+
:type _headers: dict, optional
95+
:param _host_index: set to override the host_index for a single
96+
request; this effectively ignores the host_index
97+
in the spec for a single request.
98+
:type _host_index: int, optional
99+
:return: Returns the result object.
100+
"""
101+
102+
_param = self._bulk_upsert_s3_insights_tracker_serialize(
103+
request=request,
104+
_request_auth=_request_auth,
105+
_content_type=_content_type,
106+
_headers=_headers,
107+
_host_index=_host_index,
108+
)
109+
110+
_response_types_map: Dict[str, Optional[str]] = {
111+
"200": "BulkUpsertInsightsTrackerResponse",
112+
"422": "HTTPValidationError",
113+
}
114+
response_data = self.api_client.call_api(
115+
*_param, _request_timeout=_request_timeout
116+
)
117+
response_data.read()
118+
return self.api_client.response_deserialize(
119+
response_data=response_data,
120+
response_types_map=_response_types_map,
121+
).data
122+
123+
def _bulk_upsert_s3_insights_tracker_serialize(
124+
self,
125+
request: BulkUpsertInsightsTrackerRequest,
126+
_request_auth,
127+
_content_type,
128+
_headers,
129+
_host_index,
130+
) -> RequestSerialized:
131+
_host = None
132+
133+
_collection_formats: Dict[str, str] = {}
134+
135+
_path_params: Dict[str, str] = {}
136+
_query_params: List[Tuple[str, str]] = []
137+
_header_params: Dict[str, Optional[str]] = _headers or {}
138+
_form_params: List[Tuple[str, str]] = []
139+
_files: Dict[str, Union[str, bytes]] = {}
140+
_body_params: Optional[bytes] = None
141+
142+
# process the body parameter
143+
if request is not None:
144+
_body_params = request
145+
146+
# set the HTTP header `Accept`
147+
_header_params["Accept"] = self.api_client.select_header_accept(
148+
["application/json"]
149+
)
150+
151+
# set the HTTP header `Content-Type`
152+
if _content_type:
153+
_header_params["Content-Type"] = _content_type
154+
else:
155+
_default_content_type = self.api_client.select_header_content_type(
156+
["application/json"]
157+
)
158+
if _default_content_type is not None:
159+
_header_params["Content-Type"] = _default_content_type
160+
161+
# authentication setting
162+
_auth_settings: List[str] = []
163+
164+
return self.api_client.param_serialize(
165+
method="POST",
166+
resource_path="/rpc/s3_optimisation_service/bulk_upsert_s3_insights_tracker",
167+
path_params=_path_params,
168+
query_params=_query_params,
169+
header_params=_header_params,
170+
body=_body_params,
171+
post_params=_form_params,
172+
files=_files,
173+
auth_settings=_auth_settings,
174+
collection_formats=_collection_formats,
175+
_host=_host,
176+
_request_auth=_request_auth,
177+
)
178+
49179
@validate_call
50180
def export_s3_bucket_details(
51181
self,
@@ -303,7 +433,7 @@ def get_s3_optimisation_cost_details(
303433
_content_type: Optional[StrictStr] = None,
304434
_headers: Optional[Dict[StrictStr, Any]] = None,
305435
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
306-
) -> Any:
436+
) -> S3OptimisationCostDetailsResponse:
307437
"""Get S3 Optimisation Cost Details
308438
309439
@@ -341,7 +471,7 @@ def get_s3_optimisation_cost_details(
341471
)
342472

343473
_response_types_map: Dict[str, Optional[str]] = {
344-
"200": "Any",
474+
"200": "S3OptimisationCostDetailsResponse",
345475
"422": "HTTPValidationError",
346476
}
347477
response_data = self.api_client.call_api(

0 commit comments

Comments
 (0)