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
Interface changes to support separating secrets from the config #6065
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,7 +188,8 @@ public DestinationConnection getDestinationConnection(final UUID destinationId) | |
return persistence.getConfig(ConfigSchema.DESTINATION_CONNECTION, destinationId.toString(), DestinationConnection.class); | ||
} | ||
|
||
public void writeDestinationConnection(final DestinationConnection destinationConnection) throws JsonValidationException, IOException { | ||
public void writeDestinationConnection(final DestinationConnection destinationConnection, final ConnectorSpecification connectorSpecification) | ||
throws JsonValidationException, IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add the validation sanity check, similar to the source connection? Otherwise it's hard to verify that we're getting the correct value passed here in tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
persistence.writeConfig(ConfigSchema.DESTINATION_CONNECTION, destinationConnection.getDestinationId().toString(), destinationConnection); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
import io.airbyte.scheduler.persistence.WorkspaceHelper; | ||
import io.airbyte.server.converters.SpecFetcher; | ||
import io.airbyte.server.errors.IdNotFoundKnownException; | ||
import io.airbyte.server.handlers.DestinationHandler; | ||
import io.airbyte.server.handlers.SourceHandler; | ||
import io.airbyte.validation.json.JsonSchemaValidator; | ||
import io.airbyte.validation.json.JsonValidationException; | ||
|
@@ -440,15 +441,19 @@ private <T> void importConfigsIntoWorkspace(Path sourceRoot, UUID workspaceId, b | |
return destinationConnection; | ||
}, | ||
(destinationConnection) -> { | ||
final ConnectorSpecification spec; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code is error prone. What if the code in the try changes and there is a path that leads to an undefined spec? You could change the structure to be:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adjusted to bring the writeDestinationConnection inside the try, and similar for the source connection in related code. |
||
// make sure connector definition exists | ||
try { | ||
if (configRepository.getStandardDestinationDefinition(destinationConnection.getDestinationDefinitionId()) == null) { | ||
StandardDestinationDefinition destinationDefinition = configRepository.getStandardDestinationDefinition( | ||
destinationConnection.getDestinationDefinitionId()); | ||
if (destinationDefinition == null) { | ||
return; | ||
} | ||
spec = DestinationHandler.getSpec(specFetcher, destinationDefinition); | ||
} catch (ConfigNotFoundException e) { | ||
return; | ||
} | ||
configRepository.writeDestinationConnection(destinationConnection); | ||
configRepository.writeDestinationConnection(destinationConnection, spec); | ||
})); | ||
case STANDARD_SYNC -> standardSyncs = configs; | ||
case STANDARD_SYNC_OPERATION -> operationIdMap.putAll(importIntoWorkspace( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated from line 7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done