Skip to content

feat(audit_trail): enable v1alpha1 #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/audit_trail/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
37 changes: 37 additions & 0 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import ListEventsRequestOrderBy
from .types import ResourceType
from .types import KubernetesClusterInfo
from .types import KubernetesNodeInfo
from .types import KubernetesPoolInfo
from .types import SecretManagerSecretInfo
from .types import SecretManagerSecretVersionInfo
from .types import EventPrincipal
from .types import Resource
from .types import Event
from .types import Product
from .types import ListEventsRequest
from .types import ListEventsResponse
from .types import ListProductsRequest
from .types import ListProductsResponse
from .api import AuditTrailV1Alpha1API

__all__ = [
"ListEventsRequestOrderBy",
"ResourceType",
"KubernetesClusterInfo",
"KubernetesNodeInfo",
"KubernetesPoolInfo",
"SecretManagerSecretInfo",
"SecretManagerSecretVersionInfo",
"EventPrincipal",
"Resource",
"Event",
"Product",
"ListEventsRequest",
"ListEventsResponse",
"ListProductsRequest",
"ListProductsResponse",
"AuditTrailV1Alpha1API",
]
122 changes: 122 additions & 0 deletions scaleway-async/scaleway_async/audit_trail/v1alpha1/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# This file was automatically generated. DO NOT EDIT.
# If you have any remark or suggestion do not hesitate to open an issue.

from datetime import datetime
from typing import Optional

from scaleway_core.api import API
from scaleway_core.bridge import (
Region,
)
from scaleway_core.utils import (
validate_path_param,
)
from .types import (
ListEventsRequestOrderBy,
ResourceType,
ListEventsResponse,
ListProductsResponse,
)
from .marshalling import (
unmarshal_ListEventsResponse,
unmarshal_ListProductsResponse,
)


class AuditTrailV1Alpha1API(API):
"""
This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.
"""

async def list_events(
self,
*,
region: Optional[Region] = None,
project_id: Optional[str] = None,
organization_id: Optional[str] = None,
resource_type: Optional[ResourceType] = None,
method_name: Optional[str] = None,
status: Optional[int] = None,
recorded_after: Optional[datetime] = None,
recorded_before: Optional[datetime] = None,
order_by: Optional[ListEventsRequestOrderBy] = None,
page_size: Optional[int] = None,
page_token: Optional[str] = None,
product_name: Optional[str] = None,
) -> ListEventsResponse:
"""
List events.
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`.
:param region: Region to target. If none is passed will use default region from the config.
:param project_id: (Optional) ID of the Project containing the Audit Trail events.
:param organization_id: ID of the Organization containing the Audit Trail events.
:param resource_type: (Optional) Returns a paginated list of Scaleway resources' features.
:param method_name: (Optional) Name of the method or the API call performed.
:param status: (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied.
: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.
:param recorded_before: (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default.
:param order_by:
:param page_size:
:param page_token:
:param product_name: (Optional) Name of the Scaleway resource in a hyphenated format.
:return: :class:`ListEventsResponse <ListEventsResponse>`

Usage:
::

result = await api.list_events()
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)

res = self._request(
"GET",
f"/audit-trail/v1alpha1/regions/{param_region}/events",
params={
"method_name": method_name,
"order_by": order_by,
"organization_id": organization_id
or self.client.default_organization_id,
"page_size": page_size or self.client.default_page_size,
"page_token": page_token,
"product_name": product_name,
"project_id": project_id or self.client.default_project_id,
"recorded_after": recorded_after,
"recorded_before": recorded_before,
"resource_type": resource_type,
"status": status,
},
)

self._throw_on_error(res)
return unmarshal_ListEventsResponse(res.json())

async def list_products(
self,
*,
region: Optional[Region] = None,
) -> ListProductsResponse:
"""
Retrieve the list of Scaleway resources for which you have Audit Trail events.
:param region: Region to target. If none is passed will use default region from the config.
:return: :class:`ListProductsResponse <ListProductsResponse>`

Usage:
::

result = await api.list_products()
"""

param_region = validate_path_param(
"region", region or self.client.default_region
)

res = self._request(
"GET",
f"/audit-trail/v1alpha1/regions/{param_region}/products",
)

self._throw_on_error(res)
return unmarshal_ListProductsResponse(res.json())
Loading