diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py index 8c1cc12ad..dd3bc03aa 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py @@ -124,6 +124,7 @@ from .types import UpdateAPIKeyRequest from .types import UpdateApplicationRequest from .types import UpdateGroupRequest +from .types import UpdateOrganizationLoginMethodsRequest from .types import UpdateOrganizationSecuritySettingsRequest from .types import UpdatePolicyRequest from .types import UpdateSSHKeyRequest @@ -260,6 +261,7 @@ "UpdateAPIKeyRequest", "UpdateApplicationRequest", "UpdateGroupRequest", + "UpdateOrganizationLoginMethodsRequest", "UpdateOrganizationSecuritySettingsRequest", "UpdatePolicyRequest", "UpdateSSHKeyRequest", diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/api.py b/scaleway-async/scaleway_async/iam/v1alpha1/api.py index 56ed5815b..f8d533472 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/api.py @@ -3043,6 +3043,48 @@ async def migrate_organization_guests( self._throw_on_error(res) + async def update_organization_login_methods( + self, + *, + organization_id: Optional[str] = None, + login_password_enabled: Optional[bool] = None, + login_oauth2_enabled: Optional[bool] = None, + login_magic_code_enabled: Optional[bool] = None, + login_saml_enabled: Optional[bool] = None, + ) -> Organization: + """ + Set your Organization's allowed login methods. + :param organization_id: ID of the Organization. + :param login_password_enabled: Defines whether login with a password is enabled for the Organization. + :param login_oauth2_enabled: Defines whether login through OAuth2 is enabled for the Organization. + :param login_magic_code_enabled: Defines whether login with an authentication code is enabled for the Organization. + :param login_saml_enabled: Defines whether login through SAML is enabled for the Organization. + :return: :class:`Organization ` + + Usage: + :: + + result = await api.update_organization_login_methods() + """ + + param_organization_id = validate_path_param( + "organization_id", organization_id or self.client.default_organization_id + ) + + res = self._request( + "PATCH", + f"/iam/v1alpha1/organizations/{param_organization_id}/login-methods", + params={ + "login_magic_code_enabled": login_magic_code_enabled, + "login_oauth2_enabled": login_oauth2_enabled, + "login_password_enabled": login_password_enabled, + "login_saml_enabled": login_saml_enabled, + }, + ) + + self._throw_on_error(res) + return unmarshal_Organization(res.json()) + async def get_organization_saml( self, *, diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py index e72c07962..8223a20ff 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py @@ -1538,6 +1538,30 @@ def unmarshal_Organization(data: Any) -> Organization: else: args["alias"] = None + field = data.get("login_password_enabled", None) + if field is not None: + args["login_password_enabled"] = field + else: + args["login_password_enabled"] = False + + field = data.get("login_magic_code_enabled", None) + if field is not None: + args["login_magic_code_enabled"] = field + else: + args["login_magic_code_enabled"] = False + + field = data.get("login_oauth2_enabled", None) + if field is not None: + args["login_oauth2_enabled"] = field + else: + args["login_oauth2_enabled"] = False + + field = data.get("login_saml_enabled", None) + if field is not None: + args["login_saml_enabled"] = field + else: + args["login_saml_enabled"] = False + return Organization(**args) diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/types.py b/scaleway-async/scaleway_async/iam/v1alpha1/types.py index f1ec7458f..934b9baf2 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/types.py @@ -2104,6 +2104,26 @@ class Organization: Alias of the Organization. """ + login_password_enabled: bool + """ + Defines whether login with a password is enabled for the Organization. + """ + + login_magic_code_enabled: bool + """ + Defines whether login with an authentication code is enabled for the Organization. + """ + + login_oauth2_enabled: bool + """ + Defines whether login through OAuth2 is enabled for the Organization. + """ + + login_saml_enabled: bool + """ + Defines whether login through SAML is enabled for the Organization. + """ + @dataclass class OrganizationSecuritySettings: @@ -2294,6 +2314,34 @@ class UpdateGroupRequest: """ +@dataclass +class UpdateOrganizationLoginMethodsRequest: + organization_id: Optional[str] = None + """ + ID of the Organization. + """ + + login_password_enabled: Optional[bool] = False + """ + Defines whether login with a password is enabled for the Organization. + """ + + login_oauth2_enabled: Optional[bool] = False + """ + Defines whether login through OAuth2 is enabled for the Organization. + """ + + login_magic_code_enabled: Optional[bool] = False + """ + Defines whether login with an authentication code is enabled for the Organization. + """ + + login_saml_enabled: Optional[bool] = False + """ + Defines whether login through SAML is enabled for the Organization. + """ + + @dataclass class UpdateOrganizationSecuritySettingsRequest: organization_id: Optional[str] = None diff --git a/scaleway/scaleway/iam/v1alpha1/__init__.py b/scaleway/scaleway/iam/v1alpha1/__init__.py index 8c1cc12ad..dd3bc03aa 100644 --- a/scaleway/scaleway/iam/v1alpha1/__init__.py +++ b/scaleway/scaleway/iam/v1alpha1/__init__.py @@ -124,6 +124,7 @@ from .types import UpdateAPIKeyRequest from .types import UpdateApplicationRequest from .types import UpdateGroupRequest +from .types import UpdateOrganizationLoginMethodsRequest from .types import UpdateOrganizationSecuritySettingsRequest from .types import UpdatePolicyRequest from .types import UpdateSSHKeyRequest @@ -260,6 +261,7 @@ "UpdateAPIKeyRequest", "UpdateApplicationRequest", "UpdateGroupRequest", + "UpdateOrganizationLoginMethodsRequest", "UpdateOrganizationSecuritySettingsRequest", "UpdatePolicyRequest", "UpdateSSHKeyRequest", diff --git a/scaleway/scaleway/iam/v1alpha1/api.py b/scaleway/scaleway/iam/v1alpha1/api.py index a8b04a2cf..9bca8dc61 100644 --- a/scaleway/scaleway/iam/v1alpha1/api.py +++ b/scaleway/scaleway/iam/v1alpha1/api.py @@ -3043,6 +3043,48 @@ def migrate_organization_guests( self._throw_on_error(res) + def update_organization_login_methods( + self, + *, + organization_id: Optional[str] = None, + login_password_enabled: Optional[bool] = None, + login_oauth2_enabled: Optional[bool] = None, + login_magic_code_enabled: Optional[bool] = None, + login_saml_enabled: Optional[bool] = None, + ) -> Organization: + """ + Set your Organization's allowed login methods. + :param organization_id: ID of the Organization. + :param login_password_enabled: Defines whether login with a password is enabled for the Organization. + :param login_oauth2_enabled: Defines whether login through OAuth2 is enabled for the Organization. + :param login_magic_code_enabled: Defines whether login with an authentication code is enabled for the Organization. + :param login_saml_enabled: Defines whether login through SAML is enabled for the Organization. + :return: :class:`Organization ` + + Usage: + :: + + result = api.update_organization_login_methods() + """ + + param_organization_id = validate_path_param( + "organization_id", organization_id or self.client.default_organization_id + ) + + res = self._request( + "PATCH", + f"/iam/v1alpha1/organizations/{param_organization_id}/login-methods", + params={ + "login_magic_code_enabled": login_magic_code_enabled, + "login_oauth2_enabled": login_oauth2_enabled, + "login_password_enabled": login_password_enabled, + "login_saml_enabled": login_saml_enabled, + }, + ) + + self._throw_on_error(res) + return unmarshal_Organization(res.json()) + def get_organization_saml( self, *, diff --git a/scaleway/scaleway/iam/v1alpha1/marshalling.py b/scaleway/scaleway/iam/v1alpha1/marshalling.py index e72c07962..8223a20ff 100644 --- a/scaleway/scaleway/iam/v1alpha1/marshalling.py +++ b/scaleway/scaleway/iam/v1alpha1/marshalling.py @@ -1538,6 +1538,30 @@ def unmarshal_Organization(data: Any) -> Organization: else: args["alias"] = None + field = data.get("login_password_enabled", None) + if field is not None: + args["login_password_enabled"] = field + else: + args["login_password_enabled"] = False + + field = data.get("login_magic_code_enabled", None) + if field is not None: + args["login_magic_code_enabled"] = field + else: + args["login_magic_code_enabled"] = False + + field = data.get("login_oauth2_enabled", None) + if field is not None: + args["login_oauth2_enabled"] = field + else: + args["login_oauth2_enabled"] = False + + field = data.get("login_saml_enabled", None) + if field is not None: + args["login_saml_enabled"] = field + else: + args["login_saml_enabled"] = False + return Organization(**args) diff --git a/scaleway/scaleway/iam/v1alpha1/types.py b/scaleway/scaleway/iam/v1alpha1/types.py index f1ec7458f..934b9baf2 100644 --- a/scaleway/scaleway/iam/v1alpha1/types.py +++ b/scaleway/scaleway/iam/v1alpha1/types.py @@ -2104,6 +2104,26 @@ class Organization: Alias of the Organization. """ + login_password_enabled: bool + """ + Defines whether login with a password is enabled for the Organization. + """ + + login_magic_code_enabled: bool + """ + Defines whether login with an authentication code is enabled for the Organization. + """ + + login_oauth2_enabled: bool + """ + Defines whether login through OAuth2 is enabled for the Organization. + """ + + login_saml_enabled: bool + """ + Defines whether login through SAML is enabled for the Organization. + """ + @dataclass class OrganizationSecuritySettings: @@ -2294,6 +2314,34 @@ class UpdateGroupRequest: """ +@dataclass +class UpdateOrganizationLoginMethodsRequest: + organization_id: Optional[str] = None + """ + ID of the Organization. + """ + + login_password_enabled: Optional[bool] = False + """ + Defines whether login with a password is enabled for the Organization. + """ + + login_oauth2_enabled: Optional[bool] = False + """ + Defines whether login through OAuth2 is enabled for the Organization. + """ + + login_magic_code_enabled: Optional[bool] = False + """ + Defines whether login with an authentication code is enabled for the Organization. + """ + + login_saml_enabled: Optional[bool] = False + """ + Defines whether login through SAML is enabled for the Organization. + """ + + @dataclass class UpdateOrganizationSecuritySettingsRequest: organization_id: Optional[str] = None