diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py index efefae07c..3b7aa44b5 100644 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py @@ -6,6 +6,7 @@ from .types import ListCacheStagesRequestOrderBy from .types import ListDNSStagesRequestOrderBy from .types import ListPipelinesRequestOrderBy +from .types import ListPipelinesWithStagesRequestOrderBy from .types import ListPurgeRequestsRequestOrderBy from .types import ListTLSStagesRequestOrderBy from .types import PipelineErrorCode @@ -29,6 +30,7 @@ from .types import TLSStage from .types import CheckPEMChainRequestSecretChain from .types import PlanDetails +from .types import PipelineStages from .types import PurgeRequest from .types import TLSSecretsConfig from .types import CheckDomainRequest @@ -66,6 +68,8 @@ from .types import ListDNSStagesResponse from .types import ListPipelinesRequest from .types import ListPipelinesResponse +from .types import ListPipelinesWithStagesRequest +from .types import ListPipelinesWithStagesResponse from .types import ListPlansResponse from .types import ListPurgeRequestsRequest from .types import ListPurgeRequestsResponse @@ -87,6 +91,7 @@ "ListCacheStagesRequestOrderBy", "ListDNSStagesRequestOrderBy", "ListPipelinesRequestOrderBy", + "ListPipelinesWithStagesRequestOrderBy", "ListPurgeRequestsRequestOrderBy", "ListTLSStagesRequestOrderBy", "PipelineErrorCode", @@ -110,6 +115,7 @@ "TLSStage", "CheckPEMChainRequestSecretChain", "PlanDetails", + "PipelineStages", "PurgeRequest", "TLSSecretsConfig", "CheckDomainRequest", @@ -147,6 +153,8 @@ "ListDNSStagesResponse", "ListPipelinesRequest", "ListPipelinesResponse", + "ListPipelinesWithStagesRequest", + "ListPipelinesWithStagesResponse", "ListPlansResponse", "ListPurgeRequestsRequest", "ListPurgeRequestsResponse", diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py index ad75550bf..094f79c29 100644 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py @@ -15,6 +15,7 @@ ListCacheStagesRequestOrderBy, ListDNSStagesRequestOrderBy, ListPipelinesRequestOrderBy, + ListPipelinesWithStagesRequestOrderBy, ListPurgeRequestsRequestOrderBy, ListTLSStagesRequestOrderBy, PlanName, @@ -39,10 +40,12 @@ ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, Pipeline, + PipelineStages, Plan, PurgeRequest, ScalewayLb, @@ -77,6 +80,7 @@ unmarshal_ListCacheStagesResponse, unmarshal_ListDNSStagesResponse, unmarshal_ListPipelinesResponse, + unmarshal_ListPipelinesWithStagesResponse, unmarshal_ListPlansResponse, unmarshal_ListPurgeRequestsResponse, unmarshal_ListTLSStagesResponse, @@ -302,6 +306,87 @@ async def wait_for_pipeline( }, ) + async def list_pipelines_with_stages( + self, + *, + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + name: Optional[str] = None, + organization_id: Optional[str] = None, + project_id: Optional[str] = None, + ) -> ListPipelinesWithStagesResponse: + """ + :param order_by: + :param page: + :param page_size: + :param name: + :param organization_id: + :param project_id: + :return: :class:`ListPipelinesWithStagesResponse ` + + Usage: + :: + + result = await api.list_pipelines_with_stages() + """ + + res = self._request( + "GET", + "/edge-services/v1alpha1/pipelines-stages", + params={ + "name": name, + "order_by": order_by, + "organization_id": organization_id + or self.client.default_organization_id, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPipelinesWithStagesResponse(res.json()) + + async def list_pipelines_with_stages_all( + self, + *, + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + name: Optional[str] = None, + organization_id: Optional[str] = None, + project_id: Optional[str] = None, + ) -> List[PipelineStages]: + """ + :param order_by: + :param page: + :param page_size: + :param name: + :param organization_id: + :param project_id: + :return: :class:`List[PipelineStages] ` + + Usage: + :: + + result = await api.list_pipelines_with_stages_all() + """ + + return await fetch_all_pages_async( + type=ListPipelinesWithStagesResponse, + key="pipelines", + fetcher=self.list_pipelines_with_stages, + args={ + "order_by": order_by, + "page": page, + "page_size": page_size, + "name": name, + "organization_id": organization_id, + "project_id": project_id, + }, + ) + async def update_pipeline( self, *, @@ -1719,7 +1804,7 @@ async def get_billing( project_id: Optional[str] = None, ) -> GetBillingResponse: """ - Gives information on current edge-services subscription plan and used resources with associated price. + Gives information on the currently selected Edge Services subscription plan, resource usage and associated billing information for this calendar month (including whether consumption falls within or exceeds the currently selected subscription plan.). :param project_id: :return: :class:`GetBillingResponse ` diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py index 8cf064dda..c785ee636 100644 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py @@ -23,6 +23,7 @@ Pipeline, TLSSecret, TLSStage, + PipelineStages, PurgeRequest, CheckDomainResponse, CheckLbOriginResponse, @@ -33,6 +34,7 @@ ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, @@ -471,6 +473,47 @@ def unmarshal_TLSStage(data: Any) -> TLSStage: return TLSStage(**args) +def unmarshal_PipelineStages(data: Any) -> PipelineStages: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PipelineStages' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("dns_stages", None) + if field is not None: + args["dns_stages"] = ( + [unmarshal_DNSStage(v) for v in field] if field is not None else None + ) + + field = data.get("tls_stages", None) + if field is not None: + args["tls_stages"] = ( + [unmarshal_TLSStage(v) for v in field] if field is not None else None + ) + + field = data.get("cache_stages", None) + if field is not None: + args["cache_stages"] = ( + [unmarshal_CacheStage(v) for v in field] if field is not None else None + ) + + field = data.get("backend_stages", None) + if field is not None: + args["backend_stages"] = ( + [unmarshal_BackendStage(v) for v in field] if field is not None else None + ) + + field = data.get("pipeline", None) + if field is not None: + args["pipeline"] = unmarshal_Pipeline(field) + else: + args["pipeline"] = None + + return PipelineStages(**args) + + def unmarshal_PurgeRequest(data: Any) -> PurgeRequest: if not isinstance(data, dict): raise TypeError( @@ -727,6 +770,29 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse: return ListPipelinesResponse(**args) +def unmarshal_ListPipelinesWithStagesResponse( + data: Any, +) -> ListPipelinesWithStagesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPipelinesWithStagesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("pipelines", None) + if field is not None: + args["pipelines"] = ( + [unmarshal_PipelineStages(v) for v in field] if field is not None else None + ) + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + return ListPipelinesWithStagesResponse(**args) + + def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py index b77f4d1f8..e5aeed715 100644 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py @@ -71,6 +71,16 @@ def __str__(self) -> str: return str(self.value) +class ListPipelinesWithStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + NAME_ASC = "name_asc" + NAME_DESC = "name_desc" + + def __str__(self) -> str: + return str(self.value) + + class ListPurgeRequestsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_ASC = "created_at_asc" CREATED_AT_DESC = "created_at_desc" @@ -484,10 +494,23 @@ class PlanDetails: pipeline_limit: int """ - Number of pipeline included in subscription plan. + Number of pipelines included in subscription plan. """ +@dataclass +class PipelineStages: + dns_stages: List[DNSStage] + + tls_stages: List[TLSStage] + + cache_stages: List[CacheStage] + + backend_stages: List[BackendStage] + + pipeline: Optional[Pipeline] + + @dataclass class PurgeRequest: id: str @@ -732,22 +755,22 @@ class GetBillingRequest: class GetBillingResponse: pipeline_number: int """ - Total number of pipeline currently configured. + Total number of pipelines currently configured. """ current_plan_cache_usage: int """ - Total amount of data egressed from cache in current subscription plan. + Total amount of data egressed from the cache (this month), included in the active subscription plan. """ extra_cache_usage: int """ - Total amount of data egressed from cache not included in the plans. + Total amount of data egressed from cache (this month), not included in the active subscription plan. """ current_plan: Optional[PlanDetails] """ - Information on the current edge-service subscription plan. + Information on the currently-selected, active Edge Services subscription plan. """ plan_cost: Optional[Money] @@ -757,17 +780,17 @@ class GetBillingResponse: extra_pipelines_cost: Optional[Money] """ - Cost to date of the pipelines not included in the plans. + Cost to date (this month) of pipelines not included in the subscription plan. """ extra_cache_cost: Optional[Money] """ - Cost to date of the data egressed from cache not included in the plans. + Cost to date (this month) of the data egressed from the cache that is not included in the active subscription plan. """ total_cost: Optional[Money] """ - Total cost to date of edge-service product for the month including current plan, previous plans, extra pipelines and extra egress cache data. + Total cost to date (this month) of all Edge Services resources including active subscription plan, previously active plans, extra pipelines and extra egress cache data. """ @@ -1010,6 +1033,28 @@ class ListPipelinesResponse: """ +@dataclass +class ListPipelinesWithStagesRequest: + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] + + page: Optional[int] + + page_size: Optional[int] + + name: Optional[str] + + organization_id: Optional[str] + + project_id: Optional[str] + + +@dataclass +class ListPipelinesWithStagesResponse: + pipelines: List[PipelineStages] + + total_count: int + + @dataclass class ListPlansResponse: total_count: int diff --git a/scaleway/scaleway/edge_services/v1alpha1/__init__.py b/scaleway/scaleway/edge_services/v1alpha1/__init__.py index efefae07c..3b7aa44b5 100644 --- a/scaleway/scaleway/edge_services/v1alpha1/__init__.py +++ b/scaleway/scaleway/edge_services/v1alpha1/__init__.py @@ -6,6 +6,7 @@ from .types import ListCacheStagesRequestOrderBy from .types import ListDNSStagesRequestOrderBy from .types import ListPipelinesRequestOrderBy +from .types import ListPipelinesWithStagesRequestOrderBy from .types import ListPurgeRequestsRequestOrderBy from .types import ListTLSStagesRequestOrderBy from .types import PipelineErrorCode @@ -29,6 +30,7 @@ from .types import TLSStage from .types import CheckPEMChainRequestSecretChain from .types import PlanDetails +from .types import PipelineStages from .types import PurgeRequest from .types import TLSSecretsConfig from .types import CheckDomainRequest @@ -66,6 +68,8 @@ from .types import ListDNSStagesResponse from .types import ListPipelinesRequest from .types import ListPipelinesResponse +from .types import ListPipelinesWithStagesRequest +from .types import ListPipelinesWithStagesResponse from .types import ListPlansResponse from .types import ListPurgeRequestsRequest from .types import ListPurgeRequestsResponse @@ -87,6 +91,7 @@ "ListCacheStagesRequestOrderBy", "ListDNSStagesRequestOrderBy", "ListPipelinesRequestOrderBy", + "ListPipelinesWithStagesRequestOrderBy", "ListPurgeRequestsRequestOrderBy", "ListTLSStagesRequestOrderBy", "PipelineErrorCode", @@ -110,6 +115,7 @@ "TLSStage", "CheckPEMChainRequestSecretChain", "PlanDetails", + "PipelineStages", "PurgeRequest", "TLSSecretsConfig", "CheckDomainRequest", @@ -147,6 +153,8 @@ "ListDNSStagesResponse", "ListPipelinesRequest", "ListPipelinesResponse", + "ListPipelinesWithStagesRequest", + "ListPipelinesWithStagesResponse", "ListPlansResponse", "ListPurgeRequestsRequest", "ListPurgeRequestsResponse", diff --git a/scaleway/scaleway/edge_services/v1alpha1/api.py b/scaleway/scaleway/edge_services/v1alpha1/api.py index 2865c2b83..44ea7a35c 100644 --- a/scaleway/scaleway/edge_services/v1alpha1/api.py +++ b/scaleway/scaleway/edge_services/v1alpha1/api.py @@ -15,6 +15,7 @@ ListCacheStagesRequestOrderBy, ListDNSStagesRequestOrderBy, ListPipelinesRequestOrderBy, + ListPipelinesWithStagesRequestOrderBy, ListPurgeRequestsRequestOrderBy, ListTLSStagesRequestOrderBy, PlanName, @@ -39,10 +40,12 @@ ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, Pipeline, + PipelineStages, Plan, PurgeRequest, ScalewayLb, @@ -77,6 +80,7 @@ unmarshal_ListCacheStagesResponse, unmarshal_ListDNSStagesResponse, unmarshal_ListPipelinesResponse, + unmarshal_ListPipelinesWithStagesResponse, unmarshal_ListPlansResponse, unmarshal_ListPurgeRequestsResponse, unmarshal_ListTLSStagesResponse, @@ -300,6 +304,87 @@ def wait_for_pipeline( }, ) + def list_pipelines_with_stages( + self, + *, + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + name: Optional[str] = None, + organization_id: Optional[str] = None, + project_id: Optional[str] = None, + ) -> ListPipelinesWithStagesResponse: + """ + :param order_by: + :param page: + :param page_size: + :param name: + :param organization_id: + :param project_id: + :return: :class:`ListPipelinesWithStagesResponse ` + + Usage: + :: + + result = api.list_pipelines_with_stages() + """ + + res = self._request( + "GET", + "/edge-services/v1alpha1/pipelines-stages", + params={ + "name": name, + "order_by": order_by, + "organization_id": organization_id + or self.client.default_organization_id, + "page": page, + "page_size": page_size or self.client.default_page_size, + "project_id": project_id or self.client.default_project_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListPipelinesWithStagesResponse(res.json()) + + def list_pipelines_with_stages_all( + self, + *, + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + name: Optional[str] = None, + organization_id: Optional[str] = None, + project_id: Optional[str] = None, + ) -> List[PipelineStages]: + """ + :param order_by: + :param page: + :param page_size: + :param name: + :param organization_id: + :param project_id: + :return: :class:`List[PipelineStages] ` + + Usage: + :: + + result = api.list_pipelines_with_stages_all() + """ + + return fetch_all_pages( + type=ListPipelinesWithStagesResponse, + key="pipelines", + fetcher=self.list_pipelines_with_stages, + args={ + "order_by": order_by, + "page": page, + "page_size": page_size, + "name": name, + "organization_id": organization_id, + "project_id": project_id, + }, + ) + def update_pipeline( self, *, @@ -1715,7 +1800,7 @@ def get_billing( project_id: Optional[str] = None, ) -> GetBillingResponse: """ - Gives information on current edge-services subscription plan and used resources with associated price. + Gives information on the currently selected Edge Services subscription plan, resource usage and associated billing information for this calendar month (including whether consumption falls within or exceeds the currently selected subscription plan.). :param project_id: :return: :class:`GetBillingResponse ` diff --git a/scaleway/scaleway/edge_services/v1alpha1/marshalling.py b/scaleway/scaleway/edge_services/v1alpha1/marshalling.py index 8cf064dda..c785ee636 100644 --- a/scaleway/scaleway/edge_services/v1alpha1/marshalling.py +++ b/scaleway/scaleway/edge_services/v1alpha1/marshalling.py @@ -23,6 +23,7 @@ Pipeline, TLSSecret, TLSStage, + PipelineStages, PurgeRequest, CheckDomainResponse, CheckLbOriginResponse, @@ -33,6 +34,7 @@ ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, + ListPipelinesWithStagesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, @@ -471,6 +473,47 @@ def unmarshal_TLSStage(data: Any) -> TLSStage: return TLSStage(**args) +def unmarshal_PipelineStages(data: Any) -> PipelineStages: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PipelineStages' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("dns_stages", None) + if field is not None: + args["dns_stages"] = ( + [unmarshal_DNSStage(v) for v in field] if field is not None else None + ) + + field = data.get("tls_stages", None) + if field is not None: + args["tls_stages"] = ( + [unmarshal_TLSStage(v) for v in field] if field is not None else None + ) + + field = data.get("cache_stages", None) + if field is not None: + args["cache_stages"] = ( + [unmarshal_CacheStage(v) for v in field] if field is not None else None + ) + + field = data.get("backend_stages", None) + if field is not None: + args["backend_stages"] = ( + [unmarshal_BackendStage(v) for v in field] if field is not None else None + ) + + field = data.get("pipeline", None) + if field is not None: + args["pipeline"] = unmarshal_Pipeline(field) + else: + args["pipeline"] = None + + return PipelineStages(**args) + + def unmarshal_PurgeRequest(data: Any) -> PurgeRequest: if not isinstance(data, dict): raise TypeError( @@ -727,6 +770,29 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse: return ListPipelinesResponse(**args) +def unmarshal_ListPipelinesWithStagesResponse( + data: Any, +) -> ListPipelinesWithStagesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListPipelinesWithStagesResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("pipelines", None) + if field is not None: + args["pipelines"] = ( + [unmarshal_PipelineStages(v) for v in field] if field is not None else None + ) + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + + return ListPipelinesWithStagesResponse(**args) + + def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/edge_services/v1alpha1/types.py b/scaleway/scaleway/edge_services/v1alpha1/types.py index b77f4d1f8..e5aeed715 100644 --- a/scaleway/scaleway/edge_services/v1alpha1/types.py +++ b/scaleway/scaleway/edge_services/v1alpha1/types.py @@ -71,6 +71,16 @@ def __str__(self) -> str: return str(self.value) +class ListPipelinesWithStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + NAME_ASC = "name_asc" + NAME_DESC = "name_desc" + + def __str__(self) -> str: + return str(self.value) + + class ListPurgeRequestsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_ASC = "created_at_asc" CREATED_AT_DESC = "created_at_desc" @@ -484,10 +494,23 @@ class PlanDetails: pipeline_limit: int """ - Number of pipeline included in subscription plan. + Number of pipelines included in subscription plan. """ +@dataclass +class PipelineStages: + dns_stages: List[DNSStage] + + tls_stages: List[TLSStage] + + cache_stages: List[CacheStage] + + backend_stages: List[BackendStage] + + pipeline: Optional[Pipeline] + + @dataclass class PurgeRequest: id: str @@ -732,22 +755,22 @@ class GetBillingRequest: class GetBillingResponse: pipeline_number: int """ - Total number of pipeline currently configured. + Total number of pipelines currently configured. """ current_plan_cache_usage: int """ - Total amount of data egressed from cache in current subscription plan. + Total amount of data egressed from the cache (this month), included in the active subscription plan. """ extra_cache_usage: int """ - Total amount of data egressed from cache not included in the plans. + Total amount of data egressed from cache (this month), not included in the active subscription plan. """ current_plan: Optional[PlanDetails] """ - Information on the current edge-service subscription plan. + Information on the currently-selected, active Edge Services subscription plan. """ plan_cost: Optional[Money] @@ -757,17 +780,17 @@ class GetBillingResponse: extra_pipelines_cost: Optional[Money] """ - Cost to date of the pipelines not included in the plans. + Cost to date (this month) of pipelines not included in the subscription plan. """ extra_cache_cost: Optional[Money] """ - Cost to date of the data egressed from cache not included in the plans. + Cost to date (this month) of the data egressed from the cache that is not included in the active subscription plan. """ total_cost: Optional[Money] """ - Total cost to date of edge-service product for the month including current plan, previous plans, extra pipelines and extra egress cache data. + Total cost to date (this month) of all Edge Services resources including active subscription plan, previously active plans, extra pipelines and extra egress cache data. """ @@ -1010,6 +1033,28 @@ class ListPipelinesResponse: """ +@dataclass +class ListPipelinesWithStagesRequest: + order_by: Optional[ListPipelinesWithStagesRequestOrderBy] + + page: Optional[int] + + page_size: Optional[int] + + name: Optional[str] + + organization_id: Optional[str] + + project_id: Optional[str] + + +@dataclass +class ListPipelinesWithStagesResponse: + pipelines: List[PipelineStages] + + total_count: int + + @dataclass class ListPlansResponse: total_count: int