Skip to content
Open
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
37 changes: 37 additions & 0 deletions scaleway-async/scaleway_async/annotations/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.

from typing import Any
from dateutil import parser

from scaleway_core.profile import ProfileDefaults
from .types import (
Expand Down Expand Up @@ -123,6 +124,18 @@ def unmarshal_Binding(data: Any) -> Binding:
else:
args["value"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return Binding(**args)


Expand Down Expand Up @@ -158,6 +171,18 @@ def unmarshal_Key(data: Any) -> Key:
else:
args["description"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return Key(**args)


Expand Down Expand Up @@ -199,6 +224,18 @@ def unmarshal_Value(data: Any) -> Value:
else:
args["description"] = None

field = data.get("created_at", None)
if field is not None:
args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["created_at"] = None

field = data.get("updated_at", None)
if field is not None:
args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field
else:
args["updated_at"] = None

return Value(**args)


Expand Down
31 changes: 31 additions & 0 deletions scaleway-async/scaleway_async/annotations/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime
from typing import Optional


Expand Down Expand Up @@ -120,6 +121,16 @@ class Binding:
Value associated to the binding.
"""

created_at: Optional[datetime] = None
"""
Timestamp of creation of the binding.
"""

updated_at: Optional[datetime] = None
"""
Timestamp of the last update of the binding.
"""


@dataclass
class Key:
Expand All @@ -143,6 +154,16 @@ class Key:
Description of the annotation key.
"""

created_at: Optional[datetime] = None
"""
Timestamp of creation of the annotation key.
"""

updated_at: Optional[datetime] = None
"""
Timestamp of the last update of the annotation key.
"""


@dataclass
class Value:
Expand Down Expand Up @@ -171,6 +192,16 @@ class Value:
Description of the value.
"""

created_at: Optional[datetime] = None
"""
Timestamp of creation of the value.
"""

updated_at: Optional[datetime] = None
"""
Timestamp of the last update of the value.
"""


@dataclass
class CreateBindingRequest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

class DataorchestratorV1Alpha2API(API):
"""
This API is a boilerplate for products.
This API allows you to manage your Data Orchestrator.
"""

async def create_workflow_definition(
Expand Down
10 changes: 8 additions & 2 deletions scaleway-async/scaleway_async/dataviz/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# If you have any remark or suggestion do not hesitate to open an issue.
from .types import DeploymentStatus
from .content import DEPLOYMENT_TRANSIENT_STATUSES
from .types import ListCertificatesRequestOrderBy
from .types import ListDeploymentsRequestOrderBy
from .types import ListNodeTypesRequestOrderBy
from .types import ListUsersRequestOrderBy
Expand All @@ -17,11 +18,11 @@
from .types import Volume
from .types import NodeTypeVolumeType
from .types import EndpointSpec
from .types import Certificate
from .types import Deployment
from .types import NodeType
from .types import User
from .types import Version
from .types import Certificate
from .types import CreateCertificateRequest
from .types import CreateDeploymentRequest
from .types import CreateEndpointRequest
Expand All @@ -31,6 +32,8 @@
from .types import DeleteUserRequest
from .types import DownloadDeploymentCertificateAuthorityRequest
from .types import GetDeploymentRequest
from .types import ListCertificatesRequest
from .types import ListCertificatesResponse
from .types import ListDeploymentsRequest
from .types import ListDeploymentsResponse
from .types import ListNodeTypesRequest
Expand All @@ -47,6 +50,7 @@
__all__ = [
"DeploymentStatus",
"DEPLOYMENT_TRANSIENT_STATUSES",
"ListCertificatesRequestOrderBy",
"ListDeploymentsRequestOrderBy",
"ListNodeTypesRequestOrderBy",
"ListUsersRequestOrderBy",
Expand All @@ -62,11 +66,11 @@
"Volume",
"NodeTypeVolumeType",
"EndpointSpec",
"Certificate",
"Deployment",
"NodeType",
"User",
"Version",
"Certificate",
"CreateCertificateRequest",
"CreateDeploymentRequest",
"CreateEndpointRequest",
Expand All @@ -76,6 +80,8 @@
"DeleteUserRequest",
"DownloadDeploymentCertificateAuthorityRequest",
"GetDeploymentRequest",
"ListCertificatesRequest",
"ListCertificatesResponse",
"ListDeploymentsRequest",
"ListDeploymentsResponse",
"ListNodeTypesRequest",
Expand Down
92 changes: 91 additions & 1 deletion scaleway-async/scaleway_async/dataviz/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
wait_for_resource_async,
)
from .types import (
ListCertificatesRequestOrderBy,
ListDeploymentsRequestOrderBy,
ListNodeTypesRequestOrderBy,
ListUsersRequestOrderBy,
Expand All @@ -28,6 +29,7 @@
Deployment,
Endpoint,
EndpointSpec,
ListCertificatesResponse,
ListDeploymentsResponse,
ListNodeTypesResponse,
ListUsersResponse,
Expand All @@ -45,9 +47,10 @@
)
from .marshalling import (
unmarshal_Endpoint,
unmarshal_Certificate,
unmarshal_Deployment,
unmarshal_User,
unmarshal_Certificate,
unmarshal_ListCertificatesResponse,
unmarshal_ListDeploymentsResponse,
unmarshal_ListNodeTypesResponse,
unmarshal_ListUsersResponse,
Expand Down Expand Up @@ -955,3 +958,90 @@ async def create_certificate(

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

async def list_certificates(
self,
*,
deployment_id: str,
region: Optional[ScwRegion] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
order_by: Optional[ListCertificatesRequestOrderBy] = None,
name: Optional[str] = None,
) -> ListCertificatesResponse:
"""
:param deployment_id:
:param region: Region to target. If none is passed will use default region from the config.
:param page:
:param page_size:
:param order_by:
:param name:
:return: :class:`ListCertificatesResponse <ListCertificatesResponse>`

Usage:
::

result = await api.list_certificates(
deployment_id="example",
)
"""

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

res = self._request(
"GET",
f"/dataviz/v1alpha1/regions/{param_region}/deployments/{param_deployment_id}/certificates",
params={
"name": name,
"order_by": order_by,
"page": page,
"page_size": page_size or self.client.default_page_size,
},
)

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

async def list_certificates_all(
self,
*,
deployment_id: str,
region: Optional[ScwRegion] = None,
page: Optional[int] = None,
page_size: Optional[int] = None,
order_by: Optional[ListCertificatesRequestOrderBy] = None,
name: Optional[str] = None,
) -> list[Certificate]:
"""
:param deployment_id:
:param region: Region to target. If none is passed will use default region from the config.
:param page:
:param page_size:
:param order_by:
:param name:
:return: :class:`list[Certificate] <list[Certificate]>`

Usage:
::

result = await api.list_certificates_all(
deployment_id="example",
)
"""

return await fetch_all_pages_async(
type=ListCertificatesResponse,
key="certificates",
fetcher=self.list_certificates,
args={
"deployment_id": deployment_id,
"region": region,
"page": page,
"page_size": page_size,
"order_by": order_by,
"name": name,
},
)
Loading
Loading