maleo-foundation 0.1.8__py3-none-any.whl → 0.1.9__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.
@@ -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,6 +183,7 @@ class ServiceManager:
136
183
  settings:Optional[Settings] = None,
137
184
  google_cloud_logging:Optional[GoogleCloudLogging] = None,
138
185
  client_logger_managers:ClientLoggerManagers = {},
186
+ maleo_client_manager_classes:Optional[MaleoClientManagerClasses] = None,
139
187
  maleo_client_managers:Optional[MaleoClientManagers] = None
140
188
  ):
141
189
  self._db_metadata = db_metadata
@@ -162,6 +210,11 @@ class ServiceManager:
162
210
  else:
163
211
  self._google_cloud_logging = google_cloud_logging
164
212
 
213
+ self._log_config = LogConfig(
214
+ logs_dir=self._logs_dir,
215
+ google_cloud_logging=self._google_cloud_logging
216
+ )
217
+
165
218
  self._client_logger_managers = client_logger_managers
166
219
  self._initialize_loggers()
167
220
  self._load_credentials()
@@ -169,10 +222,14 @@ class ServiceManager:
169
222
  self._initialize_db()
170
223
 
171
224
  #* Initialize maleo client managers
225
+ if maleo_client_manager_classes is None:
226
+ self._maleo_client_manager_classes = MaleoClientManagerClasses()
227
+ else:
228
+ self._maleo_client_manager_classes = maleo_client_manager_classes
172
229
  if maleo_client_managers is None:
173
- self._maleo_client_managers = MaleoClientManagers()
230
+ self._maleo_clients = MaleoClientManagers()
174
231
  else:
175
- self._maleo_client_managers = maleo_client_managers
232
+ self._maleo_clients = maleo_client_managers
176
233
  self._initialize_clients()
177
234
 
178
235
  @property
@@ -182,6 +239,10 @@ class ServiceManager:
182
239
  @property
183
240
  def logs_dir(self) -> str:
184
241
  return self._logs_dir
242
+
243
+ @property
244
+ def log_config(self) -> LogConfig:
245
+ return self._log_config
185
246
 
186
247
  @property
187
248
  def settings(self) -> Settings:
@@ -260,7 +321,11 @@ class ServiceManager:
260
321
  #* Initialize http clients
261
322
  self._http_client = HTTPClientManager
262
323
  self._http_client.initialize()
263
- self._clients = ClientManagers(google=self._google_clients, http=self._http_client, maleo=self._maleo_client_managers)
324
+ #* Initialize maleo clients
325
+ self._maleo_clients = MaleoClientManagers()
326
+ if self._maleo_client_manager_classes.metadata is not None and issubclass(self._maleo_client_manager_classes.metadata, MaleoClientManager):
327
+ self._maleo_clients.metadata = self._maleo_client_manager_classes.metadata(**self._configs.client.maleo.metadata.model_dump(), **self._log_config.model_dump())
328
+ self._clients = ClientManagers(google=self._google_clients, http=self._http_client, maleo=self._maleo_clients)
264
329
 
265
330
  @property
266
331
  def google_clients(self) -> GoogleClientManagers:
@@ -270,6 +335,10 @@ class ServiceManager:
270
335
  def http_client(self) -> Type[HTTPClientManager]:
271
336
  return self._http_client
272
337
 
338
+ @property
339
+ def maleo_clients(self) -> MaleoClientManagers:
340
+ return self._maleo_clients
341
+
273
342
  @property
274
343
  def clients(self) -> ClientManagers:
275
344
  return self._clients
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -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=UVslS10rF0k-dWYHGdG8eZAXXq0GywZ24hnW46QghPo,13566
33
+ maleo_foundation/managers/service.py,sha256=ghwjLKurZigwu_FCse_LunDk4WSCQqZzDH42RBd5Ccc,17765
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.8.dist-info/METADATA,sha256=55FJFi_JYgREQQe3wuXSZmJXnhFzzln9l1WwBwz-qdg,3189
83
- maleo_foundation-0.1.8.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
84
- maleo_foundation-0.1.8.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
85
- maleo_foundation-0.1.8.dist-info/RECORD,,
82
+ maleo_foundation-0.1.9.dist-info/METADATA,sha256=FKKbLyX1nC9xrw6-yn8EocsjGflWUa-0gCEZttCr_F4,3189
83
+ maleo_foundation-0.1.9.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
84
+ maleo_foundation-0.1.9.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
85
+ maleo_foundation-0.1.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5