Skip to content

Commit

Permalink
Allow the OSS server only on OSS (#21416)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoriceau authored and jbfbell committed Jan 13, 2023
1 parent c3a2e63 commit 218b42a
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
import io.airbyte.api.model.generated.SaveStatsRequestBody;
import io.airbyte.api.model.generated.SetWorkflowInAttemptRequestBody;
import io.airbyte.server.handlers.AttemptHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/attempt/")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class AttemptApiController implements AttemptApi {

private final AttemptHandler attemptHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
import io.airbyte.server.handlers.OperationsHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/connections")
@Context()
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class ConnectionApiController implements ConnectionApi {

private final ConnectionsHandler connectionsHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
import io.airbyte.api.model.generated.WorkspaceIdRequestBody;
import io.airbyte.server.handlers.DestinationHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import lombok.AllArgsConstructor;

@Controller("/api/v1/destinations")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@AllArgsConstructor
public class DestinationApiController implements DestinationApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
import io.airbyte.api.model.generated.WorkspaceIdRequestBody;
import io.airbyte.server.handlers.DestinationDefinitionsHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/destination_definitions")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@Context
public class DestinationDefinitionApiController implements DestinationDefinitionApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
import io.airbyte.api.model.generated.DestinationDefinitionIdWithWorkspaceId;
import io.airbyte.api.model.generated.DestinationDefinitionSpecificationRead;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/destination_definition_specifications")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class DestinationDefinitionSpecificationApiController implements DestinationDefinitionSpecificationApi {

private final SchedulerHandler schedulerHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
import io.airbyte.api.model.generated.SetInstancewideDestinationOauthParamsRequestBody;
import io.airbyte.server.handlers.OAuthHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import java.util.Map;

@Controller("/api/v1/destination_oauths")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@Context
public class DestinationOauthApiController implements DestinationOauthApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
import io.airbyte.api.generated.HealthApi;
import io.airbyte.api.model.generated.HealthCheckRead;
import io.airbyte.server.handlers.HealthCheckHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;

@Controller("/api/v1/health")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class HealthApiController implements HealthApi {

private final HealthCheckHandler healthCheckHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
import io.airbyte.server.handlers.JobHistoryHandler;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/jobs")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@Context
public class JobsApiController implements JobsApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
import io.airbyte.api.model.generated.LogsRequestBody;
import io.airbyte.server.handlers.LogsHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import java.io.File;

@Controller("/api/v1/logs")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@Context
public class LogsApiController implements LogsApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package io.airbyte.server.apis;

import io.micronaut.context.annotation.Requires;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpStatus;
Expand All @@ -15,6 +16,8 @@
* Custom controller that handles global 404 responses for unknown/unmapped paths.
*/
@Controller("/api/notfound")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class NotFoundController {

@Error(status = HttpStatus.NOT_FOUND,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
import io.airbyte.api.model.generated.Notification;
import io.airbyte.api.model.generated.NotificationRead;
import io.airbyte.server.handlers.WorkspacesHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/notifications/try")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class NotificationsApiController implements NotificationsApi {

private final WorkspacesHandler workspacesHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

import io.airbyte.api.generated.OpenapiApi;
import io.airbyte.server.handlers.OpenApiConfigHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import java.io.File;

@Controller("/api/v1/openapi")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class OpenapiApiController implements OpenapiApi {

private final OpenApiConfigHandler openApiConfigHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
import io.airbyte.api.model.generated.OperationUpdate;
import io.airbyte.api.model.generated.OperatorConfiguration;
import io.airbyte.server.handlers.OperationsHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/operations")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class OperationApiController implements OperationApi {

private final OperationsHandler operationsHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
import io.airbyte.api.model.generated.SourceCoreConfig;
import io.airbyte.api.model.generated.SourceDiscoverSchemaRead;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/scheduler")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class SchedulerApiController implements SchedulerApi {

private final SchedulerHandler schedulerHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import io.airbyte.api.model.generated.WorkspaceIdRequestBody;
import io.airbyte.server.handlers.SchedulerHandler;
import io.airbyte.server.handlers.SourceHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/sources")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class SourceApiController implements SourceApi {

private final SchedulerHandler schedulerHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
import io.airbyte.api.model.generated.WorkspaceIdRequestBody;
import io.airbyte.server.handlers.SourceDefinitionsHandler;
import io.micronaut.context.annotation.Context;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/source_definitions")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
@Context
public class SourceDefinitionApiController implements SourceDefinitionApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
import io.airbyte.api.model.generated.SourceDefinitionIdWithWorkspaceId;
import io.airbyte.api.model.generated.SourceDefinitionSpecificationRead;
import io.airbyte.server.handlers.SchedulerHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/source_definition_specifications")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class SourceDefinitionSpecificationApiController implements SourceDefinitionSpecificationApi {

private final SchedulerHandler schedulerHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
import io.airbyte.api.model.generated.SetInstancewideSourceOauthParamsRequestBody;
import io.airbyte.api.model.generated.SourceOauthConsentRequest;
import io.airbyte.server.handlers.OAuthHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;
import java.util.Map;

@Controller("/api/v1/source_oauths")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class SourceOauthApiController implements SourceOauthApi {

private final OAuthHandler oAuthHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import io.airbyte.api.model.generated.ConnectionState;
import io.airbyte.api.model.generated.ConnectionStateCreateOrUpdate;
import io.airbyte.server.handlers.StateHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/state")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class StateApiController implements StateApi {

private final StateHandler stateHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
import io.airbyte.server.handlers.WebBackendCheckUpdatesHandler;
import io.airbyte.server.handlers.WebBackendConnectionsHandler;
import io.airbyte.server.handlers.WebBackendGeographiesHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/web_backend")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class WebBackendApiController implements WebBackendApi {

private final WebBackendConnectionsHandler webBackendConnectionsHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
import io.airbyte.api.model.generated.WorkspaceUpdate;
import io.airbyte.api.model.generated.WorkspaceUpdateName;
import io.airbyte.server.handlers.WorkspacesHandler;
import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Post;

@Controller("/api/v1/workspaces")
@Requires(property = "airbyte.deployment-mode",
value = "OSS")
public class WorkspaceApiController implements WorkspaceApi {

private final WorkspacesHandler workspacesHandler;
Expand Down

0 comments on commit 218b42a

Please sign in to comment.