|
9 | 9 | import org.embulk.config.Config;
|
10 | 10 | import org.embulk.config.ConfigDefault;
|
11 | 11 | import org.embulk.output.jdbc.AbstractJdbcOutputPlugin;
|
| 12 | +import org.embulk.output.jdbc.Ssl; |
12 | 13 | import org.embulk.output.jdbc.BatchInsert;
|
13 | 14 | import org.embulk.output.jdbc.JdbcOutputConnection;
|
14 | 15 | import org.embulk.output.jdbc.MergeConfig;
|
@@ -44,6 +45,11 @@ public interface MySQLPluginTask
|
44 | 45 | @Config("temp_database")
|
45 | 46 | @ConfigDefault("null")
|
46 | 47 | public Optional<String> getTempDatabase();
|
| 48 | + |
| 49 | + @Config("ssl") |
| 50 | + @ConfigDefault("\"disable\"") // backward compatibility |
| 51 | + public Ssl getSsl(); |
| 52 | + |
47 | 53 | }
|
48 | 54 |
|
49 | 55 | @Override
|
@@ -80,21 +86,21 @@ protected MySQLOutputConnector getConnector(PluginTask task, boolean retryableMe
|
80 | 86 | // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
|
81 | 87 | props.setProperty("tcpKeepAlive", "true");
|
82 | 88 |
|
83 |
| - // TODO |
84 |
| - //switch t.getSssl() { |
85 |
| - //when "disable": |
86 |
| - // break; |
87 |
| - //when "enable": |
88 |
| - // props.setProperty("useSSL", "true"); |
89 |
| - // props.setProperty("requireSSL", "false"); |
90 |
| - // props.setProperty("verifyServerCertificate", "false"); |
91 |
| - // break; |
92 |
| - //when "verify": |
93 |
| - // props.setProperty("useSSL", "true"); |
94 |
| - // props.setProperty("requireSSL", "true"); |
95 |
| - // props.setProperty("verifyServerCertificate", "true"); |
96 |
| - // break; |
97 |
| - //} |
| 89 | + switch (t.getSsl()) { |
| 90 | + case DISABLE: |
| 91 | + props.setProperty("useSSL", "false"); |
| 92 | + break; |
| 93 | + case ENABLE: |
| 94 | + props.setProperty("useSSL", "true"); |
| 95 | + props.setProperty("requireSSL", "true"); |
| 96 | + props.setProperty("verifyServerCertificate", "false"); |
| 97 | + break; |
| 98 | + case VERIFY: |
| 99 | + props.setProperty("useSSL", "true"); |
| 100 | + props.setProperty("requireSSL", "true"); |
| 101 | + props.setProperty("verifyServerCertificate", "true"); |
| 102 | + break; |
| 103 | + } |
98 | 104 |
|
99 | 105 | if (!retryableMetadataOperation) {
|
100 | 106 | // non-retryable batch operation uses longer timeout
|
|
0 commit comments