diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py index edb257bad..d4e328316 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/__init__.py @@ -19,6 +19,8 @@ from .types import UserStatus from .types import UserType from .types import QuotumLimit +from .types import ListUserConnectionsResponseConnectionConnectedOrganization +from .types import ListUserConnectionsResponseConnectionConnectedUser from .types import JWT from .types import RuleSpecs from .types import CreateUserRequestMember @@ -32,6 +34,7 @@ from .types import Quotum from .types import Rule from .types import SSHKey +from .types import ListUserConnectionsResponseConnection from .types import User from .types import AddGroupMemberRequest from .types import AddGroupMembersRequest @@ -85,6 +88,8 @@ from .types import ListRulesResponse from .types import ListSSHKeysRequest from .types import ListSSHKeysResponse +from .types import ListUserConnectionsRequest +from .types import ListUserConnectionsResponse from .types import ListUsersRequest from .types import ListUsersResponse from .types import LockUserRequest @@ -128,6 +133,8 @@ "UserStatus", "UserType", "QuotumLimit", + "ListUserConnectionsResponseConnectionConnectedOrganization", + "ListUserConnectionsResponseConnectionConnectedUser", "JWT", "RuleSpecs", "CreateUserRequestMember", @@ -141,6 +148,7 @@ "Quotum", "Rule", "SSHKey", + "ListUserConnectionsResponseConnection", "User", "AddGroupMemberRequest", "AddGroupMembersRequest", @@ -194,6 +202,8 @@ "ListRulesResponse", "ListSSHKeysRequest", "ListSSHKeysResponse", + "ListUserConnectionsRequest", + "ListUserConnectionsResponse", "ListUsersRequest", "ListUsersResponse", "LockUserRequest", diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/api.py b/scaleway-async/scaleway_async/iam/v1alpha1/api.py index 24fc6a492..335ed3bc2 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/api.py @@ -52,6 +52,7 @@ ListQuotaResponse, ListRulesResponse, ListSSHKeysResponse, + ListUserConnectionsResponse, ListUsersResponse, Log, MFAOTP, @@ -101,6 +102,7 @@ unmarshal_ListQuotaResponse, unmarshal_ListRulesResponse, unmarshal_ListSSHKeysResponse, + unmarshal_ListUserConnectionsResponse, unmarshal_ListUsersResponse, unmarshal_MFAOTP, unmarshal_OrganizationSecuritySettings, @@ -851,6 +853,33 @@ async def list_grace_periods( self._throw_on_error(res) return unmarshal_ListGracePeriodsResponse(res.json()) + async def list_user_connections( + self, + *, + user_id: str, + ) -> ListUserConnectionsResponse: + """ + :param user_id: ID of the user to list connections for. + :return: :class:`ListUserConnectionsResponse ` + + Usage: + :: + + result = await api.list_user_connections( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "GET", + f"/iam/v1alpha1/users/{param_user_id}/connections", + ) + + self._throw_on_error(res) + return unmarshal_ListUserConnectionsResponse(res.json()) + async def list_applications( self, *, diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py index c6a9ef1eb..a02759f70 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py @@ -35,6 +35,10 @@ Rule, ListRulesResponse, ListSSHKeysResponse, + ListUserConnectionsResponseConnectionConnectedOrganization, + ListUserConnectionsResponseConnectionConnectedUser, + ListUserConnectionsResponseConnection, + ListUserConnectionsResponse, ListUsersResponse, MFAOTP, OrganizationSecuritySettings, @@ -1030,6 +1034,104 @@ def unmarshal_ListSSHKeysResponse(data: Any) -> ListSSHKeysResponse: return ListSSHKeysResponse(**args) +def unmarshal_ListUserConnectionsResponseConnectionConnectedOrganization( + data: Any, +) -> ListUserConnectionsResponseConnectionConnectedOrganization: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedOrganization' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("name", None) + if field is not None: + args["name"] = field + + field = data.get("locked", None) + if field is not None: + args["locked"] = field + + return ListUserConnectionsResponseConnectionConnectedOrganization(**args) + + +def unmarshal_ListUserConnectionsResponseConnectionConnectedUser( + data: Any, +) -> ListUserConnectionsResponseConnectionConnectedUser: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedUser' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("username", None) + if field is not None: + args["username"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return ListUserConnectionsResponseConnectionConnectedUser(**args) + + +def unmarshal_ListUserConnectionsResponseConnection( + data: Any, +) -> ListUserConnectionsResponseConnection: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnection' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("organization", None) + if field is not None: + args["organization"] = ( + unmarshal_ListUserConnectionsResponseConnectionConnectedOrganization(field) + ) + else: + args["organization"] = None + + field = data.get("user", None) + if field is not None: + args["user"] = unmarshal_ListUserConnectionsResponseConnectionConnectedUser( + field + ) + else: + args["user"] = None + + return ListUserConnectionsResponseConnection(**args) + + +def unmarshal_ListUserConnectionsResponse(data: Any) -> ListUserConnectionsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("connections", None) + if field is not None: + args["connections"] = ( + [unmarshal_ListUserConnectionsResponseConnection(v) for v in field] + if field is not None + else None + ) + + return ListUserConnectionsResponse(**args) + + def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway-async/scaleway_async/iam/v1alpha1/types.py b/scaleway-async/scaleway_async/iam/v1alpha1/types.py index 571ee9ac8..6d0a559a7 100644 --- a/scaleway-async/scaleway_async/iam/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/iam/v1alpha1/types.py @@ -219,6 +219,24 @@ class QuotumLimit: unlimited: Optional[bool] +@dataclass +class ListUserConnectionsResponseConnectionConnectedOrganization: + id: str + + name: str + + locked: bool + + +@dataclass +class ListUserConnectionsResponseConnectionConnectedUser: + id: str + + username: str + + type_: UserType + + @dataclass class JWT: jti: str @@ -774,6 +792,19 @@ class SSHKey: """ +@dataclass +class ListUserConnectionsResponseConnection: + organization: Optional[ListUserConnectionsResponseConnectionConnectedOrganization] + """ + Information about the connected organization. + """ + + user: Optional[ListUserConnectionsResponseConnectionConnectedUser] + """ + Information about the connected user. + """ + + @dataclass class User: id: str @@ -1750,6 +1781,22 @@ class ListSSHKeysResponse: """ +@dataclass +class ListUserConnectionsRequest: + user_id: str + """ + ID of the user to list connections for. + """ + + +@dataclass +class ListUserConnectionsResponse: + connections: List[ListUserConnectionsResponseConnection] + """ + List of connections. + """ + + @dataclass class ListUsersRequest: order_by: Optional[ListUsersRequestOrderBy] diff --git a/scaleway/scaleway/iam/v1alpha1/__init__.py b/scaleway/scaleway/iam/v1alpha1/__init__.py index edb257bad..d4e328316 100644 --- a/scaleway/scaleway/iam/v1alpha1/__init__.py +++ b/scaleway/scaleway/iam/v1alpha1/__init__.py @@ -19,6 +19,8 @@ from .types import UserStatus from .types import UserType from .types import QuotumLimit +from .types import ListUserConnectionsResponseConnectionConnectedOrganization +from .types import ListUserConnectionsResponseConnectionConnectedUser from .types import JWT from .types import RuleSpecs from .types import CreateUserRequestMember @@ -32,6 +34,7 @@ from .types import Quotum from .types import Rule from .types import SSHKey +from .types import ListUserConnectionsResponseConnection from .types import User from .types import AddGroupMemberRequest from .types import AddGroupMembersRequest @@ -85,6 +88,8 @@ from .types import ListRulesResponse from .types import ListSSHKeysRequest from .types import ListSSHKeysResponse +from .types import ListUserConnectionsRequest +from .types import ListUserConnectionsResponse from .types import ListUsersRequest from .types import ListUsersResponse from .types import LockUserRequest @@ -128,6 +133,8 @@ "UserStatus", "UserType", "QuotumLimit", + "ListUserConnectionsResponseConnectionConnectedOrganization", + "ListUserConnectionsResponseConnectionConnectedUser", "JWT", "RuleSpecs", "CreateUserRequestMember", @@ -141,6 +148,7 @@ "Quotum", "Rule", "SSHKey", + "ListUserConnectionsResponseConnection", "User", "AddGroupMemberRequest", "AddGroupMembersRequest", @@ -194,6 +202,8 @@ "ListRulesResponse", "ListSSHKeysRequest", "ListSSHKeysResponse", + "ListUserConnectionsRequest", + "ListUserConnectionsResponse", "ListUsersRequest", "ListUsersResponse", "LockUserRequest", diff --git a/scaleway/scaleway/iam/v1alpha1/api.py b/scaleway/scaleway/iam/v1alpha1/api.py index 11364cf41..4284181ef 100644 --- a/scaleway/scaleway/iam/v1alpha1/api.py +++ b/scaleway/scaleway/iam/v1alpha1/api.py @@ -52,6 +52,7 @@ ListQuotaResponse, ListRulesResponse, ListSSHKeysResponse, + ListUserConnectionsResponse, ListUsersResponse, Log, MFAOTP, @@ -101,6 +102,7 @@ unmarshal_ListQuotaResponse, unmarshal_ListRulesResponse, unmarshal_ListSSHKeysResponse, + unmarshal_ListUserConnectionsResponse, unmarshal_ListUsersResponse, unmarshal_MFAOTP, unmarshal_OrganizationSecuritySettings, @@ -851,6 +853,33 @@ def list_grace_periods( self._throw_on_error(res) return unmarshal_ListGracePeriodsResponse(res.json()) + def list_user_connections( + self, + *, + user_id: str, + ) -> ListUserConnectionsResponse: + """ + :param user_id: ID of the user to list connections for. + :return: :class:`ListUserConnectionsResponse ` + + Usage: + :: + + result = api.list_user_connections( + user_id="example", + ) + """ + + param_user_id = validate_path_param("user_id", user_id) + + res = self._request( + "GET", + f"/iam/v1alpha1/users/{param_user_id}/connections", + ) + + self._throw_on_error(res) + return unmarshal_ListUserConnectionsResponse(res.json()) + def list_applications( self, *, diff --git a/scaleway/scaleway/iam/v1alpha1/marshalling.py b/scaleway/scaleway/iam/v1alpha1/marshalling.py index c6a9ef1eb..a02759f70 100644 --- a/scaleway/scaleway/iam/v1alpha1/marshalling.py +++ b/scaleway/scaleway/iam/v1alpha1/marshalling.py @@ -35,6 +35,10 @@ Rule, ListRulesResponse, ListSSHKeysResponse, + ListUserConnectionsResponseConnectionConnectedOrganization, + ListUserConnectionsResponseConnectionConnectedUser, + ListUserConnectionsResponseConnection, + ListUserConnectionsResponse, ListUsersResponse, MFAOTP, OrganizationSecuritySettings, @@ -1030,6 +1034,104 @@ def unmarshal_ListSSHKeysResponse(data: Any) -> ListSSHKeysResponse: return ListSSHKeysResponse(**args) +def unmarshal_ListUserConnectionsResponseConnectionConnectedOrganization( + data: Any, +) -> ListUserConnectionsResponseConnectionConnectedOrganization: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedOrganization' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("name", None) + if field is not None: + args["name"] = field + + field = data.get("locked", None) + if field is not None: + args["locked"] = field + + return ListUserConnectionsResponseConnectionConnectedOrganization(**args) + + +def unmarshal_ListUserConnectionsResponseConnectionConnectedUser( + data: Any, +) -> ListUserConnectionsResponseConnectionConnectedUser: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnectionConnectedUser' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + + field = data.get("username", None) + if field is not None: + args["username"] = field + + field = data.get("type", None) + if field is not None: + args["type_"] = field + + return ListUserConnectionsResponseConnectionConnectedUser(**args) + + +def unmarshal_ListUserConnectionsResponseConnection( + data: Any, +) -> ListUserConnectionsResponseConnection: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponseConnection' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("organization", None) + if field is not None: + args["organization"] = ( + unmarshal_ListUserConnectionsResponseConnectionConnectedOrganization(field) + ) + else: + args["organization"] = None + + field = data.get("user", None) + if field is not None: + args["user"] = unmarshal_ListUserConnectionsResponseConnectionConnectedUser( + field + ) + else: + args["user"] = None + + return ListUserConnectionsResponseConnection(**args) + + +def unmarshal_ListUserConnectionsResponse(data: Any) -> ListUserConnectionsResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListUserConnectionsResponse' failed as data isn't a dictionary." + ) + + args: Dict[str, Any] = {} + + field = data.get("connections", None) + if field is not None: + args["connections"] = ( + [unmarshal_ListUserConnectionsResponseConnection(v) for v in field] + if field is not None + else None + ) + + return ListUserConnectionsResponse(**args) + + def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: if not isinstance(data, dict): raise TypeError( diff --git a/scaleway/scaleway/iam/v1alpha1/types.py b/scaleway/scaleway/iam/v1alpha1/types.py index 571ee9ac8..6d0a559a7 100644 --- a/scaleway/scaleway/iam/v1alpha1/types.py +++ b/scaleway/scaleway/iam/v1alpha1/types.py @@ -219,6 +219,24 @@ class QuotumLimit: unlimited: Optional[bool] +@dataclass +class ListUserConnectionsResponseConnectionConnectedOrganization: + id: str + + name: str + + locked: bool + + +@dataclass +class ListUserConnectionsResponseConnectionConnectedUser: + id: str + + username: str + + type_: UserType + + @dataclass class JWT: jti: str @@ -774,6 +792,19 @@ class SSHKey: """ +@dataclass +class ListUserConnectionsResponseConnection: + organization: Optional[ListUserConnectionsResponseConnectionConnectedOrganization] + """ + Information about the connected organization. + """ + + user: Optional[ListUserConnectionsResponseConnectionConnectedUser] + """ + Information about the connected user. + """ + + @dataclass class User: id: str @@ -1750,6 +1781,22 @@ class ListSSHKeysResponse: """ +@dataclass +class ListUserConnectionsRequest: + user_id: str + """ + ID of the user to list connections for. + """ + + +@dataclass +class ListUserConnectionsResponse: + connections: List[ListUserConnectionsResponseConnection] + """ + List of connections. + """ + + @dataclass class ListUsersRequest: order_by: Optional[ListUsersRequestOrderBy]