Skip to content

Commit 47992c8

Browse files
feat(iam): add GetSamlCertificate method (scaleway#1635)
Co-authored-by: Jonathan R. <jremy@scaleway.com>
1 parent f50581b commit 47992c8

6 files changed

Lines changed: 76 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
from .types import GetPolicyRequest
9090
from .types import GetQuotumRequest
9191
from .types import GetSSHKeyRequest
92+
from .types import GetSamlCertificateRequest
9293
from .types import GetUserConnectionsRequest
9394
from .types import GetUserConnectionsResponse
9495
from .types import GetUserRequest
@@ -248,6 +249,7 @@
248249
"GetPolicyRequest",
249250
"GetQuotumRequest",
250251
"GetSSHKeyRequest",
252+
"GetSamlCertificateRequest",
251253
"GetUserConnectionsRequest",
252254
"GetUserConnectionsResponse",
253255
"GetUserRequest",

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,6 +3324,34 @@ async def add_saml_certificate(
33243324
self._throw_on_error(res)
33253325
return unmarshal_SamlCertificate(res.json())
33263326

3327+
async def get_saml_certificate(
3328+
self,
3329+
*,
3330+
certificate_id: str,
3331+
) -> SamlCertificate:
3332+
"""
3333+
Get a SAML certificate.
3334+
:param certificate_id: ID of the certificate to get.
3335+
:return: :class:`SamlCertificate <SamlCertificate>`
3336+
3337+
Usage:
3338+
::
3339+
3340+
result = await api.get_saml_certificate(
3341+
certificate_id="example",
3342+
)
3343+
"""
3344+
3345+
param_certificate_id = validate_path_param("certificate_id", certificate_id)
3346+
3347+
res = self._request(
3348+
"GET",
3349+
f"/iam/v1alpha1/saml-certificates/{param_certificate_id}",
3350+
)
3351+
3352+
self._throw_on_error(res)
3353+
return unmarshal_SamlCertificate(res.json())
3354+
33273355
async def delete_saml_certificate(
33283356
self,
33293357
*,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,14 @@ class GetSSHKeyRequest:
15541554
"""
15551555

15561556

1557+
@dataclass
1558+
class GetSamlCertificateRequest:
1559+
certificate_id: str
1560+
"""
1561+
ID of the certificate to get.
1562+
"""
1563+
1564+
15571565
@dataclass
15581566
class GetUserConnectionsRequest:
15591567
user_id: str

scaleway/scaleway/iam/v1alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
from .types import GetPolicyRequest
9090
from .types import GetQuotumRequest
9191
from .types import GetSSHKeyRequest
92+
from .types import GetSamlCertificateRequest
9293
from .types import GetUserConnectionsRequest
9394
from .types import GetUserConnectionsResponse
9495
from .types import GetUserRequest
@@ -248,6 +249,7 @@
248249
"GetPolicyRequest",
249250
"GetQuotumRequest",
250251
"GetSSHKeyRequest",
252+
"GetSamlCertificateRequest",
251253
"GetUserConnectionsRequest",
252254
"GetUserConnectionsResponse",
253255
"GetUserRequest",

scaleway/scaleway/iam/v1alpha1/api.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,6 +3324,34 @@ def add_saml_certificate(
33243324
self._throw_on_error(res)
33253325
return unmarshal_SamlCertificate(res.json())
33263326

3327+
def get_saml_certificate(
3328+
self,
3329+
*,
3330+
certificate_id: str,
3331+
) -> SamlCertificate:
3332+
"""
3333+
Get a SAML certificate.
3334+
:param certificate_id: ID of the certificate to get.
3335+
:return: :class:`SamlCertificate <SamlCertificate>`
3336+
3337+
Usage:
3338+
::
3339+
3340+
result = api.get_saml_certificate(
3341+
certificate_id="example",
3342+
)
3343+
"""
3344+
3345+
param_certificate_id = validate_path_param("certificate_id", certificate_id)
3346+
3347+
res = self._request(
3348+
"GET",
3349+
f"/iam/v1alpha1/saml-certificates/{param_certificate_id}",
3350+
)
3351+
3352+
self._throw_on_error(res)
3353+
return unmarshal_SamlCertificate(res.json())
3354+
33273355
def delete_saml_certificate(
33283356
self,
33293357
*,

scaleway/scaleway/iam/v1alpha1/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,14 @@ class GetSSHKeyRequest:
15541554
"""
15551555

15561556

1557+
@dataclass
1558+
class GetSamlCertificateRequest:
1559+
certificate_id: str
1560+
"""
1561+
ID of the certificate to get.
1562+
"""
1563+
1564+
15571565
@dataclass
15581566
class GetUserConnectionsRequest:
15591567
user_id: str

0 commit comments

Comments
 (0)