|
12 | 12 | import org.embulk.config.Config;
|
13 | 13 | import org.embulk.config.ConfigDefault;
|
14 | 14 | import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
|
| 15 | +import org.embulk.input.jdbc.Ssl; |
15 | 16 | import org.embulk.input.jdbc.JdbcInputConnection;
|
16 | 17 | import org.embulk.input.jdbc.getter.ColumnGetterFactory;
|
17 | 18 | import org.embulk.input.mysql.MySQLInputConnection;
|
@@ -42,6 +43,10 @@ public interface MySQLPluginTask
|
42 | 43 |
|
43 | 44 | @Config("database")
|
44 | 45 | public String getDatabase();
|
| 46 | + |
| 47 | + @Config("ssl") |
| 48 | + @ConfigDefault("\"disable\"") // backward compatibility |
| 49 | + public Ssl getSsl(); |
45 | 50 | }
|
46 | 51 |
|
47 | 52 | @Override
|
@@ -75,21 +80,21 @@ protected MySQLInputConnection newConnection(PluginTask task) throws SQLExceptio
|
75 | 80 | // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable.
|
76 | 81 | props.setProperty("tcpKeepAlive", "true");
|
77 | 82 |
|
78 |
| - // TODO |
79 |
| - //switch task.getSssl() { |
80 |
| - //when "disable": |
81 |
| - // break; |
82 |
| - //when "enable": |
83 |
| - // props.setProperty("useSSL", "true"); |
84 |
| - // props.setProperty("requireSSL", "false"); |
85 |
| - // props.setProperty("verifyServerCertificate", "false"); |
86 |
| - // break; |
87 |
| - //when "verify": |
88 |
| - // props.setProperty("useSSL", "true"); |
89 |
| - // props.setProperty("requireSSL", "true"); |
90 |
| - // props.setProperty("verifyServerCertificate", "true"); |
91 |
| - // break; |
92 |
| - //} |
| 83 | + switch (t.getSsl()) { |
| 84 | + case DISABLE: |
| 85 | + props.setProperty("useSSL", "false"); |
| 86 | + break; |
| 87 | + case ENABLE: |
| 88 | + props.setProperty("useSSL", "true"); |
| 89 | + props.setProperty("requireSSL", "true"); |
| 90 | + props.setProperty("verifyServerCertificate", "false"); |
| 91 | + break; |
| 92 | + case VERIFY: |
| 93 | + props.setProperty("useSSL", "true"); |
| 94 | + props.setProperty("requireSSL", "true"); |
| 95 | + props.setProperty("verifyServerCertificate", "true"); |
| 96 | + break; |
| 97 | + } |
93 | 98 |
|
94 | 99 | if (t.getFetchRows() == 1) {
|
95 | 100 | logger.info("Fetch size is 1. Fetching rows one by one.");
|
|
0 commit comments