Skip to content

Commit 2c02f6b

Browse files
fix(iam/v1alpha1): set UpdateOrganizationLoginMethods body (#1314)
Co-authored-by: Jonathan R. <jremy@scaleway.com>
1 parent 3f3d72d commit 2c02f6b

File tree

4 files changed

+68
-12
lines changed

4 files changed

+68
-12
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
UpdateAPIKeyRequest,
8282
UpdateApplicationRequest,
8383
UpdateGroupRequest,
84+
UpdateOrganizationLoginMethodsRequest,
8485
UpdateOrganizationSecuritySettingsRequest,
8586
UpdatePolicyRequest,
8687
UpdateSSHKeyRequest,
@@ -144,6 +145,7 @@
144145
marshal_UpdateAPIKeyRequest,
145146
marshal_UpdateApplicationRequest,
146147
marshal_UpdateGroupRequest,
148+
marshal_UpdateOrganizationLoginMethodsRequest,
147149
marshal_UpdateOrganizationSecuritySettingsRequest,
148150
marshal_UpdatePolicyRequest,
149151
marshal_UpdateSSHKeyRequest,
@@ -3048,12 +3050,16 @@ async def update_organization_login_methods(
30483050
res = self._request(
30493051
"PATCH",
30503052
f"/iam/v1alpha1/organizations/{param_organization_id}/login-methods",
3051-
params={
3052-
"login_magic_code_enabled": login_magic_code_enabled,
3053-
"login_oauth2_enabled": login_oauth2_enabled,
3054-
"login_password_enabled": login_password_enabled,
3055-
"login_saml_enabled": login_saml_enabled,
3056-
},
3053+
body=marshal_UpdateOrganizationLoginMethodsRequest(
3054+
UpdateOrganizationLoginMethodsRequest(
3055+
organization_id=organization_id,
3056+
login_password_enabled=login_password_enabled,
3057+
login_oauth2_enabled=login_oauth2_enabled,
3058+
login_magic_code_enabled=login_magic_code_enabled,
3059+
login_saml_enabled=login_saml_enabled,
3060+
),
3061+
self.client,
3062+
),
30573063
)
30583064

30593065
self._throw_on_error(res)

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
UpdateAPIKeyRequest,
8282
UpdateApplicationRequest,
8383
UpdateGroupRequest,
84+
UpdateOrganizationLoginMethodsRequest,
8485
UpdateOrganizationSecuritySettingsRequest,
8586
UpdatePolicyRequest,
8687
UpdateSSHKeyRequest,
@@ -2147,6 +2148,27 @@ def marshal_UpdateGroupRequest(
21472148
return output
21482149

21492150

2151+
def marshal_UpdateOrganizationLoginMethodsRequest(
2152+
request: UpdateOrganizationLoginMethodsRequest,
2153+
defaults: ProfileDefaults,
2154+
) -> dict[str, Any]:
2155+
output: dict[str, Any] = {}
2156+
2157+
if request.login_password_enabled is not None:
2158+
output["login_password_enabled"] = request.login_password_enabled
2159+
2160+
if request.login_oauth2_enabled is not None:
2161+
output["login_oauth2_enabled"] = request.login_oauth2_enabled
2162+
2163+
if request.login_magic_code_enabled is not None:
2164+
output["login_magic_code_enabled"] = request.login_magic_code_enabled
2165+
2166+
if request.login_saml_enabled is not None:
2167+
output["login_saml_enabled"] = request.login_saml_enabled
2168+
2169+
return output
2170+
2171+
21502172
def marshal_UpdateOrganizationSecuritySettingsRequest(
21512173
request: UpdateOrganizationSecuritySettingsRequest,
21522174
defaults: ProfileDefaults,

scaleway/scaleway/iam/v1alpha1/api.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
UpdateAPIKeyRequest,
8282
UpdateApplicationRequest,
8383
UpdateGroupRequest,
84+
UpdateOrganizationLoginMethodsRequest,
8485
UpdateOrganizationSecuritySettingsRequest,
8586
UpdatePolicyRequest,
8687
UpdateSSHKeyRequest,
@@ -144,6 +145,7 @@
144145
marshal_UpdateAPIKeyRequest,
145146
marshal_UpdateApplicationRequest,
146147
marshal_UpdateGroupRequest,
148+
marshal_UpdateOrganizationLoginMethodsRequest,
147149
marshal_UpdateOrganizationSecuritySettingsRequest,
148150
marshal_UpdatePolicyRequest,
149151
marshal_UpdateSSHKeyRequest,
@@ -3048,12 +3050,16 @@ def update_organization_login_methods(
30483050
res = self._request(
30493051
"PATCH",
30503052
f"/iam/v1alpha1/organizations/{param_organization_id}/login-methods",
3051-
params={
3052-
"login_magic_code_enabled": login_magic_code_enabled,
3053-
"login_oauth2_enabled": login_oauth2_enabled,
3054-
"login_password_enabled": login_password_enabled,
3055-
"login_saml_enabled": login_saml_enabled,
3056-
},
3053+
body=marshal_UpdateOrganizationLoginMethodsRequest(
3054+
UpdateOrganizationLoginMethodsRequest(
3055+
organization_id=organization_id,
3056+
login_password_enabled=login_password_enabled,
3057+
login_oauth2_enabled=login_oauth2_enabled,
3058+
login_magic_code_enabled=login_magic_code_enabled,
3059+
login_saml_enabled=login_saml_enabled,
3060+
),
3061+
self.client,
3062+
),
30573063
)
30583064

30593065
self._throw_on_error(res)

scaleway/scaleway/iam/v1alpha1/marshalling.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
UpdateAPIKeyRequest,
8282
UpdateApplicationRequest,
8383
UpdateGroupRequest,
84+
UpdateOrganizationLoginMethodsRequest,
8485
UpdateOrganizationSecuritySettingsRequest,
8586
UpdatePolicyRequest,
8687
UpdateSSHKeyRequest,
@@ -2147,6 +2148,27 @@ def marshal_UpdateGroupRequest(
21472148
return output
21482149

21492150

2151+
def marshal_UpdateOrganizationLoginMethodsRequest(
2152+
request: UpdateOrganizationLoginMethodsRequest,
2153+
defaults: ProfileDefaults,
2154+
) -> dict[str, Any]:
2155+
output: dict[str, Any] = {}
2156+
2157+
if request.login_password_enabled is not None:
2158+
output["login_password_enabled"] = request.login_password_enabled
2159+
2160+
if request.login_oauth2_enabled is not None:
2161+
output["login_oauth2_enabled"] = request.login_oauth2_enabled
2162+
2163+
if request.login_magic_code_enabled is not None:
2164+
output["login_magic_code_enabled"] = request.login_magic_code_enabled
2165+
2166+
if request.login_saml_enabled is not None:
2167+
output["login_saml_enabled"] = request.login_saml_enabled
2168+
2169+
return output
2170+
2171+
21502172
def marshal_UpdateOrganizationSecuritySettingsRequest(
21512173
request: UpdateOrganizationSecuritySettingsRequest,
21522174
defaults: ProfileDefaults,

0 commit comments

Comments
 (0)