Skip to content

Commit

Permalink
DRY, sort Dynatrace
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 committed Apr 17, 2024
1 parent 1cad563 commit fe4eeec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
9 changes: 3 additions & 6 deletions api/api/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
from drf_yasg.openapi import Schema
from flag_engine.environments.models import EnvironmentModel

from environments.constants import IDENTITY_INTEGRATIONS_RELATION_NAMES

SKIP_PROPERTIES = [
"amplitude_config",
*IDENTITY_INTEGRATIONS_RELATION_NAMES,
"dynatrace_config",
"heap_config",
"mixpanel_config",
"rudderstack_config",
"segment_config",
"webhook_config",
]
SKIP_DEFINITIONS = ["IntegrationModel", "WebhookModel"]

Expand Down
4 changes: 0 additions & 4 deletions api/util/mappers/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,6 @@ def map_environment_to_engine(
amplitude_config_model = map_integration_to_engine(
integration_configs.pop("amplitude_config", None),
)
dynatrace_config_model = map_integration_to_engine(
integration_configs.pop("dynatrace_config", None),
)
heap_config_model = map_integration_to_engine(
integration_configs.pop("heap_config", None),
)
Expand Down Expand Up @@ -332,7 +329,6 @@ def map_environment_to_engine(
#
# Integrations:
amplitude_config=amplitude_config_model,
dynatrace_config=dynatrace_config_model,
heap_config=heap_config_model,
mixpanel_config=mixpanel_config_model,
rudderstack_config=rudderstack_config_model,
Expand Down
13 changes: 2 additions & 11 deletions api/util/mappers/sdk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import TYPE_CHECKING, TypeAlias

from environments.constants import IDENTITY_INTEGRATIONS_RELATION_NAMES
from util.mappers.engine import (
map_environment_to_engine,
map_identity_to_engine,
Expand All @@ -9,16 +10,6 @@
from environments.identities.models import Identity
from environments.models import Environment

ENVIRONMENT_RESPONSE_EXCLUDE_FIELDS = [
"amplitude_config",
"dynatrace_config",
"heap_config",
"mixpanel_config",
"rudderstack_config",
"segment_config",
"webhook_config",
]


SDKDocumentValue: TypeAlias = dict[str, "SDKDocumentValue"] | str | bool | None | float
SDKDocument: TypeAlias = dict[str, SDKDocumentValue]
Expand Down Expand Up @@ -47,5 +38,5 @@ def map_environment_to_sdk_document(
]

return engine_environment.model_dump(
exclude=ENVIRONMENT_RESPONSE_EXCLUDE_FIELDS,
exclude=IDENTITY_INTEGRATIONS_RELATION_NAMES,
)

0 comments on commit fe4eeec

Please sign in to comment.