maleo-foundation 0.1.8__py3-none-any.whl → 0.1.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo_foundation/managers/service.py +69 -5
- {maleo_foundation-0.1.8.dist-info → maleo_foundation-0.1.10.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.8.dist-info → maleo_foundation-0.1.10.dist-info}/RECORD +5 -5
- {maleo_foundation-0.1.8.dist-info → maleo_foundation-0.1.10.dist-info}/WHEEL +1 -1
- {maleo_foundation-0.1.8.dist-info → maleo_foundation-0.1.10.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,10 @@ from maleo_foundation.types import BaseTypes
|
|
18
18
|
from maleo_foundation.utils.keyloader import load_key
|
19
19
|
from maleo_foundation.utils.logging import GoogleCloudLogging, ServiceLogger, ClientLoggerManager
|
20
20
|
|
21
|
+
class LogConfig(BaseModel):
|
22
|
+
logs_dir:str = Field(..., description="Logs directory")
|
23
|
+
google_cloud_logging:GoogleCloudLogging = Field(..., description="Google cloud's logging")
|
24
|
+
|
21
25
|
class Settings(BaseSettings):
|
22
26
|
GOOGLE_CREDENTIALS_PATH:str = Field("/creds/maleo-google-service-account.json", description="Internal credential's file path")
|
23
27
|
INTERNAL_CREDENTIALS_PATH:str = Field("/creds/maleo-internal-service-account.json", description="Internal credential's file path")
|
@@ -77,10 +81,36 @@ class DatabaseConfigurations(BaseModel):
|
|
77
81
|
def url(self) -> str:
|
78
82
|
return f"postgresql://{self.username}:{self.password}@{self.host}:{self.port}/{self.database}"
|
79
83
|
|
84
|
+
class MaleoClientConfiguration(BaseModel):
|
85
|
+
key:str = Field(..., description="Client's key")
|
86
|
+
name:str = Field(..., description="Client's name")
|
87
|
+
url:str = Field(..., description="Client's URL")
|
88
|
+
|
89
|
+
class MaleoClientConfigurations(BaseModel):
|
90
|
+
metadata:MaleoClientConfiguration = Field(..., description="MaleoMetadata client's configuration")
|
91
|
+
security:MaleoClientConfiguration = Field(..., description="MaleoSecurity client's configuration")
|
92
|
+
storage:MaleoClientConfiguration = Field(..., description="MaleoStorage client's configuration")
|
93
|
+
identity:MaleoClientConfiguration = Field(..., description="MaleoIdentity client's configuration")
|
94
|
+
access:MaleoClientConfiguration = Field(..., description="MaleoAccess client's configuration")
|
95
|
+
soapie:MaleoClientConfiguration = Field(..., description="MaleoSOAPIE client's configuration")
|
96
|
+
fhir:MaleoClientConfiguration = Field(..., description="MaleoFHIR client's configuration")
|
97
|
+
dicom:MaleoClientConfiguration = Field(..., description="MaleoDICOM client's configuration")
|
98
|
+
scribe:MaleoClientConfiguration = Field(..., description="MaleoScribe client's configuration")
|
99
|
+
cds:MaleoClientConfiguration = Field(..., description="MaleoCDS client's configuration")
|
100
|
+
imaging:MaleoClientConfiguration = Field(..., description="MaleoImaging client's configuration")
|
101
|
+
mcu:MaleoClientConfiguration = Field(..., description="MaleoMCU client's configuration")
|
102
|
+
|
103
|
+
class Config:
|
104
|
+
arbitrary_types_allowed=True
|
105
|
+
|
106
|
+
class ClientConfigurations(BaseModel):
|
107
|
+
maleo:MaleoClientConfigurations = Field(..., description="Maleo client's configurations")
|
108
|
+
|
80
109
|
class Configurations(BaseModel):
|
81
110
|
service:ServiceConfigurations = Field(..., description="Service's configurations")
|
82
111
|
middleware:MiddlewareConfigurations = Field(..., description="Middleware's configurations")
|
83
112
|
database:DatabaseConfigurations = Field(..., description="Database's configurations")
|
113
|
+
client:ClientConfigurations = Field(...)
|
84
114
|
|
85
115
|
class Config:
|
86
116
|
arbitrary_types_allowed=True
|
@@ -103,6 +133,23 @@ class GoogleClientManagers(BaseModel):
|
|
103
133
|
class Config:
|
104
134
|
arbitrary_types_allowed=True
|
105
135
|
|
136
|
+
class MaleoClientManagerClasses(BaseModel):
|
137
|
+
metadata:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoMetadata client manager")
|
138
|
+
security:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoSecurity client manager")
|
139
|
+
storage:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoStorage client manager")
|
140
|
+
identity:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoIdentity client manager")
|
141
|
+
access:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoAccess client manager")
|
142
|
+
soapie:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoSOAPIE client manager")
|
143
|
+
fhir:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoFHIR client manager")
|
144
|
+
dicom:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoDICOM client manager")
|
145
|
+
scribe:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoScribe client manager")
|
146
|
+
cds:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoCDS client manager")
|
147
|
+
imaging:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoImaging client manager")
|
148
|
+
mcu:Optional[Type[MaleoClientManager]] = Field(None, description="MaleoMCU client manager")
|
149
|
+
|
150
|
+
class Config:
|
151
|
+
arbitrary_types_allowed=True
|
152
|
+
|
106
153
|
class MaleoClientManagers(BaseModel):
|
107
154
|
metadata:Optional[MaleoClientManager] = Field(None, description="MaleoMetadata client manager")
|
108
155
|
security:Optional[MaleoClientManager] = Field(None, description="MaleoSecurity client manager")
|
@@ -136,7 +183,7 @@ class ServiceManager:
|
|
136
183
|
settings:Optional[Settings] = None,
|
137
184
|
google_cloud_logging:Optional[GoogleCloudLogging] = None,
|
138
185
|
client_logger_managers:ClientLoggerManagers = {},
|
139
|
-
|
186
|
+
maleo_client_manager_classes:Optional[MaleoClientManagerClasses] = None
|
140
187
|
):
|
141
188
|
self._db_metadata = db_metadata
|
142
189
|
|
@@ -162,6 +209,11 @@ class ServiceManager:
|
|
162
209
|
else:
|
163
210
|
self._google_cloud_logging = google_cloud_logging
|
164
211
|
|
212
|
+
self._log_config = LogConfig(
|
213
|
+
logs_dir=self._logs_dir,
|
214
|
+
google_cloud_logging=self._google_cloud_logging
|
215
|
+
)
|
216
|
+
|
165
217
|
self._client_logger_managers = client_logger_managers
|
166
218
|
self._initialize_loggers()
|
167
219
|
self._load_credentials()
|
@@ -169,10 +221,10 @@ class ServiceManager:
|
|
169
221
|
self._initialize_db()
|
170
222
|
|
171
223
|
#* Initialize maleo client managers
|
172
|
-
if
|
173
|
-
self.
|
224
|
+
if maleo_client_manager_classes is None:
|
225
|
+
self._maleo_client_manager_classes = MaleoClientManagerClasses()
|
174
226
|
else:
|
175
|
-
self.
|
227
|
+
self._maleo_client_manager_classes = maleo_client_manager_classes
|
176
228
|
self._initialize_clients()
|
177
229
|
|
178
230
|
@property
|
@@ -182,6 +234,10 @@ class ServiceManager:
|
|
182
234
|
@property
|
183
235
|
def logs_dir(self) -> str:
|
184
236
|
return self._logs_dir
|
237
|
+
|
238
|
+
@property
|
239
|
+
def log_config(self) -> LogConfig:
|
240
|
+
return self._log_config
|
185
241
|
|
186
242
|
@property
|
187
243
|
def settings(self) -> Settings:
|
@@ -260,7 +316,11 @@ class ServiceManager:
|
|
260
316
|
#* Initialize http clients
|
261
317
|
self._http_client = HTTPClientManager
|
262
318
|
self._http_client.initialize()
|
263
|
-
|
319
|
+
#* Initialize maleo clients
|
320
|
+
self._maleo_clients = MaleoClientManagers()
|
321
|
+
if self._maleo_client_manager_classes.metadata is not None and issubclass(self._maleo_client_manager_classes.metadata, MaleoClientManager):
|
322
|
+
self._maleo_clients.metadata = self._maleo_client_manager_classes.metadata(**self._configs.client.maleo.metadata.model_dump(), **self._log_config.model_dump())
|
323
|
+
self._clients = ClientManagers(google=self._google_clients, http=self._http_client, maleo=self._maleo_clients)
|
264
324
|
|
265
325
|
@property
|
266
326
|
def google_clients(self) -> GoogleClientManagers:
|
@@ -270,6 +330,10 @@ class ServiceManager:
|
|
270
330
|
def http_client(self) -> Type[HTTPClientManager]:
|
271
331
|
return self._http_client
|
272
332
|
|
333
|
+
@property
|
334
|
+
def maleo_clients(self) -> MaleoClientManagers:
|
335
|
+
return self._maleo_clients
|
336
|
+
|
273
337
|
@property
|
274
338
|
def clients(self) -> ClientManagers:
|
275
339
|
return self._clients
|
@@ -30,7 +30,7 @@ maleo_foundation/expanded_types/service.py,sha256=q8jpKdbCbLWwH1UPQavKpVE14rC5rv
|
|
30
30
|
maleo_foundation/expanded_types/token.py,sha256=4fRTJw6W5MYq71NksNrWNi7qYHQ4_lQwfu9WxwrMipc,355
|
31
31
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
maleo_foundation/managers/db.py,sha256=rbB5W2rSxV2xcexh9j79U4ZKgAuA61t8ZD2IKppg22k,4867
|
33
|
-
maleo_foundation/managers/service.py,sha256=
|
33
|
+
maleo_foundation/managers/service.py,sha256=z3i-0MqNgdvSVTzYeGmu-pJMP800xlkMVcjg9HpilOM,17529
|
34
34
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
maleo_foundation/managers/client/base.py,sha256=GytrN4WB0oa8Flg6VHJ4oSg7kaWQBjXQ8GTwC4VFleY,965
|
36
36
|
maleo_foundation/managers/client/http.py,sha256=dWFZlG1z4TERYBITReR5oSrlzvdhh2EtztVnsU8gCeA,2712
|
@@ -79,7 +79,7 @@ maleo_foundation/utils/logging.py,sha256=DuAaKQ1X7lB0y6udR-GF95BRKeluh0JoYN0K_jc
|
|
79
79
|
maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
|
80
80
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
81
81
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
82
|
-
maleo_foundation-0.1.
|
83
|
-
maleo_foundation-0.1.
|
84
|
-
maleo_foundation-0.1.
|
85
|
-
maleo_foundation-0.1.
|
82
|
+
maleo_foundation-0.1.10.dist-info/METADATA,sha256=7oqsvExgfFn_M57ocxquf_-ZrruFv3NF1QpfcDI1swk,3190
|
83
|
+
maleo_foundation-0.1.10.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
84
|
+
maleo_foundation-0.1.10.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
85
|
+
maleo_foundation-0.1.10.dist-info/RECORD,,
|
File without changes
|