Skip to content

Commit

Permalink
convert NotificationsApiController to Micronaut (#20396)
Browse files Browse the repository at this point in the history
* convert NotificationsApiController to Micronaut

* format
  • Loading branch information
colesnodgrass authored Dec 13, 2022
1 parent 38314dc commit ae2e034
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 64 deletions.
4 changes: 2 additions & 2 deletions airbyte-proxy/nginx-auth.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions airbyte-proxy/nginx-no-auth.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -118,8 +116,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul

LogsApiFactory.setValues(logsHandler);

NotificationsApiFactory.setValues(workspacesHandler);

WebBackendApiFactory.setValues(webBackendConnectionsHandler, webBackendGeographiesHandler, webBackendCheckUpdatesHandler);

final Set<Class<?>> componentClasses = Set.of(
Expand All @@ -129,7 +125,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul

final Set<Object> components = Set.of(
new LogsApiBinder(),
new NotificationApiBinder(),
new WebBackendApiBinder());

// construct server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

This file was deleted.

This file was deleted.

0 comments on commit ae2e034

Please sign in to comment.