Skip to content

Commit 2b1db11

Browse files
refactor: Move build functionality to utils/docker and metadata models to models directory
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent 7b6dc5d commit 2b1db11

File tree

3 files changed

+450
-0
lines changed

3 files changed

+450
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""Models for connector metadata."""
2+
3+
from __future__ import annotations
4+
5+
from enum import Enum
6+
from typing import Optional
7+
8+
from pydantic import BaseModel, Field
9+
10+
11+
class ConnectorLanguage(str, Enum):
12+
"""Connector implementation language."""
13+
14+
PYTHON = "python"
15+
JAVA = "java"
16+
LOW_CODE = "low-code"
17+
MANIFEST_ONLY = "manifest-only"
18+
UNKNOWN = "unknown"
19+
20+
21+
class ConnectorBuildOptions(BaseModel):
22+
"""Connector build options from metadata.yaml."""
23+
24+
model_config = {"extra": "allow"}
25+
26+
baseImage: Optional[str] = Field(
27+
None, description="Base image to use for building the connector"
28+
)
29+
path: Optional[str] = Field(
30+
None, description="Path to the connector code within the repository"
31+
)
32+
33+
34+
class ConnectorMetadata(BaseModel):
35+
"""Connector metadata from metadata.yaml."""
36+
37+
model_config = {"extra": "allow"}
38+
39+
dockerRepository: str = Field(..., description="Docker repository for the connector image")
40+
dockerImageTag: str = Field(..., description="Docker image tag for the connector")
41+
language: Optional[ConnectorLanguage] = Field(
42+
None, description="Language of the connector implementation"
43+
)
44+
connectorBuildOptions: Optional[ConnectorBuildOptions] = Field(
45+
None, description="Options for building the connector"
46+
)
47+
48+
49+
class MetadataFile(BaseModel):
50+
"""Represents the structure of a metadata.yaml file."""
51+
52+
model_config = {"extra": "allow"}
53+
54+
data: ConnectorMetadata = Field(..., description="Connector metadata")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Docker utilities for Airbyte CDK."""

0 commit comments

Comments
 (0)