diff --git a/airbyte-proxy/nginx-auth.conf.template b/airbyte-proxy/nginx-auth.conf.template index 3092d5a2823a3..c5439d52045bd 100644 --- a/airbyte-proxy/nginx-auth.conf.template +++ b/airbyte-proxy/nginx-auth.conf.template @@ -43,7 +43,7 @@ http { } } - location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { + location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|notifications|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -103,7 +103,7 @@ http { } } - location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { + location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|notifications|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/airbyte-proxy/nginx-no-auth.conf.template b/airbyte-proxy/nginx-no-auth.conf.template index ba45138b7c818..1bbe33ab75746 100644 --- a/airbyte-proxy/nginx-no-auth.conf.template +++ b/airbyte-proxy/nginx-no-auth.conf.template @@ -25,7 +25,7 @@ http { proxy_pass "${PROXY_PASS_MICRONAUT_API}"; } - location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { + location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|notifications|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -58,7 +58,7 @@ http { proxy_pass "${PROXY_PASS_MICRONAUT_API}"; } - location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { + location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|jobs|notifications|operations|scheduler|source_oauths|sources|source_definitions|source_definition_specifications|state|workspaces)/.* { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java b/airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java index f86bf78b40e6f..e63379c5501f0 100644 --- a/airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java +++ b/airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java @@ -17,10 +17,8 @@ import io.airbyte.server.apis.NotificationsApiController; import io.airbyte.server.apis.WebBackendApiController; import io.airbyte.server.apis.binders.LogsApiBinder; -import io.airbyte.server.apis.binders.NotificationApiBinder; import io.airbyte.server.apis.binders.WebBackendApiBinder; import io.airbyte.server.apis.factories.LogsApiFactory; -import io.airbyte.server.apis.factories.NotificationsApiFactory; import io.airbyte.server.apis.factories.WebBackendApiFactory; import io.airbyte.server.handlers.AttemptHandler; import io.airbyte.server.handlers.ConnectionsHandler; @@ -118,8 +116,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul LogsApiFactory.setValues(logsHandler); - NotificationsApiFactory.setValues(workspacesHandler); - WebBackendApiFactory.setValues(webBackendConnectionsHandler, webBackendGeographiesHandler, webBackendCheckUpdatesHandler); final Set> componentClasses = Set.of( @@ -129,7 +125,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul final Set components = Set.of( new LogsApiBinder(), - new NotificationApiBinder(), new WebBackendApiBinder()); // construct server diff --git a/airbyte-server/src/main/java/io/airbyte/server/apis/NotificationsApiController.java b/airbyte-server/src/main/java/io/airbyte/server/apis/NotificationsApiController.java index 981ad80f7e8d4..682ab6eb0d083 100644 --- a/airbyte-server/src/main/java/io/airbyte/server/apis/NotificationsApiController.java +++ b/airbyte-server/src/main/java/io/airbyte/server/apis/NotificationsApiController.java @@ -8,17 +8,22 @@ 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; +import io.micronaut.http.annotation.Body; +import io.micronaut.http.annotation.Controller; +import io.micronaut.http.annotation.Post; -@Path("/v1/notifications/try") -@AllArgsConstructor +@Controller("/api/v1/notifications/try") public class NotificationsApiController implements NotificationsApi { private final WorkspacesHandler workspacesHandler; + public NotificationsApiController(final WorkspacesHandler workspacesHandler) { + this.workspacesHandler = workspacesHandler; + } + + @Post @Override - public NotificationRead tryNotificationConfig(final Notification notification) { + public NotificationRead tryNotificationConfig(@Body final Notification notification) { return ApiHelper.execute(() -> workspacesHandler.tryNotification(notification)); } diff --git a/airbyte-server/src/main/java/io/airbyte/server/apis/binders/NotificationApiBinder.java b/airbyte-server/src/main/java/io/airbyte/server/apis/binders/NotificationApiBinder.java deleted file mode 100644 index 009c3e2d48b5b..0000000000000 --- a/airbyte-server/src/main/java/io/airbyte/server/apis/binders/NotificationApiBinder.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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); - } - -} diff --git a/airbyte-server/src/main/java/io/airbyte/server/apis/factories/NotificationsApiFactory.java b/airbyte-server/src/main/java/io/airbyte/server/apis/factories/NotificationsApiFactory.java deleted file mode 100644 index 29a3cf7e9096b..0000000000000 --- a/airbyte-server/src/main/java/io/airbyte/server/apis/factories/NotificationsApiFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 { - - 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 */ - } - -}