Skip to content

Commit

Permalink
update SourceOauthApiController to Micronaut (#20386)
Browse files Browse the repository at this point in the history
* convert SourceOauthApiController to Micronaut

* remove SourceOauthApi reference
  • Loading branch information
colesnodgrass committed Dec 12, 2022
1 parent 9fe2319 commit fe595fb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 67 deletions.
5 changes: 2 additions & 3 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|operations|scheduler|sources|source_definitions|state)/.* {
location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations|scheduler|source_oauths|sources|source_definitions|state)/.* {
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,8 +103,7 @@ http {
}
}

location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations|source_definitions|sources|scheduler|state)/.* {
location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations
location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations|scheduler|source_oauths|sources|source_definitions|state)/.* {
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|operations|scheduler|sources|source_definitions|state)/.* {
location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations|scheduler|source_oauths|sources|source_definitions|state)/.* {
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|operations|scheduler|sources|source_definitions|state)/.* {
location ~ ^/api/v1/(connections|destinations|destination_definitions|destination_definition_specifications|destination_oauths|operations|scheduler|source_oauths|sources|source_definitions|state)/.* {
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,22 +17,19 @@
import io.airbyte.server.apis.LogsApiController;
import io.airbyte.server.apis.NotificationsApiController;
import io.airbyte.server.apis.SourceDefinitionSpecificationApiController;
import io.airbyte.server.apis.SourceOauthApiController;
import io.airbyte.server.apis.StateApiController;
import io.airbyte.server.apis.WebBackendApiController;
import io.airbyte.server.apis.WorkspaceApiController;
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.SourceDefinitionSpecificationApiBinder;
import io.airbyte.server.apis.binders.SourceOauthApiBinder;
import io.airbyte.server.apis.binders.WebBackendApiBinder;
import io.airbyte.server.apis.binders.WorkspaceApiBinder;
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.SourceDefinitionSpecificationApiFactory;
import io.airbyte.server.apis.factories.SourceOauthApiFactory;
import io.airbyte.server.apis.factories.WebBackendApiFactory;
import io.airbyte.server.apis.factories.WorkspaceApiFactory;
import io.airbyte.server.handlers.AttemptHandler;
Expand Down Expand Up @@ -128,9 +125,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
final WebBackendConnectionsHandler webBackendConnectionsHandler,
final WebBackendGeographiesHandler webBackendGeographiesHandler,
final WebBackendCheckUpdatesHandler webBackendCheckUpdatesHandler) {

SourceOauthApiFactory.setValues(oAuthHandler);

JobsApiFactory.setValues(jobHistoryHandler, schedulerHandler);

LogsApiFactory.setValues(logsHandler);
Expand All @@ -149,7 +143,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
LogsApiController.class,
NotificationsApiController.class,
SourceDefinitionSpecificationApiController.class,
SourceOauthApiController.class,
StateApiController.class,
WebBackendApiController.class,
WorkspaceApiController.class);
Expand All @@ -159,7 +152,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
new LogsApiBinder(),
new NotificationApiBinder(),
new SourceDefinitionSpecificationApiBinder(),
new SourceOauthApiBinder(),
new WebBackendApiBinder(),
new WorkspaceApiBinder());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,32 @@
import io.airbyte.api.model.generated.SetInstancewideSourceOauthParamsRequestBody;
import io.airbyte.api.model.generated.SourceOauthConsentRequest;
import io.airbyte.server.handlers.OAuthHandler;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import java.util.Map;
import javax.ws.rs.Path;
import lombok.AllArgsConstructor;

@Path("/v1/source_oauths")
@AllArgsConstructor
@Controller("/api/v1/source_oauths")
public class SourceOauthApiController implements SourceOauthApi {

private final OAuthHandler oAuthHandler;

public SourceOauthApiController(final OAuthHandler oAuthHandler) {
this.oAuthHandler = oAuthHandler;
}

@Post("/complete_oauth")
@Override
public Map<String, Object> completeSourceOAuth(final CompleteSourceOauthRequest completeSourceOauthRequest) {
return ApiHelper.execute(() -> oAuthHandler.completeSourceOAuth(completeSourceOauthRequest));
}

@Post("/get_consent_url")
@Override
public OAuthConsentRead getSourceOAuthConsent(final SourceOauthConsentRequest sourceOauthConsentRequest) {
return ApiHelper.execute(() -> oAuthHandler.getSourceOAuthConsent(sourceOauthConsentRequest));
}

@Post("/oauth_params/create")
@Override
public void setInstancewideSourceOauthParams(final SetInstancewideSourceOauthParamsRequestBody setInstancewideSourceOauthParamsRequestBody) {
ApiHelper.execute(() -> {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit fe595fb

Please sign in to comment.