forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce airbyte-api-server skeleton (#7846)
- Loading branch information
1 parent
8f2e4f9
commit da55f17
Showing
34 changed files
with
2,757 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG JDK_IMAGE=airbyte/airbyte-base-java-image:2.0.3 | ||
FROM ${JDK_IMAGE} AS server | ||
EXPOSE 8006 5005 | ||
ENV APPLICATION airbyte-api-server | ||
ENV VERSION ${VERSION} | ||
WORKDIR /app | ||
|
||
# This is automatically unzipped by Docker | ||
ADD airbyte-app.tar /app | ||
|
||
# wait for upstream dependencies to become available before starting server | ||
ENTRYPOINT ["/bin/bash", "-c", "airbyte-app/bin/${APPLICATION}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
plugins { | ||
id "io.airbyte.gradle.jvm.app" | ||
id "io.airbyte.gradle.jvm.lib" | ||
id "io.airbyte.gradle.publish" | ||
id "org.jetbrains.kotlin.jvm" | ||
id "org.jetbrains.kotlin.kapt" | ||
id "io.airbyte.gradle.docker" | ||
} | ||
|
||
dependencies { | ||
kapt(platform(libs.micronaut.bom)) | ||
kapt(libs.bundles.micronaut.annotation.processor) | ||
|
||
kaptTest(platform(libs.micronaut.bom)) | ||
kaptTest(libs.bundles.micronaut.test.annotation.processor) | ||
|
||
annotationProcessor platform(libs.micronaut.bom) | ||
annotationProcessor libs.bundles.micronaut.annotation.processor | ||
annotationProcessor libs.micronaut.jaxrs.processor | ||
|
||
implementation project(':airbyte-api') | ||
|
||
implementation platform(libs.micronaut.bom) | ||
implementation libs.bundles.micronaut | ||
implementation libs.bundles.micronaut.data.jdbc | ||
implementation libs.micronaut.jaxrs.server | ||
implementation libs.micronaut.security | ||
|
||
implementation libs.sentry.java | ||
implementation libs.swagger.annotations | ||
implementation libs.javax.ws.rs.api | ||
|
||
runtimeOnly libs.javax.databind | ||
|
||
testImplementation libs.bundles.micronaut.test | ||
testAnnotationProcessor platform(libs.micronaut.bom) | ||
testAnnotationProcessor libs.bundles.micronaut.test.annotation.processor | ||
|
||
testImplementation project(':airbyte-test-utils') | ||
testImplementation libs.bundles.micronaut.test | ||
testImplementation libs.postgresql | ||
testImplementation libs.platform.testcontainers.postgresql | ||
testImplementation libs.mockwebserver | ||
testImplementation libs.mockito.inline | ||
} | ||
|
||
Properties env = new Properties() | ||
rootProject.file('.env.dev').withInputStream { env.load(it) } | ||
|
||
airbyte { | ||
application { | ||
mainClass = 'io.airbyte.api.server.ApplicationKt' | ||
defaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0'] | ||
localEnvVars = env + [ | ||
"AIRBYTE_ROLE" : System.getenv("AIRBYTE_ROLE") ?: "undefined", | ||
"AIRBYTE_VERSION" : env.VERSION, | ||
"MICRONAUT_ENVIRONMENTS": "control-plane", | ||
"SERVICE_NAME" : project.name, | ||
"TRACKING_STRATEGY" : env.TRACKING_STRATEGY | ||
] as Map<String, String> | ||
} | ||
docker { | ||
imageName = "airbyte-api-server" | ||
} | ||
} | ||
|
||
test { | ||
environment 'AIRBYTE_VERSION', env.VERSION | ||
environment 'MICRONAUT_ENVIRONMENTS', 'test' | ||
environment 'SERVICE_NAME', project.name | ||
} |
7 changes: 7 additions & 0 deletions
7
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/Application.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.airbyte.api.server | ||
|
||
import io.micronaut.runtime.Micronaut.run | ||
|
||
fun main(args: Array<String>) { | ||
run(*args) | ||
} |
37 changes: 37 additions & 0 deletions
37
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/ConnectionsController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.airbyte.airbyte_api.generated.ConnectionsApi | ||
import io.airbyte.airbyte_api.model.generated.ConnectionCreateRequest | ||
import io.airbyte.airbyte_api.model.generated.ConnectionPatchRequest | ||
import io.airbyte.api.server.services.ConnectionService | ||
import io.micronaut.http.annotation.Controller | ||
import java.util.UUID | ||
import javax.ws.rs.core.Response | ||
|
||
@Controller("/v1/connections") | ||
open class ConnectionsController(connectionService: ConnectionService) : ConnectionsApi { | ||
override fun createConnection(connectionCreateRequest: ConnectionCreateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun deleteConnection(connectionId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getConnection(connectionId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun listConnections( | ||
workspaceIds: MutableList<UUID>?, | ||
includeDeleted: Boolean?, | ||
limit: Int?, | ||
offset: Int?, | ||
): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun patchConnection(connectionId: UUID?, connectionPatchRequest: ConnectionPatchRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/Destinations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.airbyte.airbyte_api.generated.DestinationsApi | ||
import io.airbyte.airbyte_api.model.generated.DestinationCreateRequest | ||
import io.airbyte.airbyte_api.model.generated.DestinationPatchRequest | ||
import io.airbyte.airbyte_api.model.generated.DestinationPutRequest | ||
import io.airbyte.api.server.services.DestinationService | ||
import io.micronaut.http.annotation.Controller | ||
import java.util.UUID | ||
import javax.ws.rs.core.Response | ||
|
||
@Controller("/v1/destinations") | ||
open class Destinations(private var destinationService: DestinationService) : DestinationsApi { | ||
override fun createDestination(destinationCreateRequest: DestinationCreateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun deleteDestination(destinationId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getDestination(destinationId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun listDestinations(workspaceIds: MutableList<UUID>?, includeDeleted: Boolean?, limit: Int?, offset: Int?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun patchDestination(destinationId: UUID?, destinationPatchRequest: DestinationPatchRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun putDestination(destinationId: UUID?, destinationPutRequest: DestinationPutRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/Health.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.micronaut.http.HttpResponse | ||
import io.micronaut.http.annotation.Controller | ||
import io.swagger.annotations.ApiResponse | ||
import io.swagger.annotations.ApiResponses | ||
import javax.ws.rs.GET | ||
|
||
/** | ||
* Health endpoint used by kubernetes and the gcp load balancer. | ||
*/ | ||
@Controller("/health") | ||
class Health { | ||
@GET | ||
@ApiResponses( | ||
value = [ | ||
ApiResponse(code = 200, message = "Successful operation"), ApiResponse( | ||
code = 403, | ||
message = "The request is not authorized; see message for details.", | ||
), | ||
], | ||
) | ||
fun healthCheck(): HttpResponse<String> { | ||
return HttpResponse.ok<String?>().body("Successful operation") | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/Jobs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.airbyte.airbyte_api.generated.JobsApi | ||
import io.airbyte.airbyte_api.model.generated.JobCreateRequest | ||
import io.airbyte.airbyte_api.model.generated.JobTypeEnum | ||
import io.airbyte.api.server.services.JobService | ||
import io.micronaut.http.annotation.Controller | ||
import java.util.UUID | ||
import javax.ws.rs.core.Response | ||
|
||
@Controller("/v1/jobs") | ||
open class Jobs(private var jobService: JobService) : JobsApi { | ||
override fun cancelJob(jobId: Long?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun createJob(jobCreateRequest: JobCreateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getJob(jobId: Long?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun listJobs(connectionId: UUID?, limit: Int?, offset: Int?, jobType: JobTypeEnum?, workspaceIds: MutableList<UUID>?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/Sources.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.airbyte.airbyte_api.generated.SourcesApi | ||
import io.airbyte.airbyte_api.model.generated.InitiateOauthRequest | ||
import io.airbyte.airbyte_api.model.generated.SourceCreateRequest | ||
import io.airbyte.airbyte_api.model.generated.SourcePatchRequest | ||
import io.airbyte.airbyte_api.model.generated.SourcePutRequest | ||
import io.airbyte.api.server.services.SourceService | ||
import io.micronaut.http.annotation.Controller | ||
import java.util.UUID | ||
import javax.ws.rs.core.Response | ||
|
||
@Controller("/v1/sources") | ||
class Sources(sourceService: SourceService) : SourcesApi { | ||
override fun createSource(sourceCreateRequest: SourceCreateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun deleteSource(sourceId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getSource(sourceId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun initiateOAuth(initiateOauthRequest: InitiateOauthRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun listSources(workspaceIds: MutableList<UUID>?, includeDeleted: Boolean?, limit: Int?, offset: Int?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun patchSource(sourceId: UUID?, sourcePatchRequest: SourcePatchRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun putSource(sourceId: UUID?, sourcePutRequest: SourcePutRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/routes/Workspaces.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.airbyte.api.server.routes | ||
|
||
import io.airbyte.airbyte_api.generated.WorkspacesApi | ||
import io.airbyte.airbyte_api.model.generated.WorkspaceCreateRequest | ||
import io.airbyte.airbyte_api.model.generated.WorkspaceOAuthCredentialsRequest | ||
import io.airbyte.airbyte_api.model.generated.WorkspaceUpdateRequest | ||
import io.airbyte.api.server.services.WorkspaceService | ||
import io.micronaut.http.annotation.Controller | ||
import java.util.UUID | ||
import javax.ws.rs.core.Response | ||
|
||
@Controller("/v1/workspaces") | ||
class Workspaces(workspaceService: WorkspaceService) : WorkspacesApi { | ||
override fun createOrUpdateWorkspaceOAuthCredentials( | ||
workspaceId: UUID?, | ||
workspaceOAuthCredentialsRequest: WorkspaceOAuthCredentialsRequest?, | ||
): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun createWorkspace(workspaceCreateRequest: WorkspaceCreateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun deleteWorkspace(workspaceId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getWorkspace(workspaceId: UUID?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun listWorkspaces(workspaceIds: MutableList<UUID>?, includeDeleted: Boolean?, limit: Int?, offset: Int?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun updateWorkspace(workspaceId: UUID?, workspaceUpdateRequest: WorkspaceUpdateRequest?): Response { | ||
TODO("Not yet implemented") | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
airbyte-api-server/src/main/kotlin/io/airbyte/api/server/services/ConnectionService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.airbyte.api.server.services | ||
|
||
import io.airbyte.airbyte_api.model.generated.ConnectionResponse | ||
import io.airbyte.airbyte_api.model.generated.ConnectionsResponse | ||
import io.airbyte.api.model.generated.ConnectionCreate | ||
import io.airbyte.api.model.generated.ConnectionUpdate | ||
import java.util.Collections | ||
import java.util.UUID | ||
|
||
interface ConnectionService { | ||
fun createConnection( | ||
connectionCreate: ConnectionCreate, | ||
endpointUserInfo: String, | ||
): ConnectionResponse | ||
|
||
fun deleteConnection( | ||
connectionId: UUID, | ||
endpointUserInfo: String, | ||
): ConnectionResponse | ||
|
||
fun getConnection( | ||
connectionId: UUID, | ||
endpointUserInfo: String, | ||
): ConnectionResponse | ||
|
||
fun updateConnection( | ||
connectionUpdate: ConnectionUpdate, | ||
endpointUserInfo: String, | ||
): ConnectionResponse | ||
|
||
fun listConnectionsForWorkspaces( | ||
workspaceIds: MutableList<UUID> = Collections.emptyList(), | ||
limit: Int = 20, | ||
offset: Int = 0, | ||
includeDeleted: Boolean = false, | ||
endpointUserInfo: String, | ||
): ConnectionsResponse | ||
} |
Oops, something went wrong.