Skip to content

Commit 971a207

Browse files
authored
feat(iam): rework saml endpoints (#1196)
1 parent 5ce80d0 commit 971a207

File tree

8 files changed

+286
-374
lines changed

8 files changed

+286
-374
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .types import PermissionSetScopeType
1919
from .types import SamlCertificateOrigin
2020
from .types import SamlCertificateType
21+
from .types import SamlStatus
2122
from .types import UserStatus
2223
from .types import UserType
2324
from .types import ConnectionConnectedOrganization
@@ -39,6 +40,7 @@
3940
from .types import SSHKey
4041
from .types import SamlCertificate
4142
from .types import User
43+
from .types import SamlServiceProvider
4244
from .types import AddGroupMemberRequest
4345
from .types import AddGroupMembersRequest
4446
from .types import AddSamlCertificateRequest
@@ -47,7 +49,6 @@
4749
from .types import CreateApplicationRequest
4850
from .types import CreateGroupRequest
4951
from .types import CreateJWTRequest
50-
from .types import CreateOrganizationSamlRequest
5152
from .types import CreatePolicyRequest
5253
from .types import CreateSSHKeyRequest
5354
from .types import CreateUserMFAOTPRequest
@@ -56,12 +57,13 @@
5657
from .types import DeleteApplicationRequest
5758
from .types import DeleteGroupRequest
5859
from .types import DeleteJWTRequest
59-
from .types import DeleteOrganizationSamlRequest
6060
from .types import DeletePolicyRequest
6161
from .types import DeleteSSHKeyRequest
6262
from .types import DeleteSamlCertificateRequest
63+
from .types import DeleteSamlRequest
6364
from .types import DeleteUserMFAOTPRequest
6465
from .types import DeleteUserRequest
66+
from .types import EnableOrganizationSamlRequest
6567
from .types import EncodedJWT
6668
from .types import GetAPIKeyRequest
6769
from .types import GetApplicationRequest
@@ -74,7 +76,6 @@
7476
from .types import GetPolicyRequest
7577
from .types import GetQuotumRequest
7678
from .types import GetSSHKeyRequest
77-
from .types import GetSamlInformationRequest
7879
from .types import GetUserConnectionsRequest
7980
from .types import GetUserConnectionsResponse
8081
from .types import GetUserRequest
@@ -115,7 +116,6 @@
115116
from .types import RemoveGroupMemberRequest
116117
from .types import RemoveUserConnectionRequest
117118
from .types import Saml
118-
from .types import SamlInformation
119119
from .types import SetGroupMembersRequest
120120
from .types import SetOrganizationAliasRequest
121121
from .types import SetRulesRequest
@@ -124,10 +124,10 @@
124124
from .types import UpdateAPIKeyRequest
125125
from .types import UpdateApplicationRequest
126126
from .types import UpdateGroupRequest
127-
from .types import UpdateOrganizationSamlRequest
128127
from .types import UpdateOrganizationSecuritySettingsRequest
129128
from .types import UpdatePolicyRequest
130129
from .types import UpdateSSHKeyRequest
130+
from .types import UpdateSamlRequest
131131
from .types import UpdateUserPasswordRequest
132132
from .types import UpdateUserRequest
133133
from .types import UpdateUserUsernameRequest
@@ -154,6 +154,7 @@
154154
"PermissionSetScopeType",
155155
"SamlCertificateOrigin",
156156
"SamlCertificateType",
157+
"SamlStatus",
157158
"UserStatus",
158159
"UserType",
159160
"ConnectionConnectedOrganization",
@@ -175,6 +176,7 @@
175176
"SSHKey",
176177
"SamlCertificate",
177178
"User",
179+
"SamlServiceProvider",
178180
"AddGroupMemberRequest",
179181
"AddGroupMembersRequest",
180182
"AddSamlCertificateRequest",
@@ -183,7 +185,6 @@
183185
"CreateApplicationRequest",
184186
"CreateGroupRequest",
185187
"CreateJWTRequest",
186-
"CreateOrganizationSamlRequest",
187188
"CreatePolicyRequest",
188189
"CreateSSHKeyRequest",
189190
"CreateUserMFAOTPRequest",
@@ -192,12 +193,13 @@
192193
"DeleteApplicationRequest",
193194
"DeleteGroupRequest",
194195
"DeleteJWTRequest",
195-
"DeleteOrganizationSamlRequest",
196196
"DeletePolicyRequest",
197197
"DeleteSSHKeyRequest",
198198
"DeleteSamlCertificateRequest",
199+
"DeleteSamlRequest",
199200
"DeleteUserMFAOTPRequest",
200201
"DeleteUserRequest",
202+
"EnableOrganizationSamlRequest",
201203
"EncodedJWT",
202204
"GetAPIKeyRequest",
203205
"GetApplicationRequest",
@@ -210,7 +212,6 @@
210212
"GetPolicyRequest",
211213
"GetQuotumRequest",
212214
"GetSSHKeyRequest",
213-
"GetSamlInformationRequest",
214215
"GetUserConnectionsRequest",
215216
"GetUserConnectionsResponse",
216217
"GetUserRequest",
@@ -251,7 +252,6 @@
251252
"RemoveGroupMemberRequest",
252253
"RemoveUserConnectionRequest",
253254
"Saml",
254-
"SamlInformation",
255255
"SetGroupMembersRequest",
256256
"SetOrganizationAliasRequest",
257257
"SetRulesRequest",
@@ -260,10 +260,10 @@
260260
"UpdateAPIKeyRequest",
261261
"UpdateApplicationRequest",
262262
"UpdateGroupRequest",
263-
"UpdateOrganizationSamlRequest",
264263
"UpdateOrganizationSecuritySettingsRequest",
265264
"UpdatePolicyRequest",
266265
"UpdateSSHKeyRequest",
266+
"UpdateSamlRequest",
267267
"UpdateUserPasswordRequest",
268268
"UpdateUserRequest",
269269
"UpdateUserUsernameRequest",

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

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
CreateApplicationRequest,
3838
CreateGroupRequest,
3939
CreateJWTRequest,
40-
CreateOrganizationSamlRequest,
4140
CreatePolicyRequest,
4241
CreateSSHKeyRequest,
4342
CreateUserRequest,
@@ -75,18 +74,17 @@
7574
SSHKey,
7675
Saml,
7776
SamlCertificate,
78-
SamlInformation,
7977
SetGroupMembersRequest,
8078
SetOrganizationAliasRequest,
8179
SetRulesRequest,
8280
SetRulesResponse,
8381
UpdateAPIKeyRequest,
8482
UpdateApplicationRequest,
8583
UpdateGroupRequest,
86-
UpdateOrganizationSamlRequest,
8784
UpdateOrganizationSecuritySettingsRequest,
8885
UpdatePolicyRequest,
8986
UpdateSSHKeyRequest,
87+
UpdateSamlRequest,
9088
UpdateUserPasswordRequest,
9189
UpdateUserRequest,
9290
UpdateUserUsernameRequest,
@@ -125,7 +123,6 @@
125123
unmarshal_Organization,
126124
unmarshal_OrganizationSecuritySettings,
127125
unmarshal_Saml,
128-
unmarshal_SamlInformation,
129126
unmarshal_SetRulesResponse,
130127
unmarshal_ValidateUserMFAOTPResponse,
131128
marshal_AddGroupMemberRequest,
@@ -135,7 +132,6 @@
135132
marshal_CreateApplicationRequest,
136133
marshal_CreateGroupRequest,
137134
marshal_CreateJWTRequest,
138-
marshal_CreateOrganizationSamlRequest,
139135
marshal_CreatePolicyRequest,
140136
marshal_CreateSSHKeyRequest,
141137
marshal_CreateUserRequest,
@@ -148,10 +144,10 @@
148144
marshal_UpdateAPIKeyRequest,
149145
marshal_UpdateApplicationRequest,
150146
marshal_UpdateGroupRequest,
151-
marshal_UpdateOrganizationSamlRequest,
152147
marshal_UpdateOrganizationSecuritySettingsRequest,
153148
marshal_UpdatePolicyRequest,
154149
marshal_UpdateSSHKeyRequest,
150+
marshal_UpdateSamlRequest,
155151
marshal_UpdateUserPasswordRequest,
156152
marshal_UpdateUserRequest,
157153
marshal_UpdateUserUsernameRequest,
@@ -3072,27 +3068,20 @@ async def get_organization_saml(
30723068
self._throw_on_error(res)
30733069
return unmarshal_Saml(res.json())
30743070

3075-
async def create_organization_saml(
3071+
async def enable_organization_saml(
30763072
self,
30773073
*,
3078-
entity_id: str,
3079-
single_sign_on_url: str,
30803074
organization_id: Optional[str] = None,
30813075
) -> Saml:
30823076
"""
3083-
Create a SAML Identity Provider configuration for an Organization.
3084-
:param entity_id: Entity ID of the SAML Identity Provider.
3085-
:param single_sign_on_url: Single Sign-On URL of the SAML Identity Provider.
3077+
Enable SAML Identity Provider for an Organization.
30863078
:param organization_id: ID of the Organization.
30873079
:return: :class:`Saml <Saml>`
30883080
30893081
Usage:
30903082
::
30913083
3092-
result = await api.create_organization_saml(
3093-
entity_id="example",
3094-
single_sign_on_url="example",
3095-
)
3084+
result = await api.enable_organization_saml()
30963085
"""
30973086

30983087
param_organization_id = validate_path_param(
@@ -3102,49 +3091,42 @@ async def create_organization_saml(
31023091
res = self._request(
31033092
"POST",
31043093
f"/iam/v1alpha1/organizations/{param_organization_id}/saml",
3105-
body=marshal_CreateOrganizationSamlRequest(
3106-
CreateOrganizationSamlRequest(
3107-
entity_id=entity_id,
3108-
single_sign_on_url=single_sign_on_url,
3109-
organization_id=organization_id,
3110-
),
3111-
self.client,
3112-
),
3094+
body={},
31133095
)
31143096

31153097
self._throw_on_error(res)
31163098
return unmarshal_Saml(res.json())
31173099

3118-
async def update_organization_saml(
3100+
async def update_saml(
31193101
self,
31203102
*,
3121-
organization_id: Optional[str] = None,
3103+
saml_id: str,
31223104
entity_id: Optional[str] = None,
31233105
single_sign_on_url: Optional[str] = None,
31243106
) -> Saml:
31253107
"""
3126-
Update a SAML Identity Provider configuration for an Organization.
3127-
:param organization_id: ID of the Organization.
3108+
Update SAML Identity Provider configuration.
3109+
:param saml_id: ID of the SAML configuration.
31283110
:param entity_id: Entity ID of the SAML Identity Provider.
31293111
:param single_sign_on_url: Single Sign-On URL of the SAML Identity Provider.
31303112
:return: :class:`Saml <Saml>`
31313113
31323114
Usage:
31333115
::
31343116
3135-
result = await api.update_organization_saml()
3117+
result = await api.update_saml(
3118+
saml_id="example",
3119+
)
31363120
"""
31373121

3138-
param_organization_id = validate_path_param(
3139-
"organization_id", organization_id or self.client.default_organization_id
3140-
)
3122+
param_saml_id = validate_path_param("saml_id", saml_id)
31413123

31423124
res = self._request(
31433125
"PATCH",
3144-
f"/iam/v1alpha1/organizations/{param_organization_id}/saml",
3145-
body=marshal_UpdateOrganizationSamlRequest(
3146-
UpdateOrganizationSamlRequest(
3147-
organization_id=organization_id,
3126+
f"/iam/v1alpha1/saml/{param_saml_id}",
3127+
body=marshal_UpdateSamlRequest(
3128+
UpdateSamlRequest(
3129+
saml_id=saml_id,
31483130
entity_id=entity_id,
31493131
single_sign_on_url=single_sign_on_url,
31503132
),
@@ -3155,28 +3137,28 @@ async def update_organization_saml(
31553137
self._throw_on_error(res)
31563138
return unmarshal_Saml(res.json())
31573139

3158-
async def delete_organization_saml(
3140+
async def delete_saml(
31593141
self,
31603142
*,
3161-
organization_id: Optional[str] = None,
3143+
saml_id: str,
31623144
) -> None:
31633145
"""
3164-
Delete a SAML Identity Provider configuration for an Organization.
3165-
:param organization_id: ID of the Organization.
3146+
Disable SAML Identity Provider for an Organization.
3147+
:param saml_id: ID of the SAML configuration.
31663148
31673149
Usage:
31683150
::
31693151
3170-
result = await api.delete_organization_saml()
3152+
result = await api.delete_saml(
3153+
saml_id="example",
3154+
)
31713155
"""
31723156

3173-
param_organization_id = validate_path_param(
3174-
"organization_id", organization_id or self.client.default_organization_id
3175-
)
3157+
param_saml_id = validate_path_param("saml_id", saml_id)
31763158

31773159
res = self._request(
31783160
"DELETE",
3179-
f"/iam/v1alpha1/organizations/{param_organization_id}/saml",
3161+
f"/iam/v1alpha1/saml/{param_saml_id}",
31803162
)
31813163

31823164
self._throw_on_error(res)
@@ -3276,25 +3258,3 @@ async def delete_saml_certificate(
32763258
)
32773259

32783260
self._throw_on_error(res)
3279-
3280-
async def get_saml_information(
3281-
self,
3282-
) -> SamlInformation:
3283-
"""
3284-
Get SAML information.
3285-
3286-
:return: :class:`SamlInformation <SamlInformation>`
3287-
3288-
Usage:
3289-
::
3290-
3291-
result = await api.get_saml_information()
3292-
"""
3293-
3294-
res = self._request(
3295-
"GET",
3296-
"/iam/v1alpha1/saml-information",
3297-
)
3298-
3299-
self._throw_on_error(res)
3300-
return unmarshal_SamlInformation(res.json())

0 commit comments

Comments
 (0)