1
+ # For usage please consult https://github.com/hyperledger/aries-cloudagent-python/blob/main/Mediation.md
2
+
3
+ from .base import BaseController
4
+ from aiohttp import ClientSession
5
+ import logging
6
+ from typing import List
7
+
8
+ logger = logging .getLogger ("aries_controller.multitenancy" )
9
+
10
+
11
+ class MultitenancyController (BaseController ):
12
+
13
+ def __init__ (self , admin_url : str , client_session : ClientSession ):
14
+ super ().__init__ (admin_url , client_session )
15
+ self .base_url = "/multitenancy"
16
+
17
+ def default_handler (self , payload ):
18
+ logger .debug ("Multitenancy Message received" , payload )
19
+
20
+
21
+ # Create a subwallet
22
+ async def create_subwallet (self , request ):
23
+ return await self .admin_POST (f"{ self .base_url } /wallet" , json_data = request )
24
+
25
+
26
+ # Get a single subwallet
27
+ async def get_single_subwallet_by_id (self , wallet_id : str ):
28
+ return await self .admin_GET (f"{ self .base_url } /wallet/{ wallet_id } " )
29
+
30
+
31
+ # Update a subwallet
32
+ async def update_subwallet_by_id (self , request , wallet_id : str ):
33
+ return await self .admin_PUT (f"{ self .base_url } /wallet/{ wallet_id } " , json_data = request )
34
+
35
+
36
+ # Remove a subwallet
37
+ async def remove_subwallet_by_id (self , request , wallet_id : str ):
38
+ return await self .admin_POST (f"{ self .base_url } /wallet/{ wallet_id } /remove" , json_data = request )
39
+
40
+
41
+ # Get auth token for a subwallet
42
+ async def get_subwallet_authtoken_by_id (self , request , wallet_id : str ):
43
+ return await self .admin_POST (f"{ self .base_url } /wallet/{ wallet_id } /token" , json_data = request )
44
+
45
+
46
+ # Query subwallets
47
+ async def query_subwallets (self , wallet_name : str = None ):
48
+ params = {}
49
+ if wallet_name :
50
+ params ["wallet_name" ] = wallet_name
51
+
52
+ return await self .admin_GET (f"{ self .base_url } /wallets" )
53
+
54
+
55
+
0 commit comments