maleo-foundation 0.3.65__py3-none-any.whl → 0.3.67__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.
@@ -1,5 +1,6 @@
1
1
  from fastapi import FastAPI, APIRouter
2
2
  from fastapi.exceptions import RequestValidationError
3
+ from google.cloud import pubsub_v1
3
4
  from google.oauth2.service_account import Credentials
4
5
  from redis.asyncio.client import Redis
5
6
  from redis.exceptions import RedisError
@@ -72,6 +73,7 @@ class ServiceManager:
72
73
  self._load_keys()
73
74
  self._initialize_loggers()
74
75
  self._initialize_database()
76
+ self._initialize_publisher()
75
77
  self._initialize_foundation()
76
78
 
77
79
  @property
@@ -224,6 +226,13 @@ class ServiceManager:
224
226
  def database(self) -> DatabaseManager:
225
227
  return self._database
226
228
 
229
+ def _initialize_publisher(self) -> None:
230
+ self._publisher = pubsub_v1.PublisherClient()
231
+
232
+ @property
233
+ def publisher(self) -> pubsub_v1.PublisherClient:
234
+ return self._publisher
235
+
227
236
  def _initialize_foundation(self) -> None:
228
237
  self._foundation = MaleoFoundationClientManager(
229
238
  log_config=self._log_config, service_key=self._settings.SERVICE_KEY
@@ -11,6 +11,7 @@ from .cache import CacheConfigurations
11
11
  from .client import ClientConfigurations
12
12
  from .database import DatabaseConfigurations
13
13
  from .middleware import MiddlewareConfigurations
14
+ from .pubsub import PubSubConfigurations
14
15
  from .service import ServiceConfigurations
15
16
 
16
17
 
@@ -25,6 +26,7 @@ class Configurations(BaseModel):
25
26
  middleware: MiddlewareConfigurations = Field(
26
27
  ..., description="Middleware's configurations"
27
28
  )
29
+ pubsub: PubSubConfigurations = Field(..., description="PubSub's configurations")
28
30
  service: ServiceConfigurations = Field(..., description="Service's configurations")
29
31
 
30
32
 
@@ -0,0 +1,15 @@
1
+ from pydantic import BaseModel, ConfigDict, Field
2
+ from maleo_foundation.types import BaseTypes
3
+ from .publisher import PublisherConfigurations
4
+
5
+
6
+ class PubSubConfigurations(BaseModel):
7
+ model_config = ConfigDict(arbitrary_types_allowed=True)
8
+
9
+ publisher: PublisherConfigurations = Field(
10
+ default_factory=PublisherConfigurations,
11
+ description="Publisher's configurations",
12
+ )
13
+ subscriptions: BaseTypes.OptionalListOfStrings = Field(
14
+ None, description="Subscriptions"
15
+ )
@@ -0,0 +1,38 @@
1
+ from pydantic import BaseModel, ConfigDict, Field
2
+ from typing import Optional
3
+
4
+
5
+ class TopicConfigurations(BaseModel):
6
+ id: str = Field(..., description="Topic's id")
7
+
8
+
9
+ DEFAULT_DATABASE_ACCESS_TOPIC_CONFIGURATIONS = TopicConfigurations(id="database-access")
10
+
11
+ DEFAULT_DATABASE_AUDIT_TOPIC_CONFIGURATIONS = TopicConfigurations(id="database-audit")
12
+
13
+ DEFAULT_OPERATION_TOPIC_CONFIGURATIONS = TopicConfigurations(id="operation")
14
+
15
+
16
+ class TopicsConfigurations(BaseModel):
17
+ model_config = ConfigDict(arbitrary_types_allowed=True)
18
+
19
+ database_access: Optional[TopicConfigurations] = Field(
20
+ default=DEFAULT_DATABASE_ACCESS_TOPIC_CONFIGURATIONS,
21
+ description="Database access topic configurations",
22
+ )
23
+ database_audit: Optional[TopicConfigurations] = Field(
24
+ default=DEFAULT_DATABASE_AUDIT_TOPIC_CONFIGURATIONS,
25
+ description="Database audit topic configurations",
26
+ )
27
+ operation: Optional[TopicConfigurations] = Field(
28
+ default=DEFAULT_OPERATION_TOPIC_CONFIGURATIONS,
29
+ description="Operation topic configurations",
30
+ )
31
+
32
+
33
+ class PublisherConfigurations(BaseModel):
34
+ model_config = ConfigDict(arbitrary_types_allowed=True)
35
+
36
+ topics: TopicsConfigurations = Field(
37
+ default_factory=TopicsConfigurations, description="Topics configurations"
38
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.3.65
3
+ Version: 0.3.67
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -36,7 +36,7 @@ maleo_foundation/managers/configuration.py,sha256=Zc397mT3Qn1Q_gDeuDVKl5YA3bSM-o
36
36
  maleo_foundation/managers/credential.py,sha256=um1M45deBEzTVfsUcpAtKEp3Rb_dH1qQrr8abkG_GeU,3057
37
37
  maleo_foundation/managers/db.py,sha256=y0rQIg-vohhFUtck3v1LCdXov7XYjy9PFiCsVtcg8VI,6496
38
38
  maleo_foundation/managers/middleware.py,sha256=Uglwt4X3MauKtBvbPTyHl0-32od3IN6AYYUtiUCoV9I,2464
39
- maleo_foundation/managers/service.py,sha256=YRG1cLc7yGytDXzOe-btKJ5K0YRHJfkgfGF3D5h3ty4,11795
39
+ maleo_foundation/managers/service.py,sha256=ebmKAXC02R4q_ZXXKCGgQm_SLMzLEKOleZZlD-z5N0s,12067
40
40
  maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  maleo_foundation/managers/client/base.py,sha256=iM5xZjLm5VQqqpiYcba-rifW0LgkVd-gRTE6XwdOFqY,4369
42
42
  maleo_foundation/managers/client/maleo.py,sha256=aNh3I9EsxeD2rqx5WaXbZ5fjyyXVzvppHJiC98jJYfM,3163
@@ -71,7 +71,7 @@ maleo_foundation/models/transfers/general/request.py,sha256=W2aKxo0lQ-kV-4XpQEzx
71
71
  maleo_foundation/models/transfers/general/settings.py,sha256=1QkPq6GP33S5R718be3XBz0BCtApAuxlL-x21EZ2Xmo,1609
72
72
  maleo_foundation/models/transfers/general/signature.py,sha256=TCTIy928EeBBeFLlyQ3_NozpR9FUcWXPQKIYIwyj66k,308
73
73
  maleo_foundation/models/transfers/general/token.py,sha256=aF7IXEYS4EnWtWquZexnrXcJBOl5M1lneo7yu7IiKYg,5022
74
- maleo_foundation/models/transfers/general/configurations/__init__.py,sha256=hrhVflh3coOvqGrxMZKkX5XDxYAbxjxnsGwJjJqV86s,1540
74
+ maleo_foundation/models/transfers/general/configurations/__init__.py,sha256=JG910HvVlFvE406Jku0fdOVYUHjedIsflyqCPafXF_Y,1666
75
75
  maleo_foundation/models/transfers/general/configurations/database.py,sha256=4j465vki3bCNGogrJLmMmF1uEXc-sUfyhwMeuaR5JyM,706
76
76
  maleo_foundation/models/transfers/general/configurations/middleware.py,sha256=gBm7yv-PYOPcv-u6SXq8cMWfuuo9LwPSXuqoJ4uw9h0,1761
77
77
  maleo_foundation/models/transfers/general/configurations/service.py,sha256=1sDBwJYvO7tlKz9YH7eIkfMPWmUqRkx7aW-EMw8tpBQ,306
@@ -79,6 +79,8 @@ maleo_foundation/models/transfers/general/configurations/cache/__init__.py,sha25
79
79
  maleo_foundation/models/transfers/general/configurations/cache/redis.py,sha256=SNnI7hm8giKfR2Kp5sD_fmxo4Q5fkRCdi9zMKwTKPCs,1331
80
80
  maleo_foundation/models/transfers/general/configurations/client/__init__.py,sha256=1w17i9CH4bSQ40o8rwIew2F_id25XklFqI1YPowcHvQ,356
81
81
  maleo_foundation/models/transfers/general/configurations/client/maleo.py,sha256=0Hk6no800DdaAlv0SZ1OqVGxbp4LtJz1cJ0ZNbBejK4,2063
82
+ maleo_foundation/models/transfers/general/configurations/pubsub/__init__.py,sha256=BJqB2lxd7iFbm__3VKWPclE6ub_FMIVbhaO7yc2KzSU,505
83
+ maleo_foundation/models/transfers/general/configurations/pubsub/publisher.py,sha256=wNKXZ1DhewlaeaxcjjwOFh_bRxNdkLycGf7bHKEgHFw,1306
82
84
  maleo_foundation/models/transfers/parameters/__init__.py,sha256=HiV7hPn8rUaN7XeOwC_VugYQ4QQO7kbZ0fsp11GDznQ,355
83
85
  maleo_foundation/models/transfers/parameters/client.py,sha256=2V1XvhSmIDDZL7MFVpD_dR5jWIoydQnFW67n9z6rRMA,4041
84
86
  maleo_foundation/models/transfers/parameters/general.py,sha256=NUFsrrfByN9OX9QLYc2Bn0LpNPoxrKBuZae-IVhOiyo,791
@@ -135,7 +137,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=g-cAxkTE2EtHaG8Tv52
135
137
  maleo_foundation/utils/loaders/credential/google.py,sha256=GCJl-bsKSSxoE_ERAkIzRrRNIbIEeqYOhHwzFuBr0mk,6576
136
138
  maleo_foundation/utils/loaders/key/__init__.py,sha256=RfqIbUxkdlx1xrbzJZPD_JHiRFNFLRuQs8JoUPCGCv4,108
137
139
  maleo_foundation/utils/loaders/key/rsa.py,sha256=UXcP0rr4QVacTsHLNQuU05wcow5CHWz-JW-zsVxlbPs,4121
138
- maleo_foundation-0.3.65.dist-info/METADATA,sha256=W0-RwcxXeM2WhaLxIae5xYA6q9GiyhKfXBjA4KmahiM,4150
139
- maleo_foundation-0.3.65.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
140
- maleo_foundation-0.3.65.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
141
- maleo_foundation-0.3.65.dist-info/RECORD,,
140
+ maleo_foundation-0.3.67.dist-info/METADATA,sha256=peuHcWYQ3vASvl2NDm1ouG-g9I-BOpNnx3_9MSV2GOs,4150
141
+ maleo_foundation-0.3.67.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
142
+ maleo_foundation-0.3.67.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
143
+ maleo_foundation-0.3.67.dist-info/RECORD,,