From ff434e2695e8c2e0ff7c97496b96d717bc3f7ce2 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 31 Oct 2024 15:24:17 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/iam/v1alpha1/__init__.py | 4 ++ .../scaleway_async/iam/v1alpha1/api.py | 66 ++++++++++++++++++- .../scaleway_async/iam/v1alpha1/types.py | 19 ++++++ scaleway/scaleway/iam/v1alpha1/__init__.py | 4 ++ scaleway/scaleway/iam/v1alpha1/api.py | 66 ++++++++++++++++++- scaleway/scaleway/iam/v1alpha1/types.py | 19 ++++++ 6 files changed, 172 insertions(+), 6 deletions(-) diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py index a59f33617..bb4d8d674 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py @@ -78,10 +78,12 @@ from .types import ListSSHKeysResponse from .types import ListUsersRequest from .types import ListUsersResponse +from .types import LockUserRequest from .types import RemoveGroupMemberRequest from .types import SetGroupMembersRequest from .types import SetRulesRequest from .types import SetRulesResponse +from .types import UnlockUserRequest from .types import UpdateAPIKeyRequest from .types import UpdateApplicationRequest from .types import UpdateGroupRequest @@ -170,10 +172,12 @@ "ListSSHKeysResponse", "ListUsersRequest", "ListUsersResponse", + "LockUserRequest", "RemoveGroupMemberRequest", "SetGroupMembersRequest", "SetRulesRequest", "SetRulesResponse", + "UnlockUserRequest", "UpdateAPIKeyRequest", "UpdateApplicationRequest", "UpdateGroupRequest", diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/api.py b/scaleway-async/scaleway_async/iam/v1alpha1/api.py index d01f497fc..5141b99b5 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/api.py @@ -584,9 +584,10 @@ async def update_user_password( send_email: bool, ) -> User: """ - :param user_id: - :param password: - :param send_email: + Update an user's password. + :param user_id: ID of the user to update. + :param password: The new password. + :param send_email: Whether or not to send an email alerting the user their password has changed. :return: :class:`User ` Usage: @@ -617,6 +618,65 @@ async def update_user_password( self._throw_on_error(res) return unmarshal_User(res.json()) + async def lock_user( + self, + *, + user_id: str, + ) -> User: + """ + Lock a user. + Lock a user. Note that a locked user cannot log in or use API keys until the locked status is removed. + :param user_id: + :return: :class:`User ` + + Usage: + :: + + result = await api.lock_user( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "POST", + f"/iam/v1alpha1/users/{param_user_id}/lock", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_User(res.json()) + + async def unlock_user( + self, + *, + user_id: str, + ) -> User: + """ + Unlock a user. + :param user_id: + :return: :class:`User ` + + Usage: + :: + + result = await api.unlock_user( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "POST", + f"/iam/v1alpha1/users/{param_user_id}/unlock", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_User(res.json()) + async def list_applications( self, *, diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/types.py b/scaleway-async/scaleway_async/iam/v1alpha1/types.py index 5c1d9df71..63d8753df 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/types.py @@ -1691,6 +1691,11 @@ class ListUsersResponse: """ +@dataclass +class LockUserRequest: + user_id: str + + @dataclass class RemoveGroupMemberRequest: group_id: str @@ -1733,6 +1738,11 @@ class SetRulesResponse: """ +@dataclass +class UnlockUserRequest: + user_id: str + + @dataclass class UpdateAPIKeyRequest: access_key: str @@ -1846,10 +1856,19 @@ class UpdateSSHKeyRequest: @dataclass class UpdateUserPasswordRequest: user_id: str + """ + ID of the user to update. + """ password: str + """ + The new password. + """ send_email: bool + """ + Whether or not to send an email alerting the user their password has changed. + """ @dataclass diff --git a/scaleway/scaleway/iam/v1alpha1/__init__.py b/scaleway/scaleway/iam/v1alpha1/__init__.py index a59f33617..bb4d8d674 100644 --- a/scaleway/scaleway/iam/v1alpha1/__init__.py +++ b/scaleway/scaleway/iam/v1alpha1/__init__.py @@ -78,10 +78,12 @@ from .types import ListSSHKeysResponse from .types import ListUsersRequest from .types import ListUsersResponse +from .types import LockUserRequest from .types import RemoveGroupMemberRequest from .types import SetGroupMembersRequest from .types import SetRulesRequest from .types import SetRulesResponse +from .types import UnlockUserRequest from .types import UpdateAPIKeyRequest from .types import UpdateApplicationRequest from .types import UpdateGroupRequest @@ -170,10 +172,12 @@ "ListSSHKeysResponse", "ListUsersRequest", "ListUsersResponse", + "LockUserRequest", "RemoveGroupMemberRequest", "SetGroupMembersRequest", "SetRulesRequest", "SetRulesResponse", + "UnlockUserRequest", "UpdateAPIKeyRequest", "UpdateApplicationRequest", "UpdateGroupRequest", diff --git a/scaleway/scaleway/iam/v1alpha1/api.py b/scaleway/scaleway/iam/v1alpha1/api.py index 602db99d8..5b5758822 100644 --- a/scaleway/scaleway/iam/v1alpha1/api.py +++ b/scaleway/scaleway/iam/v1alpha1/api.py @@ -584,9 +584,10 @@ def update_user_password( send_email: bool, ) -> User: """ - :param user_id: - :param password: - :param send_email: + Update an user's password. + :param user_id: ID of the user to update. + :param password: The new password. + :param send_email: Whether or not to send an email alerting the user their password has changed. :return: :class:`User ` Usage: @@ -617,6 +618,65 @@ def update_user_password( self._throw_on_error(res) return unmarshal_User(res.json()) + def lock_user( + self, + *, + user_id: str, + ) -> User: + """ + Lock a user. + Lock a user. Note that a locked user cannot log in or use API keys until the locked status is removed. + :param user_id: + :return: :class:`User ` + + Usage: + :: + + result = api.lock_user( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "POST", + f"/iam/v1alpha1/users/{param_user_id}/lock", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_User(res.json()) + + def unlock_user( + self, + *, + user_id: str, + ) -> User: + """ + Unlock a user. + :param user_id: + :return: :class:`User ` + + Usage: + :: + + result = api.unlock_user( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "POST", + f"/iam/v1alpha1/users/{param_user_id}/unlock", + body={}, + ) + + self._throw_on_error(res) + return unmarshal_User(res.json()) + def list_applications( self, *, diff --git a/scaleway/scaleway/iam/v1alpha1/types.py b/scaleway/scaleway/iam/v1alpha1/types.py index 5c1d9df71..63d8753df 100644 --- a/scaleway/scaleway/iam/v1alpha1/types.py +++ b/scaleway/scaleway/iam/v1alpha1/types.py @@ -1691,6 +1691,11 @@ class ListUsersResponse: """ +@dataclass +class LockUserRequest: + user_id: str + + @dataclass class RemoveGroupMemberRequest: group_id: str @@ -1733,6 +1738,11 @@ class SetRulesResponse: """ +@dataclass +class UnlockUserRequest: + user_id: str + + @dataclass class UpdateAPIKeyRequest: access_key: str @@ -1846,10 +1856,19 @@ class UpdateSSHKeyRequest: @dataclass class UpdateUserPasswordRequest: user_id: str + """ + ID of the user to update. + """ password: str + """ + The new password. + """ send_email: bool + """ + Whether or not to send an email alerting the user their password has changed. + """ @dataclass