Skip to content

Commit b2cce67

Browse files
authored
feat(audit_trail): enable v1alpha1 (scaleway#769)
1 parent 88f9475 commit b2cce67

File tree

10 files changed

+1430
-0
lines changed

10 files changed

+1430
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import ListEventsRequestOrderBy
4+
from .types import ResourceType
5+
from .types import KubernetesClusterInfo
6+
from .types import KubernetesNodeInfo
7+
from .types import KubernetesPoolInfo
8+
from .types import SecretManagerSecretInfo
9+
from .types import SecretManagerSecretVersionInfo
10+
from .types import EventPrincipal
11+
from .types import Resource
12+
from .types import Event
13+
from .types import Product
14+
from .types import ListEventsRequest
15+
from .types import ListEventsResponse
16+
from .types import ListProductsRequest
17+
from .types import ListProductsResponse
18+
from .api import AuditTrailV1Alpha1API
19+
20+
__all__ = [
21+
"ListEventsRequestOrderBy",
22+
"ResourceType",
23+
"KubernetesClusterInfo",
24+
"KubernetesNodeInfo",
25+
"KubernetesPoolInfo",
26+
"SecretManagerSecretInfo",
27+
"SecretManagerSecretVersionInfo",
28+
"EventPrincipal",
29+
"Resource",
30+
"Event",
31+
"Product",
32+
"ListEventsRequest",
33+
"ListEventsResponse",
34+
"ListProductsRequest",
35+
"ListProductsResponse",
36+
"AuditTrailV1Alpha1API",
37+
]
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
4+
from datetime import datetime
5+
from typing import Optional
6+
7+
from scaleway_core.api import API
8+
from scaleway_core.bridge import (
9+
Region,
10+
)
11+
from scaleway_core.utils import (
12+
validate_path_param,
13+
)
14+
from .types import (
15+
ListEventsRequestOrderBy,
16+
ResourceType,
17+
ListEventsResponse,
18+
ListProductsResponse,
19+
)
20+
from .marshalling import (
21+
unmarshal_ListEventsResponse,
22+
unmarshal_ListProductsResponse,
23+
)
24+
25+
26+
class AuditTrailV1Alpha1API(API):
27+
"""
28+
This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.
29+
"""
30+
31+
async def list_events(
32+
self,
33+
*,
34+
region: Optional[Region] = None,
35+
project_id: Optional[str] = None,
36+
organization_id: Optional[str] = None,
37+
resource_type: Optional[ResourceType] = None,
38+
method_name: Optional[str] = None,
39+
status: Optional[int] = None,
40+
recorded_after: Optional[datetime] = None,
41+
recorded_before: Optional[datetime] = None,
42+
order_by: Optional[ListEventsRequestOrderBy] = None,
43+
page_size: Optional[int] = None,
44+
page_token: Optional[str] = None,
45+
product_name: Optional[str] = None,
46+
) -> ListEventsResponse:
47+
"""
48+
List events.
49+
Retrieve the list of Audit Trail events for a Scaleway Organization and/or Project. You must specify the `organization_id` and optionally, the `project_id`.
50+
:param region: Region to target. If none is passed will use default region from the config.
51+
:param project_id: (Optional) ID of the Project containing the Audit Trail events.
52+
:param organization_id: ID of the Organization containing the Audit Trail events.
53+
:param resource_type: (Optional) Returns a paginated list of Scaleway resources' features.
54+
:param method_name: (Optional) Name of the method or the API call performed.
55+
:param status: (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied.
56+
:param recorded_after: (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default.
57+
:param recorded_before: (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default.
58+
:param order_by:
59+
:param page_size:
60+
:param page_token:
61+
:param product_name: (Optional) Name of the Scaleway resource in a hyphenated format.
62+
:return: :class:`ListEventsResponse <ListEventsResponse>`
63+
64+
Usage:
65+
::
66+
67+
result = await api.list_events()
68+
"""
69+
70+
param_region = validate_path_param(
71+
"region", region or self.client.default_region
72+
)
73+
74+
res = self._request(
75+
"GET",
76+
f"/audit-trail/v1alpha1/regions/{param_region}/events",
77+
params={
78+
"method_name": method_name,
79+
"order_by": order_by,
80+
"organization_id": organization_id
81+
or self.client.default_organization_id,
82+
"page_size": page_size or self.client.default_page_size,
83+
"page_token": page_token,
84+
"product_name": product_name,
85+
"project_id": project_id or self.client.default_project_id,
86+
"recorded_after": recorded_after,
87+
"recorded_before": recorded_before,
88+
"resource_type": resource_type,
89+
"status": status,
90+
},
91+
)
92+
93+
self._throw_on_error(res)
94+
return unmarshal_ListEventsResponse(res.json())
95+
96+
async def list_products(
97+
self,
98+
*,
99+
region: Optional[Region] = None,
100+
) -> ListProductsResponse:
101+
"""
102+
Retrieve the list of Scaleway resources for which you have Audit Trail events.
103+
:param region: Region to target. If none is passed will use default region from the config.
104+
:return: :class:`ListProductsResponse <ListProductsResponse>`
105+
106+
Usage:
107+
::
108+
109+
result = await api.list_products()
110+
"""
111+
112+
param_region = validate_path_param(
113+
"region", region or self.client.default_region
114+
)
115+
116+
res = self._request(
117+
"GET",
118+
f"/audit-trail/v1alpha1/regions/{param_region}/products",
119+
)
120+
121+
self._throw_on_error(res)
122+
return unmarshal_ListProductsResponse(res.json())

0 commit comments

Comments
 (0)