github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/openapi/fixtures/source.go (about) 1 // Copyright 2021 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package fixtures 15 16 import ( 17 "encoding/json" 18 19 "github.com/pingcap/tiflow/dm/openapi" 20 ) 21 22 var sourceStr = ` 23 { 24 "source_name": "mysql-01", 25 "host": "127.0.0.1", 26 "port": 3306, 27 "user": "root", 28 "password": "123456", 29 "enable_gtid": false, 30 "security": { 31 "ssl_ca_content": "", 32 "ssl_cert_content": "", 33 "ssl_key_content": "", 34 "cert_allowed_cn": [ 35 "string" 36 ] 37 }, 38 "purge": { 39 "interval": 3600, 40 "expires": 0, 41 "remain_space": 15 42 }, 43 "relay_config": { 44 "enable_relay": true, 45 "relay_binlog_name": "mysql-bin.000002", 46 "relay_binlog_gtid": "e9a1fc22-ec08-11e9-b2ac-0242ac110003:1-7849", 47 "relay_dir": "./relay_log" 48 } 49 } 50 ` 51 52 // GenOpenAPISourceForTest generates openapi.Source for test. 53 func GenOpenAPISourceForTest() (openapi.Source, error) { 54 s := openapi.Source{} 55 err := json.Unmarshal([]byte(sourceStr), &s) 56 return s, err 57 }