Skip to content

Commit

Permalink
remove future features
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Dec 16, 2024
1 parent 4002a73 commit de6219b
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions airbyte/_util/api_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,102 +861,3 @@ def check_connector(
"response": json_result,
},
)


@dataclass
class DockerImageOverride:
"""Defines a connector image override."""

docker_image_override: str
override_level: Literal["workspace", "actor"] = "actor"


def get_connector_image_override(
*,
workspace_id: str,
actor_id: str,
actor_type: Literal["source", "destination"],
api_root: str = CLOUD_API_ROOT,
client_id: SecretString,
client_secret: SecretString,
) -> DockerImageOverride | None:
"""Get the docker image and tag for a specific connector.
Result is a tuple of two values:
- A boolean indicating if an override is set.
- The docker image and tag, either from the override if set, or from the .
https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L5066
"""
json_result = _make_config_api_request(
path="/scoped_configuration/list",
json={
"config_key": "docker_image", # TODO: Fix this.
},
api_root=api_root,
client_id=client_id,
client_secret=client_secret,
)
try:
scoped_configurations = json_result["scopedConfigurations"]
except KeyError as ex:
raise AirbyteError(
message="Could not find 'scoped_configurations' in response.",
context={
"workspace_id": workspace_id,
"actor_id": actor_id,
"actor_type": actor_type,
"response_keys": list(json_result.keys()),
},
) from ex
overrides = [
DockerImageOverride(
docker_image_override=entry["value"],
override_level=entry["scope_type"],
)
for entry in scoped_configurations
]
if len(overrides) == 0:
return None

if len(overrides) > 1:
raise NotImplementedError(
"Multiple overrides found. This is not yet supported.",
)

return overrides[0]


def set_actor_override(
*,
workspace_id: str,
actor_id: str,
actor_type: Literal["source", "destination"],
override: DockerImageOverride,
api_root: str = CLOUD_API_ROOT,
client_id: SecretString,
client_secret: SecretString,
) -> None:
"""Override the docker image and tag for a specific connector.
https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L5111
"""
_ = workspace_id
json_result = _make_config_api_request(
path="/v1/scoped_configuration/create",
json={
# https://github.com/airbytehq/airbyte-platform-internal/blob/10bb92e1745a282e785eedfcbed1ba72654c4e4e/oss/airbyte-api/server-api/src/main/openapi/config.yaml#L7376
"value": override.docker_image_override,
"config_key": "docker_image", # TODO: Fix this.
"scope_id": actor_id,
"scope_type": actor_type,
"resource_id": "", # TODO: Need to call something like get_actor_definition
"resource_type": "ACTOR_DEFINITION",
"origin": "", # TODO: Need to get user ID somehow or use another origin type
"origin_type": "USER",
},
api_root=api_root,
client_id=client_id,
client_secret=client_secret,
)
_ = json_result # Not used (yet)

0 comments on commit de6219b

Please sign in to comment.