Skip to content

Commit c15c7a0

Browse files
added vpc flow log models
1 parent 7c2ee83 commit c15c7a0

3 files changed

Lines changed: 339 additions & 0 deletions

File tree

onelens_backend_client_v2/models.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22522,4 +22522,65 @@ class ResponseGetUserCustomTicketByIdResponse(BaseModel):
2252222522
status_code: Optional[int] = Field(200, title="Status Code")
2252322523

2252422524

22525+
class VpcFlowLogViolationMixin(BaseModel):
22526+
raw_insight_id: str = Field(..., title="Raw Insight Id")
22527+
insight_type: str = Field(..., title="Insight Type")
22528+
account_id: str = Field(..., title="Account Id")
22529+
region: str = Field(..., title="Region")
22530+
vpc_id: Optional[str] = Field(None, title="Vpc Id")
22531+
resource: Optional[str] = Field(None, title="Resource")
22532+
source_ip: Optional[str] = Field(None, title="Source Ip")
22533+
destination: Optional[str] = Field(None, title="Destination")
22534+
destination_ip: Optional[str] = Field(None, title="Destination Ip")
22535+
service: Optional[str] = Field(None, title="Service")
22536+
transfer_type: Optional[str] = Field(None, title="Transfer Type")
22537+
source_az: Optional[str] = Field(None, title="Source Az")
22538+
destination_az: Optional[str] = Field(None, title="Destination Az")
22539+
bytes_transferred: Optional[int] = Field(None, title="Bytes Transferred")
22540+
networking_cost: Optional[float] = Field(None, title="Networking Cost")
22541+
potential_monthly_savings: Optional[float] = Field(0.0, title="Potential Monthly Savings")
22542+
recommendation_title: Optional[str] = Field(None, title="Recommendation Title")
22543+
recommendation_description: Optional[str] = Field(None, title="Recommendation Description")
22544+
effort_level: Optional[str] = Field(None, title="Effort Level")
22545+
start_date: Optional[date] = Field(None, title="Start Date")
22546+
end_date: Optional[date] = Field(None, title="End Date")
22547+
resource_ol_id: Optional[UUID] = Field(None, title="Resource Ol Id")
22548+
account_name: Optional[str] = Field(None, title="Account Name")
22549+
risk: Optional[str] = Field(None, title="Risk")
22550+
priority: Optional[str] = Field(None, title="Priority")
22551+
effort: Optional[str] = Field(None, title="Effort")
22552+
22553+
22554+
class SyncVpcFlowLogViolationsRequest(BaseModel):
22555+
tenant_id: UUID = Field(..., title="Tenant Id")
22556+
request_id: str = Field(..., title="Request Id")
22557+
account_id: str = Field(..., title="Account Id")
22558+
region: str = Field(..., title="Region")
22559+
violations: List[VpcFlowLogViolationMixin] = Field(..., title="Violations")
22560+
22561+
22562+
class SyncVpcFlowLogViolationsResponse(BaseModel):
22563+
inserted_violations: int = Field(..., title="Inserted Violations")
22564+
created_ticket_count: int = Field(..., title="Created Ticket Count")
22565+
pending_verification_count: int = Field(..., title="Pending Verification Count")
22566+
22567+
22568+
class BulkUpdateVpcFlowLogViolationTicketsRequest(BaseModel):
22569+
tenant_id: UUID = Field(..., title="Tenant Id")
22570+
ticket_ids: List[UUID] = Field(..., title="Ticket Ids")
22571+
status: Optional[PolicyTicketStatus] = None
22572+
priority: Optional[Priority] = None
22573+
assigned_to: Optional[UUID] = Field(None, title="Assigned To")
22574+
updated_by: Optional[UUID] = Field(None, title="Updated By")
22575+
achieved_savings: Optional[float] = Field(None, title="Achieved Savings")
22576+
achieved_savings_on: Optional[datetime] = Field(None, title="Achieved Savings On")
22577+
22578+
22579+
class BulkUpdateVpcFlowLogViolationTicketsResponse(BaseModel):
22580+
successful_ticket_ids: List[UUID] = Field(..., title="Successful Ticket Ids")
22581+
failed_ticket_ids: List[UUID] = Field(..., title="Failed Ticket Ids")
22582+
message: str = Field(..., title="Message")
22583+
status_code: int = Field(..., title="Status Code")
22584+
22585+
2252522586
GroupData.model_rebuild()

onelens_backend_client_v2/rpc/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@
224224
NetworkFlowAnalysisRequestsServiceRpcHandler,
225225
)
226226

227+
from onelens_backend_client_v2.rpc.vpc_flow_log_violations_service_rpc_handler import (
228+
VpcFlowLogViolationsServiceRpcHandler,
229+
)
230+
227231

228232
__all__ = [
229233
"AzureAdvisorTicketsServiceRpcHandler",
@@ -283,4 +287,5 @@
283287
"AggregatedTicketsServiceRpcHandler",
284288
"AggregatedPoliciesServiceRpcHandler",
285289
"NetworkFlowAnalysisRequestsServiceRpcHandler",
290+
"VpcFlowLogViolationsServiceRpcHandler",
286291
]
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# VpcFlowLogViolationsServiceRpcHandler API
2+
3+
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
4+
from typing import Any, Dict, List, Optional, Tuple, Union
5+
from typing_extensions import Annotated
6+
7+
8+
from onelens_backend_client_v2.models import BulkUpdateVpcFlowLogViolationTicketsRequest
9+
10+
11+
from onelens_backend_client_v2.models import (
12+
BulkUpdateVpcFlowLogViolationTicketsResponse,
13+
)
14+
15+
16+
from onelens_backend_client_v2.models import SyncVpcFlowLogViolationsRequest
17+
18+
19+
from onelens_backend_client_v2.models import SyncVpcFlowLogViolationsResponse
20+
21+
22+
from onelens_backend_client_v2.api_client import ApiClient, RequestSerialized
23+
24+
25+
class VpcFlowLogViolationsServiceRpcHandler:
26+
"""NOTE: This class is auto generated. Do not edit the class manually."""
27+
28+
def __init__(self, api_client=None) -> None:
29+
if api_client is None:
30+
api_client = ApiClient.get_default()
31+
self.api_client = api_client
32+
33+
@validate_call
34+
def bulk_update_vpc_flow_log_violation_tickets(
35+
self,
36+
request: BulkUpdateVpcFlowLogViolationTicketsRequest,
37+
_request_timeout: Union[
38+
None,
39+
Annotated[StrictFloat, Field(gt=0)],
40+
Tuple[
41+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
42+
],
43+
] = None,
44+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
45+
_content_type: Optional[StrictStr] = None,
46+
_headers: Optional[Dict[StrictStr, Any]] = None,
47+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
48+
) -> BulkUpdateVpcFlowLogViolationTicketsResponse:
49+
"""Bulk Update Vpc Flow Log Violation Tickets
50+
51+
52+
53+
:param request: (required)
54+
:type request: BulkUpdateVpcFlowLogViolationTicketsRequest
55+
:param _request_timeout: timeout setting for this request. If one
56+
number provided, it will be total request
57+
timeout. It can also be a pair (tuple) of
58+
(connection, read) timeouts.
59+
:type _request_timeout: int, tuple(int, int), optional
60+
:param _request_auth: set to override the auth_settings for an a single
61+
request; this effectively ignores the
62+
authentication in the spec for a single request.
63+
:type _request_auth: dict, optional
64+
:param _content_type: force content-type for the request.
65+
:type _content_type: str, Optional
66+
:param _headers: set to override the headers for a single
67+
request; this effectively ignores the headers
68+
in the spec for a single request.
69+
:type _headers: dict, optional
70+
:param _host_index: set to override the host_index for a single
71+
request; this effectively ignores the host_index
72+
in the spec for a single request.
73+
:type _host_index: int, optional
74+
:return: Returns the result object.
75+
"""
76+
77+
_param = self._bulk_update_vpc_flow_log_violation_tickets_serialize(
78+
request=request,
79+
_request_auth=_request_auth,
80+
_content_type=_content_type,
81+
_headers=_headers,
82+
_host_index=_host_index,
83+
)
84+
85+
_response_types_map: Dict[str, Optional[str]] = {
86+
"200": "BulkUpdateVpcFlowLogViolationTicketsResponse",
87+
"422": "HTTPValidationError",
88+
}
89+
response_data = self.api_client.call_api(
90+
*_param, _request_timeout=_request_timeout
91+
)
92+
response_data.read()
93+
return self.api_client.response_deserialize(
94+
response_data=response_data,
95+
response_types_map=_response_types_map,
96+
).data
97+
98+
def _bulk_update_vpc_flow_log_violation_tickets_serialize(
99+
self,
100+
request: BulkUpdateVpcFlowLogViolationTicketsRequest,
101+
_request_auth,
102+
_content_type,
103+
_headers,
104+
_host_index,
105+
) -> RequestSerialized:
106+
_host = None
107+
108+
_collection_formats: Dict[str, str] = {}
109+
110+
_path_params: Dict[str, str] = {}
111+
_query_params: List[Tuple[str, str]] = []
112+
_header_params: Dict[str, Optional[str]] = _headers or {}
113+
_form_params: List[Tuple[str, str]] = []
114+
_files: Dict[str, Union[str, bytes]] = {}
115+
_body_params: Optional[bytes] = None
116+
117+
# process the body parameter
118+
if request is not None:
119+
_body_params = request
120+
121+
# set the HTTP header `Accept`
122+
_header_params["Accept"] = self.api_client.select_header_accept(
123+
["application/json"]
124+
)
125+
126+
# set the HTTP header `Content-Type`
127+
if _content_type:
128+
_header_params["Content-Type"] = _content_type
129+
else:
130+
_default_content_type = self.api_client.select_header_content_type(
131+
["application/json"]
132+
)
133+
if _default_content_type is not None:
134+
_header_params["Content-Type"] = _default_content_type
135+
136+
# authentication setting
137+
_auth_settings: List[str] = []
138+
139+
return self.api_client.param_serialize(
140+
method="POST",
141+
resource_path="/rpc/vpc_flow_log_violations_service/bulk_update_vpc_flow_log_violation_tickets",
142+
path_params=_path_params,
143+
query_params=_query_params,
144+
header_params=_header_params,
145+
body=_body_params,
146+
post_params=_form_params,
147+
files=_files,
148+
auth_settings=_auth_settings,
149+
collection_formats=_collection_formats,
150+
_host=_host,
151+
_request_auth=_request_auth,
152+
)
153+
154+
@validate_call
155+
def sync_vpc_flow_log_violations(
156+
self,
157+
request: SyncVpcFlowLogViolationsRequest,
158+
_request_timeout: Union[
159+
None,
160+
Annotated[StrictFloat, Field(gt=0)],
161+
Tuple[
162+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
163+
],
164+
] = None,
165+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
166+
_content_type: Optional[StrictStr] = None,
167+
_headers: Optional[Dict[StrictStr, Any]] = None,
168+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
169+
) -> SyncVpcFlowLogViolationsResponse:
170+
"""Sync Vpc Flow Log Violations
171+
172+
173+
174+
:param request: (required)
175+
:type request: SyncVpcFlowLogViolationsRequest
176+
:param _request_timeout: timeout setting for this request. If one
177+
number provided, it will be total request
178+
timeout. It can also be a pair (tuple) of
179+
(connection, read) timeouts.
180+
:type _request_timeout: int, tuple(int, int), optional
181+
:param _request_auth: set to override the auth_settings for an a single
182+
request; this effectively ignores the
183+
authentication in the spec for a single request.
184+
:type _request_auth: dict, optional
185+
:param _content_type: force content-type for the request.
186+
:type _content_type: str, Optional
187+
:param _headers: set to override the headers for a single
188+
request; this effectively ignores the headers
189+
in the spec for a single request.
190+
:type _headers: dict, optional
191+
:param _host_index: set to override the host_index for a single
192+
request; this effectively ignores the host_index
193+
in the spec for a single request.
194+
:type _host_index: int, optional
195+
:return: Returns the result object.
196+
"""
197+
198+
_param = self._sync_vpc_flow_log_violations_serialize(
199+
request=request,
200+
_request_auth=_request_auth,
201+
_content_type=_content_type,
202+
_headers=_headers,
203+
_host_index=_host_index,
204+
)
205+
206+
_response_types_map: Dict[str, Optional[str]] = {
207+
"200": "SyncVpcFlowLogViolationsResponse",
208+
"422": "HTTPValidationError",
209+
}
210+
response_data = self.api_client.call_api(
211+
*_param, _request_timeout=_request_timeout
212+
)
213+
response_data.read()
214+
return self.api_client.response_deserialize(
215+
response_data=response_data,
216+
response_types_map=_response_types_map,
217+
).data
218+
219+
def _sync_vpc_flow_log_violations_serialize(
220+
self,
221+
request: SyncVpcFlowLogViolationsRequest,
222+
_request_auth,
223+
_content_type,
224+
_headers,
225+
_host_index,
226+
) -> RequestSerialized:
227+
_host = None
228+
229+
_collection_formats: Dict[str, str] = {}
230+
231+
_path_params: Dict[str, str] = {}
232+
_query_params: List[Tuple[str, str]] = []
233+
_header_params: Dict[str, Optional[str]] = _headers or {}
234+
_form_params: List[Tuple[str, str]] = []
235+
_files: Dict[str, Union[str, bytes]] = {}
236+
_body_params: Optional[bytes] = None
237+
238+
# process the body parameter
239+
if request is not None:
240+
_body_params = request
241+
242+
# set the HTTP header `Accept`
243+
_header_params["Accept"] = self.api_client.select_header_accept(
244+
["application/json"]
245+
)
246+
247+
# set the HTTP header `Content-Type`
248+
if _content_type:
249+
_header_params["Content-Type"] = _content_type
250+
else:
251+
_default_content_type = self.api_client.select_header_content_type(
252+
["application/json"]
253+
)
254+
if _default_content_type is not None:
255+
_header_params["Content-Type"] = _default_content_type
256+
257+
# authentication setting
258+
_auth_settings: List[str] = []
259+
260+
return self.api_client.param_serialize(
261+
method="POST",
262+
resource_path="/rpc/vpc_flow_log_violations_service/sync_vpc_flow_log_violations",
263+
path_params=_path_params,
264+
query_params=_query_params,
265+
header_params=_header_params,
266+
body=_body_params,
267+
post_params=_form_params,
268+
files=_files,
269+
auth_settings=_auth_settings,
270+
collection_formats=_collection_formats,
271+
_host=_host,
272+
_request_auth=_request_auth,
273+
)

0 commit comments

Comments
 (0)