-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathget_ssh_keypair.py
More file actions
40 lines (31 loc) · 1.04 KB
/
get_ssh_keypair.py
File metadata and controls
40 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import uuid
from dataclasses import dataclass
from typing import override
from ai.backend.common.data.permission.types import RBACElementType
from ai.backend.manager.actions.types import ActionOperationType
from ai.backend.manager.data.permission.types import RBACElementRef
from ai.backend.manager.services.auth.actions.base import (
KeypairSingleEntityAction,
KeypairSingleEntityActionResult,
)
@dataclass
class GetSSHKeypairAction(KeypairSingleEntityAction):
user_id: uuid.UUID
access_key: str
@override
@classmethod
def operation_type(cls) -> ActionOperationType:
return ActionOperationType.GET
@override
def target_entity_id(self) -> str:
return self.access_key
@override
def target_element(self) -> RBACElementRef:
return RBACElementRef(RBACElementType.KEYPAIR, self.access_key)
@dataclass
class GetSSHKeypairActionResult(KeypairSingleEntityActionResult):
public_key: str
access_key: str
@override
def target_entity_id(self) -> str:
return self.access_key