Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bmoric/convert connection micronaut #20211

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b42d814
tmp
benmoriceau Nov 23, 2022
5da2868
Fix build
benmoriceau Nov 28, 2022
83c3edc
tmp
benmoriceau Nov 28, 2022
27ccea0
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Nov 28, 2022
e3323ee
Tmp
benmoriceau Nov 29, 2022
648494e
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Nov 30, 2022
9f4fee5
tmp
benmoriceau Dec 1, 2022
2391852
tmp
benmoriceau Dec 1, 2022
453f2fd
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 5, 2022
9032d55
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 5, 2022
212dd86
Tmp
benmoriceau Dec 5, 2022
8fd0939
tmp
benmoriceau Dec 6, 2022
d378aab
tmp
benmoriceau Dec 6, 2022
0ff5a15
Clean up
benmoriceau Dec 6, 2022
8dcef2e
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 7, 2022
4ad415e
tmp
benmoriceau Dec 7, 2022
58d51db
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 7, 2022
c982867
Convert Connection Api Controller
benmoriceau Dec 7, 2022
8de361a
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 7, 2022
fccb967
PR Comments
benmoriceau Dec 8, 2022
e0730b3
convert openapiapicontroller to micronaut (#20258)
colesnodgrass Dec 8, 2022
df5a30e
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 8, 2022
0024dff
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 8, 2022
4d8d7c2
Fix build
benmoriceau Dec 8, 2022
abbf357
Format
benmoriceau Dec 8, 2022
c053aa7
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 9, 2022
7490f23
Remove media type
benmoriceau Dec 9, 2022
556e7d3
Format
benmoriceau Dec 9, 2022
8209043
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 9, 2022
657861c
Merge branch 'bmoric/convert-health-micronaut' of github.com:airbyteh…
benmoriceau Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class AirbyteApiClient {
private final StateApi stateApi;

public AirbyteApiClient(final ApiClient apiClient, final ApiClient micronautApiClient) {
connectionApi = new ConnectionApi(apiClient);
connectionApi = new ConnectionApi(micronautApiClient);
destinationDefinitionApi = new DestinationDefinitionApi(apiClient);
destinationApi = new DestinationApi(apiClient);
destinationSpecificationApi = new DestinationDefinitionSpecificationApi(apiClient);
Expand Down
8 changes: 4 additions & 4 deletions airbyte-proxy/nginx-auth.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ http {
}
}

location /api/v1/health {
location ~ ^/api/v1/(health|openapi) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -38,7 +38,7 @@ http {
}
}

location /api/v1/operations {
location ~ ^/api/v1/(connections|operations)/.* {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down Expand Up @@ -76,7 +76,7 @@ http {
}
}

location /api/v1/health {
location ~ ^/api/v1/(health|openapi) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -93,7 +93,7 @@ http {
}
}

location /api/v1/operations {
location ~ ^/api/v1/(connections|operations)/.* {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
8 changes: 4 additions & 4 deletions airbyte-proxy/nginx-no-auth.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ http {
proxy_pass "${PROXY_PASS_WEB}";
}

location /api/v1/health {
location ~ ^/api/v1/(health|openapi) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass "${PROXY_PASS_MICRONAUT_API}";
}

location /api/v1/operations {
location ~ ^/api/v1/(connections|operations)/.* {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand All @@ -40,15 +40,15 @@ http {
proxy_pass "${PROXY_PASS_API}";
}

location /api/v1/health {
location ~ ^/api/v1/(health|openapi) {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass "${PROXY_PASS_MICRONAUT_API}";
}

location /api/v1/operations {
location ~ ^/api/v1/(connections|operations)/.* {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
1 change: 1 addition & 0 deletions airbyte-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {
implementation 'org.glassfish.jersey.media:jersey-media-json-jackson'
implementation 'org.glassfish.jersey.ext:jersey-bean-validation'
implementation 'org.quartz-scheduler:quartz:2.3.2'
implementation 'io.sentry:sentry:6.3.1'
implementation 'io.swagger:swagger-annotations:1.6.2'

annotationProcessor platform(libs.micronaut.bom)
Expand Down
7 changes: 2 additions & 5 deletions airbyte-server/src/main/java/io/airbyte/server/ServerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.airbyte.analytics.TrackingClient;
import io.airbyte.analytics.TrackingClientSingleton;
import io.airbyte.commons.features.EnvVariableFeatureFlags;
import io.airbyte.commons.features.FeatureFlags;
import io.airbyte.commons.resources.MoreResources;
import io.airbyte.commons.temporal.ConnectionManagerUtils;
import io.airbyte.commons.temporal.StreamResetRecordsHelper;
Expand Down Expand Up @@ -50,7 +51,6 @@
import io.airbyte.server.handlers.JobHistoryHandler;
import io.airbyte.server.handlers.LogsHandler;
import io.airbyte.server.handlers.OAuthHandler;
import io.airbyte.server.handlers.OpenApiConfigHandler;
import io.airbyte.server.handlers.OperationsHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.airbyte.server.handlers.SourceDefinitionsHandler;
Expand Down Expand Up @@ -205,7 +205,7 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
final TrackingClient trackingClient = TrackingClientSingleton.get();
final JobTracker jobTracker = new JobTracker(configRepository, jobPersistence, trackingClient);

final EnvVariableFeatureFlags envVariableFeatureFlags = new EnvVariableFeatureFlags();
final FeatureFlags envVariableFeatureFlags = new EnvVariableFeatureFlags();

final WebUrlHelper webUrlHelper = new WebUrlHelper(configs.getWebappUrl());
final JobErrorReportingClient jobErrorReportingClient = JobErrorReportingClientFactory.getClient(configs.getJobErrorReportingStrategy(), configs);
Expand Down Expand Up @@ -320,8 +320,6 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
destinationHandler,
sourceHandler);

final OpenApiConfigHandler openApiConfigHandler = new OpenApiConfigHandler();

final StatePersistence statePersistence = new StatePersistence(configsDatabase);

final StateHandler stateHandler = new StateHandler(statePersistence);
Expand Down Expand Up @@ -369,7 +367,6 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
jobHistoryHandler,
logsHandler,
oAuthHandler,
openApiConfigHandler,
operationsHandler,
schedulerHandler,
sourceHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.airbyte.config.persistence.SecretsRepositoryWriter;
import io.airbyte.db.Database;
import io.airbyte.persistence.job.JobPersistence;
import io.airbyte.server.apis.ConnectionApiController;
import io.airbyte.server.apis.DestinationApiController;
import io.airbyte.server.apis.DestinationDefinitionApiController;
import io.airbyte.server.apis.DestinationDefinitionSpecificationApiController;
Expand All @@ -31,15 +30,13 @@
import io.airbyte.server.apis.StateApiController;
import io.airbyte.server.apis.WebBackendApiController;
import io.airbyte.server.apis.WorkspaceApiController;
import io.airbyte.server.apis.binders.ConnectionApiBinder;
import io.airbyte.server.apis.binders.DestinationApiBinder;
import io.airbyte.server.apis.binders.DestinationDefinitionApiBinder;
import io.airbyte.server.apis.binders.DestinationDefinitionSpecificationApiBinder;
import io.airbyte.server.apis.binders.DestinationOauthApiBinder;
import io.airbyte.server.apis.binders.JobsApiBinder;
import io.airbyte.server.apis.binders.LogsApiBinder;
import io.airbyte.server.apis.binders.NotificationApiBinder;
import io.airbyte.server.apis.binders.OpenapiApiBinder;
import io.airbyte.server.apis.binders.SchedulerApiBinder;
import io.airbyte.server.apis.binders.SourceApiBinder;
import io.airbyte.server.apis.binders.SourceDefinitionApiBinder;
Expand All @@ -48,15 +45,13 @@
import io.airbyte.server.apis.binders.StateApiBinder;
import io.airbyte.server.apis.binders.WebBackendApiBinder;
import io.airbyte.server.apis.binders.WorkspaceApiBinder;
import io.airbyte.server.apis.factories.ConnectionApiFactory;
import io.airbyte.server.apis.factories.DestinationApiFactory;
import io.airbyte.server.apis.factories.DestinationDefinitionApiFactory;
import io.airbyte.server.apis.factories.DestinationDefinitionSpecificationApiFactory;
import io.airbyte.server.apis.factories.DestinationOauthApiFactory;
import io.airbyte.server.apis.factories.JobsApiFactory;
import io.airbyte.server.apis.factories.LogsApiFactory;
import io.airbyte.server.apis.factories.NotificationsApiFactory;
import io.airbyte.server.apis.factories.OpenapiApiFactory;
import io.airbyte.server.apis.factories.SchedulerApiFactory;
import io.airbyte.server.apis.factories.SourceApiFactory;
import io.airbyte.server.apis.factories.SourceDefinitionApiFactory;
Expand All @@ -73,7 +68,6 @@
import io.airbyte.server.handlers.JobHistoryHandler;
import io.airbyte.server.handlers.LogsHandler;
import io.airbyte.server.handlers.OAuthHandler;
import io.airbyte.server.handlers.OpenApiConfigHandler;
import io.airbyte.server.handlers.OperationsHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.airbyte.server.handlers.SourceDefinitionsHandler;
Expand Down Expand Up @@ -118,7 +112,6 @@ ServerRunnable create(final SynchronousSchedulerClient synchronousSchedulerClien
final JobHistoryHandler jobHistoryHandler,
final LogsHandler logsHandler,
final OAuthHandler oAuthHandler,
final OpenApiConfigHandler openApiConfigHandler,
final OperationsHandler operationsHandler,
final SchedulerHandler schedulerHandler,
final SourceHandler sourceHandler,
Expand Down Expand Up @@ -156,7 +149,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final JobHistoryHandler jobHistoryHandler,
final LogsHandler logsHandler,
final OAuthHandler oAuthHandler,
final OpenApiConfigHandler openApiConfigHandler,
final OperationsHandler operationsHandler,
final SchedulerHandler schedulerHandler,
final SourceHandler sourceHandler,
Expand All @@ -168,12 +160,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final WebBackendCheckUpdatesHandler webBackendCheckUpdatesHandler) {
final Map<String, String> mdc = MDC.getCopyOfContextMap();

ConnectionApiFactory.setValues(
connectionsHandler,
operationsHandler,
schedulerHandler,
mdc);

DestinationApiFactory.setValues(destinationApiHandler, schedulerHandler, mdc);

DestinationDefinitionApiFactory.setValues(destinationDefinitionsHandler);
Expand All @@ -190,8 +176,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul

NotificationsApiFactory.setValues(workspacesHandler);

OpenapiApiFactory.setValues(openApiConfigHandler);

SchedulerApiFactory.setValues(schedulerHandler);

SourceApiFactory.setValues(schedulerHandler, sourceHandler);
Expand All @@ -206,9 +190,8 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul

WorkspaceApiFactory.setValues(workspacesHandler);

// server configurations
// server configuration
final Set<Class<?>> componentClasses = Set.of(
ConnectionApiController.class,
DestinationApiController.class,
DestinationDefinitionApiController.class,
DestinationDefinitionSpecificationApiController.class,
Expand All @@ -228,16 +211,13 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
WorkspaceApiController.class);

final Set<Object> components = Set.of(
new CorsFilter(),
new ConnectionApiBinder(),
new DestinationApiBinder(),
new DestinationDefinitionApiBinder(),
new DestinationDefinitionSpecificationApiBinder(),
new DestinationOauthApiBinder(),
new JobsApiBinder(),
new LogsApiBinder(),
new NotificationApiBinder(),
new OpenapiApiBinder(),
new SchedulerApiBinder(),
new SourceApiBinder(),
new SourceDefinitionApiBinder(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
import io.airbyte.server.handlers.ConnectionsHandler;
import io.airbyte.server.handlers.OperationsHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import javax.ws.rs.Path;
import io.micronaut.context.annotation.Context;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Path("/v1/connections")
@Controller("/api/v1/connections")
@Context()
public class ConnectionApiController implements ConnectionApi {

private final ConnectionsHandler connectionsHandler;
Expand All @@ -34,37 +38,44 @@ public ConnectionApiController(final ConnectionsHandler connectionsHandler,
}

@Override
public ConnectionRead createConnection(final ConnectionCreate connectionCreate) {
@Post(uri = "/create")
public ConnectionRead createConnection(@Body final ConnectionCreate connectionCreate) {
return ApiHelper.execute(() -> connectionsHandler.createConnection(connectionCreate));
}

@Override
public ConnectionRead updateConnection(final ConnectionUpdate connectionUpdate) {
@Post(uri = "/update")
public ConnectionRead updateConnection(@Body final ConnectionUpdate connectionUpdate) {
return ApiHelper.execute(() -> connectionsHandler.updateConnection(connectionUpdate));
}

@Override
public ConnectionReadList listConnectionsForWorkspace(final WorkspaceIdRequestBody workspaceIdRequestBody) {
@Post(uri = "/list")
public ConnectionReadList listConnectionsForWorkspace(@Body final WorkspaceIdRequestBody workspaceIdRequestBody) {
return ApiHelper.execute(() -> connectionsHandler.listConnectionsForWorkspace(workspaceIdRequestBody));
}

@Override
public ConnectionReadList listAllConnectionsForWorkspace(final WorkspaceIdRequestBody workspaceIdRequestBody) {
@Post(uri = "/list_all")
public ConnectionReadList listAllConnectionsForWorkspace(@Body final WorkspaceIdRequestBody workspaceIdRequestBody) {
return ApiHelper.execute(() -> connectionsHandler.listAllConnectionsForWorkspace(workspaceIdRequestBody));
}

@Override
public ConnectionReadList searchConnections(final ConnectionSearch connectionSearch) {
@Post(uri = "/search")
public ConnectionReadList searchConnections(@Body final ConnectionSearch connectionSearch) {
return ApiHelper.execute(() -> connectionsHandler.searchConnections(connectionSearch));
}

@Override
public ConnectionRead getConnection(final ConnectionIdRequestBody connectionIdRequestBody) {
@Post(uri = "/get")
public ConnectionRead getConnection(@Body final ConnectionIdRequestBody connectionIdRequestBody) {
return ApiHelper.execute(() -> connectionsHandler.getConnection(connectionIdRequestBody.getConnectionId()));
}

@Override
public void deleteConnection(final ConnectionIdRequestBody connectionIdRequestBody) {
@Post(uri = "/delete")
public void deleteConnection(@Body final ConnectionIdRequestBody connectionIdRequestBody) {
ApiHelper.execute(() -> {
operationsHandler.deleteOperationsForConnection(connectionIdRequestBody);
connectionsHandler.deleteConnection(connectionIdRequestBody.getConnectionId());
Expand All @@ -73,12 +84,14 @@ public void deleteConnection(final ConnectionIdRequestBody connectionIdRequestBo
}

@Override
public JobInfoRead syncConnection(final ConnectionIdRequestBody connectionIdRequestBody) {
@Post(uri = "/sync")
public JobInfoRead syncConnection(@Body final ConnectionIdRequestBody connectionIdRequestBody) {
return ApiHelper.execute(() -> schedulerHandler.syncConnection(connectionIdRequestBody));
}

@Override
public JobInfoRead resetConnection(final ConnectionIdRequestBody connectionIdRequestBody) {
@Post(uri = "/reset")
public JobInfoRead resetConnection(@Body final ConnectionIdRequestBody connectionIdRequestBody) {
return ApiHelper.execute(() -> schedulerHandler.resetConnection(connectionIdRequestBody));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@

import io.airbyte.api.generated.OpenapiApi;
import io.airbyte.server.handlers.OpenApiConfigHandler;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import java.io.File;
import javax.ws.rs.Path;
import lombok.AllArgsConstructor;

@Path("/v1/openapi")
@AllArgsConstructor
@Controller("/api/v1/openapi")
public class OpenapiApiController implements OpenapiApi {

private final OpenApiConfigHandler openApiConfigHandler;

public OpenapiApiController(final OpenApiConfigHandler openApiConfigHandler) {
this.openApiConfigHandler = openApiConfigHandler;
}

@Get(produces = "text/plain")
@Override
public File getOpenApiSpec() {
return ApiHelper.execute(openApiConfigHandler::getFile);
Expand Down

This file was deleted.

This file was deleted.

Loading