Skip to content

Commit 04aac0d

Browse files
authored
Merge branch 'main' into v1.6527.0
2 parents 12ee742 + d55cac2 commit 04aac0d

File tree

26 files changed

+446
-34
lines changed

26 files changed

+446
-34
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListEventsRequestOrderBy
44
from .types import ResourceType
5+
from .types import AccountOrganizationInfo
6+
from .types import AccountUserInfo
57
from .types import KeyManagerKeyInfo
68
from .types import KubernetesACLInfo
79
from .types import KubernetesClusterInfo
@@ -23,6 +25,8 @@
2325
__all__ = [
2426
"ListEventsRequestOrderBy",
2527
"ResourceType",
28+
"AccountOrganizationInfo",
29+
"AccountUserInfo",
2630
"KeyManagerKeyInfo",
2731
"KubernetesACLInfo",
2832
"KubernetesClusterInfo",

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from dateutil import parser
66

77
from .types import (
8+
AccountOrganizationInfo,
9+
AccountUserInfo,
810
KeyManagerKeyInfo,
911
KubernetesACLInfo,
1012
KubernetesClusterInfo,
@@ -22,6 +24,32 @@
2224
)
2325

2426

27+
def unmarshal_AccountOrganizationInfo(data: Any) -> AccountOrganizationInfo:
28+
if not isinstance(data, dict):
29+
raise TypeError(
30+
"Unmarshalling the type 'AccountOrganizationInfo' failed as data isn't a dictionary."
31+
)
32+
33+
args: Dict[str, Any] = {}
34+
35+
return AccountOrganizationInfo(**args)
36+
37+
38+
def unmarshal_AccountUserInfo(data: Any) -> AccountUserInfo:
39+
if not isinstance(data, dict):
40+
raise TypeError(
41+
"Unmarshalling the type 'AccountUserInfo' failed as data isn't a dictionary."
42+
)
43+
44+
args: Dict[str, Any] = {}
45+
46+
field = data.get("email", None)
47+
if field is not None:
48+
args["email"] = field
49+
50+
return AccountUserInfo(**args)
51+
52+
2553
def unmarshal_KeyManagerKeyInfo(data: Any) -> KeyManagerKeyInfo:
2654
if not isinstance(data, dict):
2755
raise TypeError(
@@ -244,6 +272,18 @@ def unmarshal_Resource(data: Any) -> Resource:
244272
else:
245273
args["key_manager_key_info"] = None
246274

275+
field = data.get("account_user_info", None)
276+
if field is not None:
277+
args["account_user_info"] = unmarshal_AccountUserInfo(field)
278+
else:
279+
args["account_user_info"] = None
280+
281+
field = data.get("account_organization_info", None)
282+
if field is not None:
283+
args["account_organization_info"] = unmarshal_AccountOrganizationInfo(field)
284+
else:
285+
args["account_organization_info"] = None
286+
247287
return Resource(**args)
248288

249289

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,23 @@ class ResourceType(str, Enum, metaclass=StrEnumMeta):
4242
SECRET_MANAGER_SECRET = "secret_manager_secret"
4343
SECRET_MANAGER_VERSION = "secret_manager_version"
4444
KEY_MANAGER_KEY = "key_manager_key"
45+
ACCOUNT_USER = "account_user"
46+
ACCOUNT_ORGANIZATION = "account_organization"
4547

4648
def __str__(self) -> str:
4749
return str(self.value)
4850

4951

52+
@dataclass
53+
class AccountOrganizationInfo:
54+
pass
55+
56+
57+
@dataclass
58+
class AccountUserInfo:
59+
email: str
60+
61+
5062
@dataclass
5163
class KeyManagerKeyInfo:
5264
pass
@@ -125,6 +137,10 @@ class Resource:
125137

126138
key_manager_key_info: Optional[KeyManagerKeyInfo]
127139

140+
account_user_info: Optional[AccountUserInfo]
141+
142+
account_organization_info: Optional[AccountOrganizationInfo]
143+
128144

129145
@dataclass
130146
class ProductService:

scaleway-async/scaleway_async/cockpit/v1/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ async def get_current_plan(
591591

592592
class CockpitV1RegionalAPI(API):
593593
"""
594-
The Cockpit Regional API allows you to create data sources and tokens to store and query data types such as metrics, logs, and traces. You can also push your data into Cockpit, and send alerts to your contact points when your resources may require your attention, using the regional Alert manager.
594+
The Cockpit API allows you to create data sources and Cockpit tokens to store and query data types such as metrics, logs, and traces. You can also push your data into Cockpit, and send alerts to your contact points when your resources may require your attention, using the regional Alert manager.
595595
"""
596596

597597
async def get_config(
@@ -1446,6 +1446,7 @@ async def list_alerts(
14461446
is_enabled: Optional[bool] = None,
14471447
is_preconfigured: Optional[bool] = None,
14481448
state: Optional[AlertState] = None,
1449+
data_source_id: Optional[str] = None,
14491450
) -> ListAlertsResponse:
14501451
"""
14511452
List alerts.
@@ -1455,6 +1456,7 @@ async def list_alerts(
14551456
:param is_enabled: True returns only enabled alerts. False returns only disabled alerts. If omitted, no alert filtering is applied. Other filters may still apply.
14561457
:param is_preconfigured: True returns only preconfigured alerts. False returns only custom alerts. If omitted, no filtering is applied on alert types. Other filters may still apply.
14571458
:param state: Valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply.
1459+
:param data_source_id: If omitted, only alerts from the default scaleway data source will be listed.
14581460
:return: :class:`ListAlertsResponse <ListAlertsResponse>`
14591461
14601462
Usage:
@@ -1471,6 +1473,7 @@ async def list_alerts(
14711473
"GET",
14721474
f"/cockpit/v1/regions/{param_region}/alerts",
14731475
params={
1476+
"data_source_id": data_source_id,
14741477
"is_enabled": is_enabled,
14751478
"is_preconfigured": is_preconfigured,
14761479
"project_id": project_id or self.client.default_project_id,

scaleway-async/scaleway_async/cockpit/v1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ def unmarshal_Alert(data: Any) -> Alert:
509509
if field is not None:
510510
args["annotations"] = field
511511

512+
field = data.get("data_source_id", None)
513+
if field is not None:
514+
args["data_source_id"] = field
515+
512516
field = data.get("state", None)
513517
if field is not None:
514518
args["state"] = field

scaleway-async/scaleway_async/cockpit/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ class Alert:
204204
Annotations for the alert, used to provide additional information about the alert.
205205
"""
206206

207+
data_source_id: str
208+
"""
209+
ID of the data source containing the alert rule.
210+
"""
211+
207212
state: Optional[AlertState]
208213
"""
209214
Current state of the alert. Possible states are `inactive`, `pending`, and `firing`.
@@ -1239,6 +1244,11 @@ class RegionalApiListAlertsRequest:
12391244
Valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply.
12401245
"""
12411246

1247+
data_source_id: Optional[str]
1248+
"""
1249+
If omitted, only alerts from the default scaleway data source will be listed.
1250+
"""
1251+
12421252

12431253
@dataclass
12441254
class RegionalApiListContactPointsRequest:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
from .types import ListUsersResponse
9595
from .types import LockUserRequest
9696
from .types import MFAOTP
97+
from .types import MigrateOrganizationGuestsRequest
9798
from .types import OrganizationSecuritySettings
9899
from .types import RemoveGroupMemberRequest
99100
from .types import SetGroupMembersRequest
@@ -208,6 +209,7 @@
208209
"ListUsersResponse",
209210
"LockUserRequest",
210211
"MFAOTP",
212+
"MigrateOrganizationGuestsRequest",
211213
"OrganizationSecuritySettings",
212214
"RemoveGroupMemberRequest",
213215
"SetGroupMembersRequest",

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,3 +2826,29 @@ async def update_organization_security_settings(
28262826

28272827
self._throw_on_error(res)
28282828
return unmarshal_OrganizationSecuritySettings(res.json())
2829+
2830+
async def migrate_organization_guests(
2831+
self,
2832+
*,
2833+
organization_id: Optional[str] = None,
2834+
) -> None:
2835+
"""
2836+
Migrate the organization's guests to IAM members.
2837+
:param organization_id: ID of the Organization.
2838+
2839+
Usage:
2840+
::
2841+
2842+
result = await api.migrate_organization_guests()
2843+
"""
2844+
2845+
param_organization_id = validate_path_param(
2846+
"organization_id", organization_id or self.client.default_organization_id
2847+
)
2848+
2849+
res = self._request(
2850+
"POST",
2851+
f"/iam/v1alpha1/organizations/{param_organization_id}/migrate-guests",
2852+
)
2853+
2854+
self._throw_on_error(res)

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,14 @@ class MFAOTP:
19061906
secret: str
19071907

19081908

1909+
@dataclass
1910+
class MigrateOrganizationGuestsRequest:
1911+
organization_id: Optional[str]
1912+
"""
1913+
ID of the Organization.
1914+
"""
1915+
1916+
19091917
@dataclass
19101918
class OrganizationSecuritySettings:
19111919
enforce_password_renewal: bool

scaleway-async/scaleway_async/k8s/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
from .types import ListPoolsResponse
7676
from .types import ListVersionsRequest
7777
from .types import ListVersionsResponse
78+
from .types import MigratePoolsToNewImagesRequest
7879
from .types import NodeMetadata
7980
from .types import RebootNodeRequest
8081
from .types import ReplaceNodeRequest
@@ -164,6 +165,7 @@
164165
"ListPoolsResponse",
165166
"ListVersionsRequest",
166167
"ListVersionsResponse",
168+
"MigratePoolsToNewImagesRequest",
167169
"NodeMetadata",
168170
"RebootNodeRequest",
169171
"ReplaceNodeRequest",

scaleway-async/scaleway_async/k8s/v1/api.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
ListNodesResponse,
5151
ListPoolsResponse,
5252
ListVersionsResponse,
53+
MigratePoolsToNewImagesRequest,
5354
Node,
5455
NodeMetadata,
5556
Pool,
@@ -92,6 +93,7 @@
9293
marshal_AddClusterACLRulesRequest,
9394
marshal_CreateClusterRequest,
9495
marshal_CreatePoolRequest,
96+
marshal_MigratePoolsToNewImagesRequest,
9597
marshal_SetClusterACLRulesRequest,
9698
marshal_SetClusterTypeRequest,
9799
marshal_UpdateClusterRequest,
@@ -1334,6 +1336,48 @@ async def delete_pool(
13341336
self._throw_on_error(res)
13351337
return unmarshal_Pool(res.json())
13361338

1339+
async def migrate_pools_to_new_images(
1340+
self,
1341+
*,
1342+
cluster_id: str,
1343+
region: Optional[ScwRegion] = None,
1344+
pool_ids: Optional[List[str]] = None,
1345+
) -> None:
1346+
"""
1347+
Migrate specific pools or all pools of a cluster to new images.
1348+
If no pool is specified, all pools of the cluster will be migrated to new images.
1349+
:param cluster_id:
1350+
:param region: Region to target. If none is passed will use default region from the config.
1351+
:param pool_ids:
1352+
1353+
Usage:
1354+
::
1355+
1356+
result = await api.migrate_pools_to_new_images(
1357+
cluster_id="example",
1358+
)
1359+
"""
1360+
1361+
param_region = validate_path_param(
1362+
"region", region or self.client.default_region
1363+
)
1364+
param_cluster_id = validate_path_param("cluster_id", cluster_id)
1365+
1366+
res = self._request(
1367+
"POST",
1368+
f"/k8s/v1/regions/{param_region}/clusters/{param_cluster_id}/migrate-pools-to-new-images",
1369+
body=marshal_MigratePoolsToNewImagesRequest(
1370+
MigratePoolsToNewImagesRequest(
1371+
cluster_id=cluster_id,
1372+
region=region,
1373+
pool_ids=pool_ids,
1374+
),
1375+
self.client,
1376+
),
1377+
)
1378+
1379+
self._throw_on_error(res)
1380+
13371381
async def get_node_metadata(
13381382
self,
13391383
*,

0 commit comments

Comments
 (0)