Skip to content

Commit 43ae598

Browse files
authored
feat(audit_trail): add export removal (#1286)
1 parent e6a05e1 commit 43ae598

File tree

6 files changed

+94
-0
lines changed

6 files changed

+94
-0
lines changed

scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from .types import ListCombinedEventsResponseCombinedEvent
4343
from .types import Product
4444
from .types import CreateExportJobRequest
45+
from .types import DeleteExportJobRequest
4546
from .types import ExportJob
4647
from .types import ListAuthenticationEventsRequest
4748
from .types import ListAuthenticationEventsResponse
@@ -96,6 +97,7 @@
9697
"ListCombinedEventsResponseCombinedEvent",
9798
"Product",
9899
"CreateExportJobRequest",
100+
"DeleteExportJobRequest",
99101
"ExportJob",
100102
"ListAuthenticationEventsRequest",
101103
"ListAuthenticationEventsResponse",

scaleway-async/scaleway_async/audit_trail/v1alpha1/api.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,35 @@ async def create_export_job(
303303

304304
self._throw_on_error(res)
305305
return unmarshal_ExportJob(res.json())
306+
307+
async def delete_export_job(
308+
self,
309+
*,
310+
export_job_id: str,
311+
region: Optional[ScwRegion] = None,
312+
) -> None:
313+
"""
314+
Delete an export job.
315+
Deletes an export job for a specified id.
316+
:param export_job_id: ID of the export job.
317+
:param region: Region to target. If none is passed will use default region from the config.
318+
319+
Usage:
320+
::
321+
322+
result = await api.delete_export_job(
323+
export_job_id="example",
324+
)
325+
"""
326+
327+
param_region = validate_path_param(
328+
"region", region or self.client.default_region
329+
)
330+
param_export_job_id = validate_path_param("export_job_id", export_job_id)
331+
332+
res = self._request(
333+
"DELETE",
334+
f"/audit-trail/v1alpha1/regions/{param_region}/export-jobs/{param_export_job_id}",
335+
)
336+
337+
self._throw_on_error(res)

scaleway-async/scaleway_async/audit_trail/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,19 @@ class CreateExportJobRequest:
559559
s3: Optional[ExportJobS3] = None
560560

561561

562+
@dataclass
563+
class DeleteExportJobRequest:
564+
export_job_id: str
565+
"""
566+
ID of the export job.
567+
"""
568+
569+
region: Optional[ScwRegion] = None
570+
"""
571+
Region to target. If none is passed will use default region from the config.
572+
"""
573+
574+
562575
@dataclass
563576
class ExportJob:
564577
id: str

scaleway/scaleway/audit_trail/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from .types import ListCombinedEventsResponseCombinedEvent
4343
from .types import Product
4444
from .types import CreateExportJobRequest
45+
from .types import DeleteExportJobRequest
4546
from .types import ExportJob
4647
from .types import ListAuthenticationEventsRequest
4748
from .types import ListAuthenticationEventsResponse
@@ -96,6 +97,7 @@
9697
"ListCombinedEventsResponseCombinedEvent",
9798
"Product",
9899
"CreateExportJobRequest",
100+
"DeleteExportJobRequest",
99101
"ExportJob",
100102
"ListAuthenticationEventsRequest",
101103
"ListAuthenticationEventsResponse",

scaleway/scaleway/audit_trail/v1alpha1/api.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,35 @@ def create_export_job(
303303

304304
self._throw_on_error(res)
305305
return unmarshal_ExportJob(res.json())
306+
307+
def delete_export_job(
308+
self,
309+
*,
310+
export_job_id: str,
311+
region: Optional[ScwRegion] = None,
312+
) -> None:
313+
"""
314+
Delete an export job.
315+
Deletes an export job for a specified id.
316+
:param export_job_id: ID of the export job.
317+
:param region: Region to target. If none is passed will use default region from the config.
318+
319+
Usage:
320+
::
321+
322+
result = api.delete_export_job(
323+
export_job_id="example",
324+
)
325+
"""
326+
327+
param_region = validate_path_param(
328+
"region", region or self.client.default_region
329+
)
330+
param_export_job_id = validate_path_param("export_job_id", export_job_id)
331+
332+
res = self._request(
333+
"DELETE",
334+
f"/audit-trail/v1alpha1/regions/{param_region}/export-jobs/{param_export_job_id}",
335+
)
336+
337+
self._throw_on_error(res)

scaleway/scaleway/audit_trail/v1alpha1/types.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,19 @@ class CreateExportJobRequest:
559559
s3: Optional[ExportJobS3] = None
560560

561561

562+
@dataclass
563+
class DeleteExportJobRequest:
564+
export_job_id: str
565+
"""
566+
ID of the export job.
567+
"""
568+
569+
region: Optional[ScwRegion] = None
570+
"""
571+
Region to target. If none is passed will use default region from the config.
572+
"""
573+
574+
562575
@dataclass
563576
class ExportJob:
564577
id: str

0 commit comments

Comments
 (0)