Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
from .types import PermissionSetScopeType
from .types import UserStatus
from .types import UserType
from .types import GetUserConnectionsResponseConnectionConnectedOrganization
from .types import GetUserConnectionsResponseConnectionConnectedUser
from .types import QuotumLimit
from .types import JWT
from .types import RuleSpecs
from .types import CreateUserRequestMember
from .types import GetUserConnectionsResponseConnection
from .types import APIKey
from .types import Application
from .types import GracePeriod
Expand Down Expand Up @@ -62,6 +65,8 @@
from .types import GetPolicyRequest
from .types import GetQuotumRequest
from .types import GetSSHKeyRequest
from .types import GetUserConnectionsRequest
from .types import GetUserConnectionsResponse
from .types import GetUserRequest
from .types import ListAPIKeysRequest
from .types import ListAPIKeysResponse
Expand Down Expand Up @@ -127,10 +132,13 @@
"PermissionSetScopeType",
"UserStatus",
"UserType",
"GetUserConnectionsResponseConnectionConnectedOrganization",
"GetUserConnectionsResponseConnectionConnectedUser",
"QuotumLimit",
"JWT",
"RuleSpecs",
"CreateUserRequestMember",
"GetUserConnectionsResponseConnection",
"APIKey",
"Application",
"GracePeriod",
Expand Down Expand Up @@ -171,6 +179,8 @@
"GetPolicyRequest",
"GetQuotumRequest",
"GetSSHKeyRequest",
"GetUserConnectionsRequest",
"GetUserConnectionsResponse",
"GetUserRequest",
"ListAPIKeysRequest",
"ListAPIKeysResponse",
Expand Down
29 changes: 29 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
CreateUserRequest,
CreateUserRequestMember,
EncodedJWT,
GetUserConnectionsResponse,
Group,
JWT,
ListAPIKeysResponse,
Expand Down Expand Up @@ -90,6 +91,7 @@
unmarshal_SSHKey,
unmarshal_User,
unmarshal_EncodedJWT,
unmarshal_GetUserConnectionsResponse,
unmarshal_ListAPIKeysResponse,
unmarshal_ListApplicationsResponse,
unmarshal_ListGracePeriodsResponse,
Expand Down Expand Up @@ -851,6 +853,33 @@ async def list_grace_periods(
self._throw_on_error(res)
return unmarshal_ListGracePeriodsResponse(res.json())

async def get_user_connections(
self,
*,
user_id: str,
) -> GetUserConnectionsResponse:
"""
:param user_id: ID of the user to list connections for.
:return: :class:`GetUserConnectionsResponse <GetUserConnectionsResponse>`

Usage:
::

result = await api.get_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_GetUserConnectionsResponse(res.json())

async def list_applications(
self,
*,
Expand Down
102 changes: 102 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
SSHKey,
User,
EncodedJWT,
GetUserConnectionsResponseConnectionConnectedOrganization,
GetUserConnectionsResponseConnectionConnectedUser,
GetUserConnectionsResponseConnection,
GetUserConnectionsResponse,
ListAPIKeysResponse,
ListApplicationsResponse,
GracePeriod,
Expand Down Expand Up @@ -700,6 +704,104 @@ def unmarshal_EncodedJWT(data: Any) -> EncodedJWT:
return EncodedJWT(**args)


def unmarshal_GetUserConnectionsResponseConnectionConnectedOrganization(
data: Any,
) -> GetUserConnectionsResponseConnectionConnectedOrganization:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GetUserConnectionsResponseConnectionConnectedOrganization' 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 GetUserConnectionsResponseConnectionConnectedOrganization(**args)


def unmarshal_GetUserConnectionsResponseConnectionConnectedUser(
data: Any,
) -> GetUserConnectionsResponseConnectionConnectedUser:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GetUserConnectionsResponseConnectionConnectedUser' 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 GetUserConnectionsResponseConnectionConnectedUser(**args)


def unmarshal_GetUserConnectionsResponseConnection(
data: Any,
) -> GetUserConnectionsResponseConnection:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GetUserConnectionsResponseConnection' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("organization", None)
if field is not None:
args["organization"] = (
unmarshal_GetUserConnectionsResponseConnectionConnectedOrganization(field)
)
else:
args["organization"] = None

field = data.get("user", None)
if field is not None:
args["user"] = unmarshal_GetUserConnectionsResponseConnectionConnectedUser(
field
)
else:
args["user"] = None

return GetUserConnectionsResponseConnection(**args)


def unmarshal_GetUserConnectionsResponse(data: Any) -> GetUserConnectionsResponse:
if not isinstance(data, dict):
raise TypeError(
"Unmarshalling the type 'GetUserConnectionsResponse' failed as data isn't a dictionary."
)

args: Dict[str, Any] = {}

field = data.get("connections", None)
if field is not None:
args["connections"] = (
[unmarshal_GetUserConnectionsResponseConnection(v) for v in field]
if field is not None
else None
)

return GetUserConnectionsResponse(**args)


def unmarshal_ListAPIKeysResponse(data: Any) -> ListAPIKeysResponse:
if not isinstance(data, dict):
raise TypeError(
Expand Down
47 changes: 47 additions & 0 deletions scaleway-async/scaleway_async/iam/v1alpha1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ def __str__(self) -> str:
return str(self.value)


@dataclass
class GetUserConnectionsResponseConnectionConnectedOrganization:
id: str

name: str

locked: bool


@dataclass
class GetUserConnectionsResponseConnectionConnectedUser:
id: str

username: str

type_: UserType


@dataclass
class QuotumLimit:
global_: Optional[bool]
Expand Down Expand Up @@ -307,6 +325,19 @@ class CreateUserRequestMember:
"""


@dataclass
class GetUserConnectionsResponseConnection:
organization: Optional[GetUserConnectionsResponseConnectionConnectedOrganization]
"""
Information about the connected organization.
"""

user: Optional[GetUserConnectionsResponseConnectionConnectedUser]
"""
Information about the connected user.
"""


@dataclass
class APIKey:
access_key: str
Expand Down Expand Up @@ -1203,6 +1234,22 @@ class GetSSHKeyRequest:
"""


@dataclass
class GetUserConnectionsRequest:
user_id: str
"""
ID of the user to list connections for.
"""


@dataclass
class GetUserConnectionsResponse:
connections: List[GetUserConnectionsResponseConnection]
"""
List of connections.
"""


@dataclass
class GetUserRequest:
user_id: str
Expand Down
10 changes: 10 additions & 0 deletions scaleway/scaleway/iam/v1alpha1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
from .types import PermissionSetScopeType
from .types import UserStatus
from .types import UserType
from .types import GetUserConnectionsResponseConnectionConnectedOrganization
from .types import GetUserConnectionsResponseConnectionConnectedUser
from .types import QuotumLimit
from .types import JWT
from .types import RuleSpecs
from .types import CreateUserRequestMember
from .types import GetUserConnectionsResponseConnection
from .types import APIKey
from .types import Application
from .types import GracePeriod
Expand Down Expand Up @@ -62,6 +65,8 @@
from .types import GetPolicyRequest
from .types import GetQuotumRequest
from .types import GetSSHKeyRequest
from .types import GetUserConnectionsRequest
from .types import GetUserConnectionsResponse
from .types import GetUserRequest
from .types import ListAPIKeysRequest
from .types import ListAPIKeysResponse
Expand Down Expand Up @@ -127,10 +132,13 @@
"PermissionSetScopeType",
"UserStatus",
"UserType",
"GetUserConnectionsResponseConnectionConnectedOrganization",
"GetUserConnectionsResponseConnectionConnectedUser",
"QuotumLimit",
"JWT",
"RuleSpecs",
"CreateUserRequestMember",
"GetUserConnectionsResponseConnection",
"APIKey",
"Application",
"GracePeriod",
Expand Down Expand Up @@ -171,6 +179,8 @@
"GetPolicyRequest",
"GetQuotumRequest",
"GetSSHKeyRequest",
"GetUserConnectionsRequest",
"GetUserConnectionsResponse",
"GetUserRequest",
"ListAPIKeysRequest",
"ListAPIKeysResponse",
Expand Down
29 changes: 29 additions & 0 deletions scaleway/scaleway/iam/v1alpha1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
CreateUserRequest,
CreateUserRequestMember,
EncodedJWT,
GetUserConnectionsResponse,
Group,
JWT,
ListAPIKeysResponse,
Expand Down Expand Up @@ -90,6 +91,7 @@
unmarshal_SSHKey,
unmarshal_User,
unmarshal_EncodedJWT,
unmarshal_GetUserConnectionsResponse,
unmarshal_ListAPIKeysResponse,
unmarshal_ListApplicationsResponse,
unmarshal_ListGracePeriodsResponse,
Expand Down Expand Up @@ -851,6 +853,33 @@ def list_grace_periods(
self._throw_on_error(res)
return unmarshal_ListGracePeriodsResponse(res.json())

def get_user_connections(
self,
*,
user_id: str,
) -> GetUserConnectionsResponse:
"""
:param user_id: ID of the user to list connections for.
:return: :class:`GetUserConnectionsResponse <GetUserConnectionsResponse>`

Usage:
::

result = api.get_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_GetUserConnectionsResponse(res.json())

def list_applications(
self,
*,
Expand Down
Loading