Skip to content

Commit

Permalink
[LITE-30645] - TierConfig requests and Fulfillment requests are added…
Browse files Browse the repository at this point in the history
… to the sync
  • Loading branch information
Sainomori committed Jul 24, 2024
1 parent 29f49ce commit e7bdd52
Show file tree
Hide file tree
Showing 24 changed files with 1,169 additions and 561 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# EaaS: Xvantage Data Lake Extension changelog

* 1.0.0: initial version
* 0.1.0: initial version
* ...
* 0.2.16: Added TierConfigRequest and FulfillmentRequest synchronization
15 changes: 6 additions & 9 deletions connect_ext_datalake/apis/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
from fastapi import Depends
from fastapi.responses import HTMLResponse

from connect_ext_datalake.schemas import (
Product,
ProductInput,
)
from connect_ext_datalake.schemas import Product, ProductInput
from connect_ext_datalake.services.publish import list_products
from connect_ext_datalake.services.tasks import create_task_publish_product

Expand Down Expand Up @@ -68,11 +65,11 @@ def publish_product_info(
summary='Publish All Products Info',
)
def publish_all_product_info(
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
):
try:
create_task_publish_product(
Expand Down
31 changes: 12 additions & 19 deletions connect_ext_datalake/apis/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,11 @@
from connect.client import ConnectClient
from connect.eaas.core.decorators import router
from connect.eaas.core.inject.common import get_logger
from connect.eaas.core.inject.synchronous import (
get_installation,
get_installation_client,
)
from connect.eaas.core.inject.synchronous import get_installation, get_installation_client
from fastapi import Depends

from connect_ext_datalake.schemas import Hub, Setting, SettingInput
from connect_ext_datalake.services.client import GooglePubsubClient
from connect_ext_datalake.schemas import (
Hub,
Setting,
SettingInput,
)
from connect_ext_datalake.services.publish import list_hubs
from connect_ext_datalake.services.settings import (
delete_settings,
Expand Down Expand Up @@ -48,9 +41,9 @@ def retrieve_settings(
response_model=Setting,
)
def validate_settings(
self,
hub_id: str,
installation: dict = Depends(get_installation),
self,
hub_id: str,
installation: dict = Depends(get_installation),
):
try:
settings = get_settings(installation, hub_id)
Expand Down Expand Up @@ -94,11 +87,11 @@ def save_settings(
summary='Clear Datalake Pubsub Settings',
)
def remove_settings(
self,
hub_id: str,
installation: dict = Depends(get_installation),
client: ConnectClient = Depends(get_installation_client),
logger: LoggerAdapter = Depends(get_logger),
self,
hub_id: str,
installation: dict = Depends(get_installation),
client: ConnectClient = Depends(get_installation_client),
logger: LoggerAdapter = Depends(get_logger),
):
try:
delete_settings(
Expand All @@ -116,7 +109,7 @@ def remove_settings(
response_model=list[Hub],
)
def list_hubs(
self,
client: ConnectClient = Depends(get_installation_client),
self,
client: ConnectClient = Depends(get_installation_client),
):
return list_hubs(client)
30 changes: 16 additions & 14 deletions connect_ext_datalake/apis/tier_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
from logging import LoggerAdapter

from connect.client import ConnectClient
from connect.client import ConnectClient, R
from connect.client.exceptions import ClientError
from connect.eaas.core.decorators import router
from connect.eaas.core.inject.common import get_call_context, get_logger
Expand All @@ -20,8 +20,8 @@

from connect_ext_datalake.services.client import GooglePubsubClient
from connect_ext_datalake.services.publish import publish_tc
from connect_ext_datalake.services.tasks import create_task_publish_tc
from connect_ext_datalake.services.settings import get_settings
from connect_ext_datalake.services.tasks import create_task_publish_tc


class TierConfigsWebAppMixin:
Expand All @@ -31,11 +31,11 @@ class TierConfigsWebAppMixin:
summary='Publish All Tier Configs Info',
)
def publish_all_tc_info(
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
):
try:
create_task_publish_tc(
Expand All @@ -53,11 +53,11 @@ def publish_all_tc_info(
summary='Publish All Tier Configs Info',
)
def publish_tc_info(
self,
tc_id: str,
client: ConnectClient = Depends(get_installation_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
self,
tc_id: str,
client: ConnectClient = Depends(get_installation_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
):
try:
tc = client('tier').configs[tc_id].get()
Expand All @@ -72,8 +72,10 @@ def publish_tc_info(
logger,
)
else:
logger.info(f"Publish of TC {tc['id']} is not processed"
f' as settings not available for respective hub.')
logger.info(
f"Publish of TC {tc['id']} is not processed"
f' as settings not available for respective hub.'
)
return HTMLResponse(status_code=200)
except ClientError as e:
return self.get_error_response(e)
15 changes: 6 additions & 9 deletions connect_ext_datalake/apis/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
from connect.eaas.core.decorators import router
from connect.eaas.core.inject.common import get_call_context, get_logger
from connect.eaas.core.inject.models import Context
from connect.eaas.core.inject.synchronous import (
get_extension_client,
get_installation,
)
from connect.eaas.core.inject.synchronous import get_extension_client, get_installation
from fastapi import Depends
from fastapi.responses import HTMLResponse

Expand All @@ -21,11 +18,11 @@ class TranslationWebAppMixin:
summary='Publish All Product Translations Info',
)
def publish_all_product_translations(
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
self,
context: Context = Depends(get_call_context),
client: ConnectClient = Depends(get_extension_client),
installation: dict = Depends(get_installation),
logger: LoggerAdapter = Depends(get_logger),
):
try:
create_task_publish_translation(
Expand Down
9 changes: 5 additions & 4 deletions connect_ext_datalake/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#
from connect.eaas.core.extension import EventsApplicationBase

from connect_ext_datalake.services.events.product import (
ProductEventsMixin,
ProductTasksMixin,
)
from connect_ext_datalake.services.events import (
FulfillmentEventsMixin,
FulfillmentTasksMixin,
TierConfigEventsMixin,
TierConfigTasksMixin,
TranslationEventsMixin,
TranslationTaskMixin,
)
from connect_ext_datalake.services.events.product import ProductEventsMixin, ProductTasksMixin


class DatalakeExtensionEventsApplication(
Expand All @@ -25,5 +24,7 @@ class DatalakeExtensionEventsApplication(
TierConfigTasksMixin,
TranslationEventsMixin,
TranslationTaskMixin,
FulfillmentEventsMixin,
FulfillmentTasksMixin,
):
pass
4 changes: 4 additions & 0 deletions connect_ext_datalake/services/events/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from connect_ext_datalake.services.events.fulfillment import (
FulfillmentEventsMixin,
FulfillmentTasksMixin,
)
from connect_ext_datalake.services.events.tier_config import ( # noqa
TierConfigEventsMixin,
TierConfigTasksMixin,
Expand Down
Loading

0 comments on commit e7bdd52

Please sign in to comment.