Skip to content

Commit fd86c1f

Browse files
authored
feat(edge_services): add GetPipelineStages endpoint (scaleway#669)
1 parent 1fd3001 commit fd86c1f

File tree

8 files changed

+684
-184
lines changed

8 files changed

+684
-184
lines changed

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@
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
2021
from .types import ScalewayLbBackendConfig
2122
from .types import ScalewayS3BackendConfig
2223
from .types import PipelineError
2324
from .types import TLSSecret
24-
from .types import CheckPEMChainRequestSecretChain
2525
from .types import BackendStage
2626
from .types import CacheStage
2727
from .types import DNSStage
2828
from .types import Pipeline
29-
from .types import PurgeRequest
3029
from .types import TLSStage
30+
from .types import CheckPEMChainRequestSecretChain
31+
from .types import PlanDetails
32+
from .types import PurgeRequest
3133
from .types import TLSSecretsConfig
3234
from .types import CheckDomainRequest
3335
from .types import CheckDomainResponse
@@ -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,20 +93,22 @@
8693
"PipelineErrorType",
8794
"PipelineStatus",
8895
"PIPELINE_TRANSIENT_STATUSES",
96+
"PlanName",
8997
"PurgeRequestStatus",
9098
"PURGE_REQUEST_TRANSIENT_STATUSES",
9199
"ScalewayLb",
92100
"ScalewayLbBackendConfig",
93101
"ScalewayS3BackendConfig",
94102
"PipelineError",
95103
"TLSSecret",
96-
"CheckPEMChainRequestSecretChain",
97104
"BackendStage",
98105
"CacheStage",
99106
"DNSStage",
100107
"Pipeline",
101-
"PurgeRequest",
102108
"TLSStage",
109+
"CheckPEMChainRequestSecretChain",
110+
"PlanDetails",
111+
"PurgeRequest",
103112
"TLSSecretsConfig",
104113
"CheckDomainRequest",
105114
"CheckDomainResponse",
@@ -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: 111 additions & 1 deletion
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,
@@ -62,17 +66,19 @@
6266
unmarshal_CacheStage,
6367
unmarshal_DNSStage,
6468
unmarshal_Pipeline,
65-
unmarshal_PurgeRequest,
6669
unmarshal_TLSStage,
70+
unmarshal_PurgeRequest,
6771
unmarshal_CheckDomainResponse,
6872
unmarshal_CheckLbOriginResponse,
6973
unmarshal_CheckPEMChainResponse,
7074
unmarshal_ListBackendStagesResponse,
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)

0 commit comments

Comments
 (0)