-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
destination-mysql: convert prod code to kotlin
- Loading branch information
1 parent
ee1c21c
commit 17caebf
Showing
19 changed files
with
613 additions
and
624 deletions.
There are no files selected for viewing
70 changes: 33 additions & 37 deletions
70
.../airbyte/integrations/destination/mssql_strict_encrypt/MssqlStrictEncryptDestination.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.mssql_strict_encrypt; | ||
|
||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import io.airbyte.cdk.integrations.base.Destination; | ||
import io.airbyte.cdk.integrations.base.IntegrationRunner; | ||
import io.airbyte.cdk.integrations.base.spec_modification.SpecModifyingDestination; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.integrations.destination.mssql.MSSQLDestination; | ||
import io.airbyte.protocol.models.v0.ConnectorSpecification; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class MssqlStrictEncryptDestination extends SpecModifyingDestination implements Destination { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(MssqlStrictEncryptDestination.class); | ||
|
||
public MssqlStrictEncryptDestination() { | ||
super(MSSQLDestination.sshWrappedDestination()); | ||
} | ||
|
||
public static void main(final String[] args) throws Exception { | ||
final Destination destination = new MssqlStrictEncryptDestination(); | ||
LOGGER.info("starting destination: {}", MssqlStrictEncryptDestination.class); | ||
new IntegrationRunner(destination).run(args); | ||
LOGGER.info("completed destination: {}", MssqlStrictEncryptDestination.class); | ||
} | ||
|
||
@Override | ||
public ConnectorSpecification modifySpec(final ConnectorSpecification originalSpec) { | ||
final ConnectorSpecification spec = Jsons.clone(originalSpec); | ||
// Remove the first element in the "ssl_method" array, because it allows users to choose an | ||
// unencrypted connection. | ||
((ArrayNode) spec.getConnectionSpecification().get("properties").get("ssl_method").get("oneOf")).remove(0); | ||
return spec; | ||
} | ||
|
||
package io.airbyte.integrations.destination.mssql_strict_encrypt | ||
|
||
import com.fasterxml.jackson.databind.node.ArrayNode | ||
import io.airbyte.cdk.integrations.base.Destination | ||
import io.airbyte.cdk.integrations.base.IntegrationRunner | ||
import io.airbyte.cdk.integrations.base.spec_modification.SpecModifyingDestination | ||
import io.airbyte.integrations.destination.mssql.MSSQLDestination | ||
import io.airbyte.protocol.models.v0.ConnectorSpecification | ||
import org.apache.http.client.utils.CloneUtils | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
|
||
class MssqlStrictEncryptDestination : SpecModifyingDestination(MSSQLDestination.sshWrappedDestination()), Destination { | ||
override fun modifySpec(originalSpec: ConnectorSpecification): ConnectorSpecification { | ||
val spec: ConnectorSpecification = CloneUtils.cloneObject(originalSpec) | ||
// Remove the first element in the "ssl_method" array, because it allows users to choose an | ||
// unencrypted connection. | ||
(spec.connectionSpecification["properties"]["ssl_method"]["oneOf"] as ArrayNode).remove(0) | ||
return spec | ||
} | ||
|
||
companion object { | ||
private val LOGGER: Logger = LoggerFactory.getLogger(MssqlStrictEncryptDestination::class.java) | ||
|
||
@Throws(Exception::class) | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val destination: Destination = MssqlStrictEncryptDestination() | ||
LOGGER.info("starting destination: {}", MssqlStrictEncryptDestination::class.java) | ||
IntegrationRunner(destination).run(args) | ||
LOGGER.info("completed destination: {}", MssqlStrictEncryptDestination::class.java) | ||
} | ||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
...rc/main/java/io/airbyte/integrations/destination/mysql/MySQLDestinationStrictEncrypt.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
.../src/main/java/io/airbyte/integrations/destination/mysql/MySQLDestinationStrictEncrypt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
package io.airbyte.integrations.destination.mysql | ||
|
||
import com.fasterxml.jackson.databind.node.ObjectNode | ||
import io.airbyte.cdk.integrations.base.Destination | ||
import io.airbyte.cdk.integrations.base.IntegrationRunner | ||
import io.airbyte.cdk.integrations.base.spec_modification.SpecModifyingDestination | ||
import io.airbyte.protocol.models.v0.ConnectorSpecification | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
|
||
class MySQLDestinationStrictEncrypt : SpecModifyingDestination(MySQLDestination.sshWrappedDestination()), Destination { | ||
override fun modifySpec(originalSpec: ConnectorSpecification): ConnectorSpecification { | ||
val spec: ConnectorSpecification = clone.clone<ConnectorSpecification>(originalSpec) | ||
(spec.connectionSpecification["properties"] as ObjectNode).remove(SSL_KEY) | ||
return spec | ||
} | ||
|
||
companion object { | ||
private val LOGGER: Logger = LoggerFactory.getLogger(MySQLDestinationStrictEncrypt::class.java) | ||
|
||
@Throws(Exception::class) | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val destination: Destination = MySQLDestinationStrictEncrypt() | ||
LOGGER.info("starting destination: {}", MySQLDestinationStrictEncrypt::class.java) | ||
try { | ||
IntegrationRunner(destination).run(args) | ||
} catch (e: Exception) { | ||
MySQLDestination.handleException(e) | ||
} | ||
LOGGER.info("completed destination: {}", MySQLDestinationStrictEncrypt::class.java) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
211 changes: 0 additions & 211 deletions
211
...ation-mysql/src/main/java/io/airbyte/integrations/destination/mysql/MySQLDestination.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.