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/extract notification api #18812

Merged
merged 54 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4ebf4ec
Tmp
benmoriceau Oct 21, 2022
6d8e907
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/con…
benmoriceau Oct 24, 2022
d930c98
Extract the Attempt API from the V1 API
benmoriceau Oct 24, 2022
2dba567
Add comments
benmoriceau Oct 24, 2022
7c36975
Move Connection API out of configuration API
benmoriceau Oct 24, 2022
0d87509
format
benmoriceau Oct 24, 2022
cf61847
Merge branch 'bmoric/convert-server-to-micronaut' of github.com:airby…
benmoriceau Oct 24, 2022
04e9bb2
format
benmoriceau Oct 24, 2022
c74db48
Rename to Controller
benmoriceau Oct 25, 2022
433dfe5
Merge branch 'bmoric/convert-server-to-micronaut' of github.com:airby…
benmoriceau Oct 25, 2022
415e0c7
Rename to Controller
benmoriceau Oct 25, 2022
7211da6
Add values to the factory
benmoriceau Oct 25, 2022
f503b4c
Change the constructor to use hadler instead of objects needed by the…
benmoriceau Oct 25, 2022
70ce157
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Oct 25, 2022
688f812
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Oct 25, 2022
2103e7d
Update with new tags.
benmoriceau Oct 25, 2022
a5c8522
tmp
benmoriceau Oct 25, 2022
c5aee8f
Fix PMD errors
benmoriceau Oct 25, 2022
50fc3ae
Extract DB migrator
benmoriceau Oct 25, 2022
6b11154
Merge branch 'bmoric/extract-connection-api' of github.com:airbytehq/…
benmoriceau Oct 25, 2022
4e8051e
Add something that I forgot
benmoriceau Oct 26, 2022
99d9d4b
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Oct 26, 2022
aca18c9
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Oct 26, 2022
7254ebb
extract destination definition api
benmoriceau Oct 26, 2022
4d748af
restore destination factory initialization
benmoriceau Oct 26, 2022
e6a56a2
extract destination definition specification api
benmoriceau Oct 26, 2022
709cdc4
format
benmoriceau Oct 26, 2022
aa06c20
Merge branch 'bmoric/extract-db-migration-api' of github.com:airbyteh…
benmoriceau Oct 26, 2022
82360dc
format
benmoriceau Oct 26, 2022
82ccd82
Merge branch 'bmoric/extract-destination-definition-api' of github.co…
benmoriceau Oct 26, 2022
6ecdb17
format
benmoriceau Oct 26, 2022
187c9ea
extract health check api
benmoriceau Oct 26, 2022
f6a5e9b
extract jobs api
benmoriceau Oct 26, 2022
8023bc9
fix test
benmoriceau Oct 27, 2022
bd206a9
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Oct 27, 2022
293c187
format
benmoriceau Oct 27, 2022
89308f5
Merge branch 'master' into bmoric/extract-healt-api
benmoriceau Oct 28, 2022
60fa570
Merge branch 'bmoric/extract-healt-api' of github.com:airbytehq/airby…
benmoriceau Oct 28, 2022
7accc25
Extract logs api
benmoriceau Oct 28, 2022
5151909
Add missing declaration
benmoriceau Oct 28, 2022
0eb77e1
Merge branch 'bmoric/extract-jobs-api' of github.com:airbytehq/airbyt…
benmoriceau Oct 28, 2022
ffb770b
Fix build
benmoriceau Oct 28, 2022
c3cd08e
Merge branch 'master' into bmoric/extract-healt-api
benmoriceau Oct 28, 2022
c65a79b
Merge branch 'bmoric/extract-healt-api' into bmoric/extract-jobs-api
benmoriceau Oct 28, 2022
2142e26
Tmp
benmoriceau Oct 28, 2022
3ed2fee
format and PR comments
benmoriceau Oct 28, 2022
cef5c58
Merge branch 'bmoric/extract-jobs-api' of github.com:airbytehq/airbyt…
benmoriceau Oct 28, 2022
bfaf6b5
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Nov 1, 2022
9b00d89
Extract notification API
benmoriceau Nov 1, 2022
8d07282
Merge branch 'bmoric/extract-jobs-api' of github.com:airbytehq/airbyt…
benmoriceau Nov 1, 2022
4b2361d
Merge branch 'bmoric/extract-logs-api' of github.com:airbytehq/airbyt…
benmoriceau Nov 1, 2022
fa4761d
Fix PMD
benmoriceau Nov 2, 2022
c41a1f9
Merge branch 'bmoric/extract-logs-api' of github.com:airbytehq/airbyt…
benmoriceau Nov 2, 2022
ca56b4a
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/ext…
benmoriceau Nov 2, 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
11 changes: 10 additions & 1 deletion airbyte-server/src/main/java/io/airbyte/server/ServerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import io.airbyte.server.handlers.SchedulerHandler;
import io.airbyte.server.handlers.SourceDefinitionsHandler;
import io.airbyte.server.handlers.SourceHandler;
import io.airbyte.server.handlers.WorkspacesHandler;
import io.airbyte.server.scheduler.DefaultSynchronousSchedulerClient;
import io.airbyte.server.scheduler.EventRunner;
import io.airbyte.server.scheduler.TemporalEventRunner;
Expand Down Expand Up @@ -321,6 +322,13 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,

final LogsHandler logsHandler = new LogsHandler(configs);

final WorkspacesHandler workspacesHandler = new WorkspacesHandler(
configRepository,
secretsRepositoryWriter,
connectionsHandler,
destinationHandler,
sourceHandler);

LOGGER.info("Starting server...");

return apiFactory.create(
Expand Down Expand Up @@ -349,7 +357,8 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
jobHistoryHandler,
logsHandler,
operationsHandler,
schedulerHandler);
schedulerHandler,
workspacesHandler);
}

@VisibleForTesting
Expand Down
18 changes: 14 additions & 4 deletions airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.airbyte.server.apis.HealthApiController;
import io.airbyte.server.apis.JobsApiController;
import io.airbyte.server.apis.LogsApiController;
import io.airbyte.server.apis.NotificationsApiController;
import io.airbyte.server.apis.binders.AttemptApiBinder;
import io.airbyte.server.apis.binders.ConnectionApiBinder;
import io.airbyte.server.apis.binders.DbMigrationBinder;
Expand All @@ -33,6 +34,7 @@
import io.airbyte.server.apis.binders.HealthApiBinder;
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.factories.AttemptApiFactory;
import io.airbyte.server.apis.factories.ConnectionApiFactory;
import io.airbyte.server.apis.factories.DbMigrationApiFactory;
Expand All @@ -42,6 +44,7 @@
import io.airbyte.server.apis.factories.HealthApiFactory;
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.handlers.AttemptHandler;
import io.airbyte.server.handlers.ConnectionsHandler;
import io.airbyte.server.handlers.DbMigrationHandler;
Expand All @@ -52,6 +55,7 @@
import io.airbyte.server.handlers.LogsHandler;
import io.airbyte.server.handlers.OperationsHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.airbyte.server.handlers.WorkspacesHandler;
import io.airbyte.server.scheduler.EventRunner;
import io.airbyte.server.scheduler.SynchronousSchedulerClient;
import java.net.http.HttpClient;
Expand Down Expand Up @@ -88,7 +92,8 @@ ServerRunnable create(final SynchronousSchedulerClient synchronousSchedulerClien
final JobHistoryHandler jobHistoryHandler,
final LogsHandler logsHandler,
final OperationsHandler operationsHandler,
final SchedulerHandler schedulerHandler);
final SchedulerHandler schedulerHandler,
final WorkspacesHandler workspacesHandler);

class Api implements ServerFactory {

Expand Down Expand Up @@ -118,7 +123,8 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final JobHistoryHandler jobHistoryHandler,
final LogsHandler logsHandler,
final OperationsHandler operationsHandler,
final SchedulerHandler schedulerHandler) {
final SchedulerHandler schedulerHandler,
final WorkspacesHandler workspacesHandler) {
final Map<String, String> mdc = MDC.getCopyOfContextMap();

// set static values for factory
Expand Down Expand Up @@ -164,6 +170,8 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul

LogsApiFactory.setValues(logsHandler);

NotificationsApiFactory.setValues(workspacesHandler);

// server configurations
final Set<Class<?>> componentClasses = Set.of(
ConfigurationApi.class,
Expand All @@ -175,7 +183,8 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
DestinationDefinitionSpecificationApiController.class,
HealthApiController.class,
JobsApiController.class,
LogsApiController.class);
LogsApiController.class,
NotificationsApiController.class);

final Set<Object> components = Set.of(
new CorsFilter(),
Expand All @@ -188,7 +197,8 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
new DestinationDefinitionSpecificationApiBinder(),
new HealthApiBinder(),
new JobsApiBinder(),
new LogsApiBinder());
new LogsApiBinder(),
new NotificationApiBinder());

// construct server
return new ServerApp(airbyteVersion, componentClasses, components);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,13 @@ public void updateWorkspaceFeedback(final WorkspaceGiveFeedback workspaceGiveFee
});
}

/**
* This implementation has been moved to {@link AttemptApiController}. Since the path of
* {@link AttemptApiController} is more granular, it will override this implementation
*/
@Override
public NotificationRead tryNotificationConfig(final Notification notification) {
return execute(() -> workspacesHandler.tryNotification(notification));
throw new NotImplementedException();
}

// SOURCE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.server.apis;

import io.airbyte.api.generated.NotificationsApi;
import io.airbyte.api.model.generated.Notification;
import io.airbyte.api.model.generated.NotificationRead;
import io.airbyte.server.handlers.WorkspacesHandler;
import javax.ws.rs.Path;
import lombok.AllArgsConstructor;

@Path("/v1/notifications/try")
@AllArgsConstructor
public class NotificationsApiController implements NotificationsApi {

private final WorkspacesHandler workspacesHandler;

@Override
public NotificationRead tryNotificationConfig(final Notification notification) {
return ConfigurationApi.execute(() -> workspacesHandler.tryNotification(notification));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.server.apis.binders;

import io.airbyte.server.apis.NotificationsApiController;
import io.airbyte.server.apis.factories.NotificationsApiFactory;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import org.glassfish.jersey.process.internal.RequestScoped;

public class NotificationApiBinder extends AbstractBinder {

@Override
protected void configure() {
bindFactory(NotificationsApiFactory.class)
.to(NotificationsApiController.class)
.in(RequestScoped.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.server.apis.factories;

import io.airbyte.server.apis.NotificationsApiController;
import io.airbyte.server.handlers.WorkspacesHandler;
import org.glassfish.hk2.api.Factory;

public class NotificationsApiFactory implements Factory<NotificationsApiController> {

private static WorkspacesHandler workspacesHandler;

public static void setValues(final WorkspacesHandler workspacesHandler) {
NotificationsApiFactory.workspacesHandler = workspacesHandler;
}

@Override
public NotificationsApiController provide() {
return new NotificationsApiController(NotificationsApiFactory.workspacesHandler);
}

@Override
public void dispose(final NotificationsApiController instance) {
/* no op */
}

}