Skip to content

Commit 01ae456

Browse files
authored
Merge branch 'main' into baremetal-v1
2 parents eaac381 + be8d0c2 commit 01ae456

File tree

16 files changed

+1418
-48
lines changed

16 files changed

+1418
-48
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
from .types import DeletePipelineRequest
5151
from .types import DeleteTLSStageRequest
5252
from .types import GetBackendStageRequest
53+
from .types import GetBillingRequest
54+
from .types import GetBillingResponse
5355
from .types import GetCacheStageRequest
5456
from .types import GetCurrentPlanRequest
5557
from .types import GetDNSStageRequest
@@ -129,6 +131,8 @@
129131
"DeletePipelineRequest",
130132
"DeleteTLSStageRequest",
131133
"GetBackendStageRequest",
134+
"GetBillingRequest",
135+
"GetBillingResponse",
132136
"GetCacheStageRequest",
133137
"GetCurrentPlanRequest",
134138
"GetDNSStageRequest",

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
CreatePurgeRequestRequest,
3535
CreateTLSStageRequest,
3636
DNSStage,
37+
GetBillingResponse,
3738
ListBackendStagesResponse,
3839
ListCacheStagesResponse,
3940
ListDNSStagesResponse,
@@ -71,6 +72,7 @@
7172
unmarshal_CheckDomainResponse,
7273
unmarshal_CheckLbOriginResponse,
7374
unmarshal_CheckPEMChainResponse,
75+
unmarshal_GetBillingResponse,
7476
unmarshal_ListBackendStagesResponse,
7577
unmarshal_ListCacheStagesResponse,
7678
unmarshal_ListDNSStagesResponse,
@@ -1710,3 +1712,31 @@ async def delete_current_plan(
17101712
)
17111713

17121714
self._throw_on_error(res)
1715+
1716+
async def get_billing(
1717+
self,
1718+
*,
1719+
project_id: Optional[str] = None,
1720+
) -> GetBillingResponse:
1721+
"""
1722+
Gives information on current edge-services subscription plan and used resources with associated price.
1723+
:param project_id:
1724+
:return: :class:`GetBillingResponse <GetBillingResponse>`
1725+
1726+
Usage:
1727+
::
1728+
1729+
result = await api.get_billing()
1730+
"""
1731+
1732+
param_project_id = validate_path_param(
1733+
"project_id", project_id or self.client.default_project_id
1734+
)
1735+
1736+
res = self._request(
1737+
"GET",
1738+
f"/edge-services/v1alpha1/billing/{param_project_id}",
1739+
)
1740+
1741+
self._throw_on_error(res)
1742+
return unmarshal_GetBillingResponse(res.json())

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

Lines changed: 81 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from dateutil import parser
66

77
from scaleway_core.profile import ProfileDefaults
8+
from scaleway_core.bridge import (
9+
unmarshal_Money,
10+
)
811
from scaleway_core.utils import (
912
OneOfPossibility,
1013
resolve_one_of,
@@ -24,11 +27,12 @@
2427
CheckDomainResponse,
2528
CheckLbOriginResponse,
2629
CheckPEMChainResponse,
30+
PlanDetails,
31+
GetBillingResponse,
2732
ListBackendStagesResponse,
2833
ListCacheStagesResponse,
2934
ListDNSStagesResponse,
3035
ListPipelinesResponse,
31-
PlanDetails,
3236
ListPlansResponse,
3337
ListPurgeRequestsResponse,
3438
ListTLSStagesResponse,
@@ -563,6 +567,82 @@ def unmarshal_CheckPEMChainResponse(data: Any) -> CheckPEMChainResponse:
563567
return CheckPEMChainResponse(**args)
564568

565569

570+
def unmarshal_PlanDetails(data: Any) -> PlanDetails:
571+
if not isinstance(data, dict):
572+
raise TypeError(
573+
"Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary."
574+
)
575+
576+
args: Dict[str, Any] = {}
577+
578+
field = data.get("plan_name", None)
579+
if field is not None:
580+
args["plan_name"] = field
581+
582+
field = data.get("package_gb", None)
583+
if field is not None:
584+
args["package_gb"] = field
585+
586+
field = data.get("pipeline_limit", None)
587+
if field is not None:
588+
args["pipeline_limit"] = field
589+
590+
return PlanDetails(**args)
591+
592+
593+
def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse:
594+
if not isinstance(data, dict):
595+
raise TypeError(
596+
"Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary."
597+
)
598+
599+
args: Dict[str, Any] = {}
600+
601+
field = data.get("pipeline_number", None)
602+
if field is not None:
603+
args["pipeline_number"] = field
604+
605+
field = data.get("current_plan_cache_usage", None)
606+
if field is not None:
607+
args["current_plan_cache_usage"] = field
608+
609+
field = data.get("extra_cache_usage", None)
610+
if field is not None:
611+
args["extra_cache_usage"] = field
612+
613+
field = data.get("current_plan", None)
614+
if field is not None:
615+
args["current_plan"] = unmarshal_PlanDetails(field)
616+
else:
617+
args["current_plan"] = None
618+
619+
field = data.get("plan_cost", None)
620+
if field is not None:
621+
args["plan_cost"] = unmarshal_Money(field)
622+
else:
623+
args["plan_cost"] = None
624+
625+
field = data.get("extra_pipelines_cost", None)
626+
if field is not None:
627+
args["extra_pipelines_cost"] = unmarshal_Money(field)
628+
else:
629+
args["extra_pipelines_cost"] = None
630+
631+
field = data.get("extra_cache_cost", None)
632+
if field is not None:
633+
args["extra_cache_cost"] = unmarshal_Money(field)
634+
else:
635+
args["extra_cache_cost"] = None
636+
637+
field = data.get("total_cost", None)
638+
if field is not None:
639+
args["total_cost"] = unmarshal_Money(field)
640+
else:
641+
args["total_cost"] = None
642+
643+
return GetBillingResponse(**args)
644+
645+
566646
def unmarshal_ListBackendStagesResponse(data: Any) -> ListBackendStagesResponse:
567647
if not isinstance(data, dict):
568648
raise TypeError(
@@ -647,29 +727,6 @@ def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse:
647727
return ListPipelinesResponse(**args)
648728

649729

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-
673730
def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse:
674731
if not isinstance(data, dict):
675732
raise TypeError(

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import List, Optional
99

1010
from scaleway_core.bridge import (
11+
Money,
1112
Region,
1213
Zone,
1314
)
@@ -472,10 +473,19 @@ class CheckPEMChainRequestSecretChain:
472473
@dataclass
473474
class PlanDetails:
474475
plan_name: PlanName
476+
"""
477+
Subscription plan name.
478+
"""
475479

476480
package_gb: int
481+
"""
482+
Amount of egress data from cache included in subscription plan.
483+
"""
477484

478485
pipeline_limit: int
486+
"""
487+
Number of pipeline included in subscription plan.
488+
"""
479489

480490

481491
@dataclass
@@ -713,6 +723,54 @@ class GetBackendStageRequest:
713723
"""
714724

715725

726+
@dataclass
727+
class GetBillingRequest:
728+
project_id: Optional[str]
729+
730+
731+
@dataclass
732+
class GetBillingResponse:
733+
pipeline_number: int
734+
"""
735+
Total number of pipeline currently configured.
736+
"""
737+
738+
current_plan_cache_usage: int
739+
"""
740+
Total amount of data egressed from cache in current subscription plan.
741+
"""
742+
743+
extra_cache_usage: int
744+
"""
745+
Total amount of data egressed from cache not included in the plans.
746+
"""
747+
748+
current_plan: Optional[PlanDetails]
749+
"""
750+
Information on the current edge-service subscription plan.
751+
"""
752+
753+
plan_cost: Optional[Money]
754+
"""
755+
Price of the current subscription plan.
756+
"""
757+
758+
extra_pipelines_cost: Optional[Money]
759+
"""
760+
Cost to date of the pipelines not included in the plans.
761+
"""
762+
763+
extra_cache_cost: Optional[Money]
764+
"""
765+
Cost to date of the data egressed from cache not included in the plans.
766+
"""
767+
768+
total_cost: Optional[Money]
769+
"""
770+
Total cost to date of edge-service product for the month including current plan, previous plans, extra pipelines and extra egress cache data.
771+
"""
772+
773+
716774
@dataclass
717775
class GetCacheStageRequest:
718776
cache_stage_id: str

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44
from .content import JOB_RUN_TRANSIENT_STATUSES
55
from .types import ListJobDefinitionsRequestOrderBy
66
from .types import ListJobRunsRequestOrderBy
7+
from .types import SecretEnvVar
8+
from .types import SecretFile
79
from .types import CronSchedule
810
from .types import CreateJobDefinitionRequestCronScheduleConfig
11+
from .types import CreateJobDefinitionSecretsRequestSecretConfig
12+
from .types import Secret
913
from .types import JobDefinition
1014
from .types import JobRun
1115
from .types import Resource
1216
from .types import UpdateJobDefinitionRequestCronScheduleConfig
1317
from .types import CreateJobDefinitionRequest
18+
from .types import CreateJobDefinitionSecretsRequest
19+
from .types import CreateJobDefinitionSecretsResponse
1420
from .types import DeleteJobDefinitionRequest
21+
from .types import DeleteJobDefinitionSecretRequest
1522
from .types import GetJobDefinitionRequest
23+
from .types import GetJobDefinitionSecretRequest
1624
from .types import GetJobRunRequest
25+
from .types import ListJobDefinitionSecretsRequest
26+
from .types import ListJobDefinitionSecretsResponse
1727
from .types import ListJobDefinitionsRequest
1828
from .types import ListJobDefinitionsResponse
1929
from .types import ListJobRunsRequest
@@ -24,23 +34,34 @@
2434
from .types import StartJobDefinitionResponse
2535
from .types import StopJobRunRequest
2636
from .types import UpdateJobDefinitionRequest
37+
from .types import UpdateJobDefinitionSecretRequest
2738
from .api import JobsV1Alpha1API
2839

2940
__all__ = [
3041
"JobRunState",
3142
"JOB_RUN_TRANSIENT_STATUSES",
3243
"ListJobDefinitionsRequestOrderBy",
3344
"ListJobRunsRequestOrderBy",
45+
"SecretEnvVar",
46+
"SecretFile",
3447
"CronSchedule",
3548
"CreateJobDefinitionRequestCronScheduleConfig",
49+
"CreateJobDefinitionSecretsRequestSecretConfig",
50+
"Secret",
3651
"JobDefinition",
3752
"JobRun",
3853
"Resource",
3954
"UpdateJobDefinitionRequestCronScheduleConfig",
4055
"CreateJobDefinitionRequest",
56+
"CreateJobDefinitionSecretsRequest",
57+
"CreateJobDefinitionSecretsResponse",
4158
"DeleteJobDefinitionRequest",
59+
"DeleteJobDefinitionSecretRequest",
4260
"GetJobDefinitionRequest",
61+
"GetJobDefinitionSecretRequest",
4362
"GetJobRunRequest",
63+
"ListJobDefinitionSecretsRequest",
64+
"ListJobDefinitionSecretsResponse",
4465
"ListJobDefinitionsRequest",
4566
"ListJobDefinitionsResponse",
4667
"ListJobRunsRequest",
@@ -51,5 +72,6 @@
5172
"StartJobDefinitionResponse",
5273
"StopJobRunRequest",
5374
"UpdateJobDefinitionRequest",
75+
"UpdateJobDefinitionSecretRequest",
5476
"JobsV1Alpha1API",
5577
]

0 commit comments

Comments
 (0)