Skip to content

Commit a1403ab

Browse files
committed
feat: update generated APIs
1 parent 7cf8fe3 commit a1403ab

File tree

8 files changed

+500
-0
lines changed

8 files changed

+500
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from .types import PipelineErrorType
1515
from .types import PipelineStatus
1616
from .content import PIPELINE_TRANSIENT_STATUSES
17+
from .types import PlanName
1718
from .types import PurgeRequestStatus
1819
from .content import PURGE_REQUEST_TRANSIENT_STATUSES
1920
from .types import ScalewayLb
@@ -26,6 +27,7 @@
2627
from .types import CacheStage
2728
from .types import DNSStage
2829
from .types import Pipeline
30+
from .types import PlanDetails
2931
from .types import PurgeRequest
3032
from .types import TLSStage
3133
from .types import TLSSecretsConfig
@@ -43,11 +45,13 @@
4345
from .types import CreateTLSStageRequest
4446
from .types import DeleteBackendStageRequest
4547
from .types import DeleteCacheStageRequest
48+
from .types import DeleteCurrentPlanRequest
4649
from .types import DeleteDNSStageRequest
4750
from .types import DeletePipelineRequest
4851
from .types import DeleteTLSStageRequest
4952
from .types import GetBackendStageRequest
5053
from .types import GetCacheStageRequest
54+
from .types import GetCurrentPlanRequest
5155
from .types import GetDNSStageRequest
5256
from .types import GetPipelineRequest
5357
from .types import GetPurgeRequestRequest
@@ -60,10 +64,13 @@
6064
from .types import ListDNSStagesResponse
6165
from .types import ListPipelinesRequest
6266
from .types import ListPipelinesResponse
67+
from .types import ListPlansResponse
6368
from .types import ListPurgeRequestsRequest
6469
from .types import ListPurgeRequestsResponse
6570
from .types import ListTLSStagesRequest
6671
from .types import ListTLSStagesResponse
72+
from .types import Plan
73+
from .types import SelectPlanRequest
6774
from .types import UpdateBackendStageRequest
6875
from .types import UpdateCacheStageRequest
6976
from .types import UpdateDNSStageRequest
@@ -86,6 +93,7 @@
8693
"PipelineErrorType",
8794
"PipelineStatus",
8895
"PIPELINE_TRANSIENT_STATUSES",
96+
"PlanName",
8997
"PurgeRequestStatus",
9098
"PURGE_REQUEST_TRANSIENT_STATUSES",
9199
"ScalewayLb",
@@ -98,6 +106,7 @@
98106
"CacheStage",
99107
"DNSStage",
100108
"Pipeline",
109+
"PlanDetails",
101110
"PurgeRequest",
102111
"TLSStage",
103112
"TLSSecretsConfig",
@@ -115,11 +124,13 @@
115124
"CreateTLSStageRequest",
116125
"DeleteBackendStageRequest",
117126
"DeleteCacheStageRequest",
127+
"DeleteCurrentPlanRequest",
118128
"DeleteDNSStageRequest",
119129
"DeletePipelineRequest",
120130
"DeleteTLSStageRequest",
121131
"GetBackendStageRequest",
122132
"GetCacheStageRequest",
133+
"GetCurrentPlanRequest",
123134
"GetDNSStageRequest",
124135
"GetPipelineRequest",
125136
"GetPurgeRequestRequest",
@@ -132,10 +143,13 @@
132143
"ListDNSStagesResponse",
133144
"ListPipelinesRequest",
134145
"ListPipelinesResponse",
146+
"ListPlansResponse",
135147
"ListPurgeRequestsRequest",
136148
"ListPurgeRequestsResponse",
137149
"ListTLSStagesRequest",
138150
"ListTLSStagesResponse",
151+
"Plan",
152+
"SelectPlanRequest",
139153
"UpdateBackendStageRequest",
140154
"UpdateCacheStageRequest",
141155
"UpdateDNSStageRequest",

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

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ListPipelinesRequestOrderBy,
1818
ListPurgeRequestsRequestOrderBy,
1919
ListTLSStagesRequestOrderBy,
20+
PlanName,
2021
BackendStage,
2122
CacheStage,
2223
CheckDomainRequest,
@@ -37,13 +38,16 @@
3738
ListCacheStagesResponse,
3839
ListDNSStagesResponse,
3940
ListPipelinesResponse,
41+
ListPlansResponse,
4042
ListPurgeRequestsResponse,
4143
ListTLSStagesResponse,
4244
Pipeline,
45+
Plan,
4346
PurgeRequest,
4447
ScalewayLb,
4548
ScalewayLbBackendConfig,
4649
ScalewayS3BackendConfig,
50+
SelectPlanRequest,
4751
TLSSecret,
4852
TLSSecretsConfig,
4953
TLSStage,
@@ -71,8 +75,10 @@
7175
unmarshal_ListCacheStagesResponse,
7276
unmarshal_ListDNSStagesResponse,
7377
unmarshal_ListPipelinesResponse,
78+
unmarshal_ListPlansResponse,
7479
unmarshal_ListPurgeRequestsResponse,
7580
unmarshal_ListTLSStagesResponse,
81+
unmarshal_Plan,
7682
marshal_CheckDomainRequest,
7783
marshal_CheckLbOriginRequest,
7884
marshal_CheckPEMChainRequest,
@@ -82,6 +88,7 @@
8288
marshal_CreatePipelineRequest,
8389
marshal_CreatePurgeRequestRequest,
8490
marshal_CreateTLSStageRequest,
91+
marshal_SelectPlanRequest,
8592
marshal_UpdateBackendStageRequest,
8693
marshal_UpdateCacheStageRequest,
8794
marshal_UpdateDNSStageRequest,
@@ -1598,3 +1605,106 @@ async def check_lb_origin(
15981605

15991606
self._throw_on_error(res)
16001607
return unmarshal_CheckLbOriginResponse(res.json())
1608+
1609+
async def list_plans(
1610+
self,
1611+
) -> ListPlansResponse:
1612+
"""
1613+
1614+
:return: :class:`ListPlansResponse <ListPlansResponse>`
1615+
1616+
Usage:
1617+
::
1618+
1619+
result = await api.list_plans()
1620+
"""
1621+
1622+
res = self._request(
1623+
"GET",
1624+
"/edge-services/v1alpha1/plans",
1625+
)
1626+
1627+
self._throw_on_error(res)
1628+
return unmarshal_ListPlansResponse(res.json())
1629+
1630+
async def select_plan(
1631+
self,
1632+
*,
1633+
project_id: Optional[str] = None,
1634+
plan_name: Optional[PlanName] = None,
1635+
) -> Plan:
1636+
"""
1637+
:param project_id:
1638+
:param plan_name:
1639+
:return: :class:`Plan <Plan>`
1640+
1641+
Usage:
1642+
::
1643+
1644+
result = await api.select_plan()
1645+
"""
1646+
1647+
res = self._request(
1648+
"PATCH",
1649+
"/edge-services/v1alpha1/current-plan",
1650+
body=marshal_SelectPlanRequest(
1651+
SelectPlanRequest(
1652+
project_id=project_id,
1653+
plan_name=plan_name,
1654+
),
1655+
self.client,
1656+
),
1657+
)
1658+
1659+
self._throw_on_error(res)
1660+
return unmarshal_Plan(res.json())
1661+
1662+
async def get_current_plan(
1663+
self,
1664+
*,
1665+
project_id: Optional[str] = None,
1666+
) -> Plan:
1667+
"""
1668+
:param project_id:
1669+
:return: :class:`Plan <Plan>`
1670+
1671+
Usage:
1672+
::
1673+
1674+
result = await api.get_current_plan()
1675+
"""
1676+
1677+
res = self._request(
1678+
"GET",
1679+
"/edge-services/v1alpha1/current-plan",
1680+
params={
1681+
"project_id": project_id or self.client.default_project_id,
1682+
},
1683+
)
1684+
1685+
self._throw_on_error(res)
1686+
return unmarshal_Plan(res.json())
1687+
1688+
async def delete_current_plan(
1689+
self,
1690+
*,
1691+
project_id: Optional[str] = None,
1692+
) -> None:
1693+
"""
1694+
:param project_id:
1695+
1696+
Usage:
1697+
::
1698+
1699+
result = await api.delete_current_plan()
1700+
"""
1701+
1702+
res = self._request(
1703+
"DELETE",
1704+
"/edge-services/v1alpha1/current-plan",
1705+
params={
1706+
"project_id": project_id or self.client.default_project_id,
1707+
},
1708+
)
1709+
1710+
self._throw_on_error(res)

scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
ListCacheStagesResponse,
2929
ListDNSStagesResponse,
3030
ListPipelinesResponse,
31+
PlanDetails,
32+
ListPlansResponse,
3133
ListPurgeRequestsResponse,
3234
ListTLSStagesResponse,
35+
Plan,
3336
CheckDomainRequest,
3437
CheckLbOriginRequest,
3538
CheckPEMChainRequestSecretChain,
@@ -40,6 +43,7 @@
4043
CreatePipelineRequest,
4144
CreatePurgeRequestRequest,
4245
CreateTLSStageRequest,
46+
SelectPlanRequest,
4347
UpdateBackendStageRequest,
4448
UpdateCacheStageRequest,
4549
UpdateDNSStageRequest,
@@ -643,6 +647,50 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse:
643647
return ListPipelinesResponse(**args)
644648

645649

650+
def unmarshal_PlanDetails(data: Any) -> PlanDetails:
651+
if not isinstance(data, dict):
652+
raise TypeError(
653+
"Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary."
654+
)
655+
656+
args: Dict[str, Any] = {}
657+
658+
field = data.get("plan_name", None)
659+
if field is not None:
660+
args["plan_name"] = field
661+
662+
field = data.get("package_gb", None)
663+
if field is not None:
664+
args["package_gb"] = field
665+
666+
field = data.get("pipeline_limit", None)
667+
if field is not None:
668+
args["pipeline_limit"] = field
669+
670+
return PlanDetails(**args)
671+
672+
673+
def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse:
674+
if not isinstance(data, dict):
675+
raise TypeError(
676+
"Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary."
677+
)
678+
679+
args: Dict[str, Any] = {}
680+
681+
field = data.get("total_count", None)
682+
if field is not None:
683+
args["total_count"] = field
684+
685+
field = data.get("plans", None)
686+
if field is not None:
687+
args["plans"] = (
688+
[unmarshal_PlanDetails(v) for v in field] if field is not None else None
689+
)
690+
691+
return ListPlansResponse(**args)
692+
693+
646694
def unmarshal_ListPurgeRequestsResponse(data: Any) -> ListPurgeRequestsResponse:
647695
if not isinstance(data, dict):
648696
raise TypeError(
@@ -685,6 +733,21 @@ def unmarshal_ListTLSStagesResponse(data: Any) -> ListTLSStagesResponse:
685733
return ListTLSStagesResponse(**args)
686734

687735

736+
def unmarshal_Plan(data: Any) -> Plan:
737+
if not isinstance(data, dict):
738+
raise TypeError(
739+
"Unmarshalling the type 'Plan' failed as data isn't a dictionary."
740+
)
741+
742+
args: Dict[str, Any] = {}
743+
744+
field = data.get("plan_name", None)
745+
if field is not None:
746+
args["plan_name"] = field
747+
748+
return Plan(**args)
749+
750+
688751
def marshal_CheckDomainRequest(
689752
request: CheckDomainRequest,
690753
defaults: ProfileDefaults,
@@ -961,6 +1024,21 @@ def marshal_CreateTLSStageRequest(
9611024
return output
9621025

9631026

1027+
def marshal_SelectPlanRequest(
1028+
request: SelectPlanRequest,
1029+
defaults: ProfileDefaults,
1030+
) -> Dict[str, Any]:
1031+
output: Dict[str, Any] = {}
1032+
1033+
if request.project_id is not None:
1034+
output["project_id"] = request.project_id or defaults.default_project_id
1035+
1036+
if request.plan_name is not None:
1037+
output["plan_name"] = str(request.plan_name)
1038+
1039+
return output
1040+
1041+
9641042
def marshal_UpdateBackendStageRequest(
9651043
request: UpdateBackendStageRequest,
9661044
defaults: ProfileDefaults,

0 commit comments

Comments
 (0)