comparison pkg/imports/wg.go @ 1808:77582da3adb0

Waterway gauges import: Added stub.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 15 Jan 2019 16:51:38 +0100
parents
children 7ee9bdaac336
comparison
equal deleted inserted replaced
1807:824e7b7d81a4 1808:77582da3adb0
1 // This is Free Software under GNU Affero General Public License v >= 3.0
2 // without warranty, see README.md and license for details.
3 //
4 // SPDX-License-Identifier: AGPL-3.0-or-later
5 // License-Filename: LICENSES/AGPL-3.0.txt
6 //
7 // Copyright (C) 2018 by via donau
8 // – Österreichische Wasserstraßen-Gesellschaft mbH
9 // Software engineering by Intevation GmbH
10 //
11 // Author(s):
12 // * Sascha L. Teichmann <sascha.teichmann@intevation.de>
13
14 package imports
15
16 import (
17 "context"
18 "database/sql"
19 "errors"
20
21 "gemma.intevation.de/gemma/pkg/common"
22 )
23
24 type WaterwayGauge struct {
25 // URL is the URL of the SOAP service.
26 URL string `json:"url"`
27 // Username is the username used to authenticate.
28 Username string `json:"username"`
29 // Passwort is the password to authenticate.
30 Password string `json:"password"`
31 // Insecure indicates if HTTPS traffic
32 // should validate certificates or not.
33 Insecure bool `json:"insecure"`
34 }
35
36 const WGJobKind JobKind = "wg"
37
38 type wgJobCreator struct{}
39
40 func init() {
41 RegisterJobCreator(WGJobKind, wgJobCreator{})
42 }
43
44 func (wgJobCreator) Description() string { return "waterway gauges" }
45
46 func (wgJobCreator) AutoAccept() bool { return false }
47
48 func (wgJobCreator) Create(_ JobKind, data string) (Job, error) {
49 wg := new(WaterwayGauge)
50 if err := common.FromJSONString(data, wg); err != nil {
51 return nil, err
52 }
53 return wg, nil
54 }
55
56 func (wgJobCreator) Depends() []string {
57 return []string{
58 "gauges",
59 }
60 }
61
62 func (wgJobCreator) StageDone(
63 ctx context.Context,
64 tx *sql.Tx,
65 id int64,
66 ) error {
67 // TODO: Implement me!
68 return nil
69 }
70
71 func (*WaterwayGauge) CleanUp() error { return nil }
72
73 func (wg *WaterwayGauge) Do(
74 ctx context.Context,
75 importID int64,
76 conn *sql.Conn,
77 feedback Feedback,
78 ) (interface{}, error) {
79 // TODO: Implement me!
80 return nil, errors.New("Not implemented, yet!")
81 }