|
| 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