Skip to content

Commit

Permalink
feat(edge_services): add GetPipelineStages endpoint (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Sep 30, 2024
1 parent 1fd3001 commit fd86c1f
Show file tree
Hide file tree
Showing 8 changed files with 684 additions and 184 deletions.
22 changes: 18 additions & 4 deletions scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@
from .types import PipelineErrorType
from .types import PipelineStatus
from .content import PIPELINE_TRANSIENT_STATUSES
from .types import PlanName
from .types import PurgeRequestStatus
from .content import PURGE_REQUEST_TRANSIENT_STATUSES
from .types import ScalewayLb
from .types import ScalewayLbBackendConfig
from .types import ScalewayS3BackendConfig
from .types import PipelineError
from .types import TLSSecret
from .types import CheckPEMChainRequestSecretChain
from .types import BackendStage
from .types import CacheStage
from .types import DNSStage
from .types import Pipeline
from .types import PurgeRequest
from .types import TLSStage
from .types import CheckPEMChainRequestSecretChain
from .types import PlanDetails
from .types import PurgeRequest
from .types import TLSSecretsConfig
from .types import CheckDomainRequest
from .types import CheckDomainResponse
Expand All @@ -43,11 +45,13 @@
from .types import CreateTLSStageRequest
from .types import DeleteBackendStageRequest
from .types import DeleteCacheStageRequest
from .types import DeleteCurrentPlanRequest
from .types import DeleteDNSStageRequest
from .types import DeletePipelineRequest
from .types import DeleteTLSStageRequest
from .types import GetBackendStageRequest
from .types import GetCacheStageRequest
from .types import GetCurrentPlanRequest
from .types import GetDNSStageRequest
from .types import GetPipelineRequest
from .types import GetPurgeRequestRequest
Expand All @@ -60,10 +64,13 @@
from .types import ListDNSStagesResponse
from .types import ListPipelinesRequest
from .types import ListPipelinesResponse
from .types import ListPlansResponse
from .types import ListPurgeRequestsRequest
from .types import ListPurgeRequestsResponse
from .types import ListTLSStagesRequest
from .types import ListTLSStagesResponse
from .types import Plan
from .types import SelectPlanRequest
from .types import UpdateBackendStageRequest
from .types import UpdateCacheStageRequest
from .types import UpdateDNSStageRequest
Expand All @@ -86,20 +93,22 @@
"PipelineErrorType",
"PipelineStatus",
"PIPELINE_TRANSIENT_STATUSES",
"PlanName",
"PurgeRequestStatus",
"PURGE_REQUEST_TRANSIENT_STATUSES",
"ScalewayLb",
"ScalewayLbBackendConfig",
"ScalewayS3BackendConfig",
"PipelineError",
"TLSSecret",
"CheckPEMChainRequestSecretChain",
"BackendStage",
"CacheStage",
"DNSStage",
"Pipeline",
"PurgeRequest",
"TLSStage",
"CheckPEMChainRequestSecretChain",
"PlanDetails",
"PurgeRequest",
"TLSSecretsConfig",
"CheckDomainRequest",
"CheckDomainResponse",
Expand All @@ -115,11 +124,13 @@
"CreateTLSStageRequest",
"DeleteBackendStageRequest",
"DeleteCacheStageRequest",
"DeleteCurrentPlanRequest",
"DeleteDNSStageRequest",
"DeletePipelineRequest",
"DeleteTLSStageRequest",
"GetBackendStageRequest",
"GetCacheStageRequest",
"GetCurrentPlanRequest",
"GetDNSStageRequest",
"GetPipelineRequest",
"GetPurgeRequestRequest",
Expand All @@ -132,10 +143,13 @@
"ListDNSStagesResponse",
"ListPipelinesRequest",
"ListPipelinesResponse",
"ListPlansResponse",
"ListPurgeRequestsRequest",
"ListPurgeRequestsResponse",
"ListTLSStagesRequest",
"ListTLSStagesResponse",
"Plan",
"SelectPlanRequest",
"UpdateBackendStageRequest",
"UpdateCacheStageRequest",
"UpdateDNSStageRequest",
Expand Down
112 changes: 111 additions & 1 deletion scaleway-async/scaleway_async/edge_services/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ListPipelinesRequestOrderBy,
ListPurgeRequestsRequestOrderBy,
ListTLSStagesRequestOrderBy,
PlanName,
BackendStage,
CacheStage,
CheckDomainRequest,
Expand All @@ -37,13 +38,16 @@
ListCacheStagesResponse,
ListDNSStagesResponse,
ListPipelinesResponse,
ListPlansResponse,
ListPurgeRequestsResponse,
ListTLSStagesResponse,
Pipeline,
Plan,
PurgeRequest,
ScalewayLb,
ScalewayLbBackendConfig,
ScalewayS3BackendConfig,
SelectPlanRequest,
TLSSecret,
TLSSecretsConfig,
TLSStage,
Expand All @@ -62,17 +66,19 @@
unmarshal_CacheStage,
unmarshal_DNSStage,
unmarshal_Pipeline,
unmarshal_PurgeRequest,
unmarshal_TLSStage,
unmarshal_PurgeRequest,
unmarshal_CheckDomainResponse,
unmarshal_CheckLbOriginResponse,
unmarshal_CheckPEMChainResponse,
unmarshal_ListBackendStagesResponse,
unmarshal_ListCacheStagesResponse,
unmarshal_ListDNSStagesResponse,
unmarshal_ListPipelinesResponse,
unmarshal_ListPlansResponse,
unmarshal_ListPurgeRequestsResponse,
unmarshal_ListTLSStagesResponse,
unmarshal_Plan,
marshal_CheckDomainRequest,
marshal_CheckLbOriginRequest,
marshal_CheckPEMChainRequest,
Expand All @@ -82,6 +88,7 @@
marshal_CreatePipelineRequest,
marshal_CreatePurgeRequestRequest,
marshal_CreateTLSStageRequest,
marshal_SelectPlanRequest,
marshal_UpdateBackendStageRequest,
marshal_UpdateCacheStageRequest,
marshal_UpdateDNSStageRequest,
Expand Down Expand Up @@ -1598,3 +1605,106 @@ async def check_lb_origin(

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

async def list_plans(
self,
) -> ListPlansResponse:
"""
:return: :class:`ListPlansResponse <ListPlansResponse>`
Usage:
::
result = await api.list_plans()
"""

res = self._request(
"GET",
"/edge-services/v1alpha1/plans",
)

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

async def select_plan(
self,
*,
project_id: Optional[str] = None,
plan_name: Optional[PlanName] = None,
) -> Plan:
"""
:param project_id:
:param plan_name:
:return: :class:`Plan <Plan>`
Usage:
::
result = await api.select_plan()
"""

res = self._request(
"PATCH",
"/edge-services/v1alpha1/current-plan",
body=marshal_SelectPlanRequest(
SelectPlanRequest(
project_id=project_id,
plan_name=plan_name,
),
self.client,
),
)

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

async def get_current_plan(
self,
*,
project_id: Optional[str] = None,
) -> Plan:
"""
:param project_id:
:return: :class:`Plan <Plan>`
Usage:
::
result = await api.get_current_plan()
"""

res = self._request(
"GET",
"/edge-services/v1alpha1/current-plan",
params={
"project_id": project_id or self.client.default_project_id,
},
)

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

async def delete_current_plan(
self,
*,
project_id: Optional[str] = None,
) -> None:
"""
:param project_id:
Usage:
::
result = await api.delete_current_plan()
"""

res = self._request(
"DELETE",
"/edge-services/v1alpha1/current-plan",
params={
"project_id": project_id or self.client.default_project_id,
},
)

self._throw_on_error(res)
Loading

0 comments on commit fd86c1f

Please sign in to comment.