Mercurial > gemma
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/imports/wg.go Tue Jan 15 16:51:38 2019 +0100 @@ -0,0 +1,81 @@ +// This is Free Software under GNU Affero General Public License v >= 3.0 +// without warranty, see README.md and license for details. +// +// SPDX-License-Identifier: AGPL-3.0-or-later +// License-Filename: LICENSES/AGPL-3.0.txt +// +// Copyright (C) 2018 by via donau +// – Österreichische Wasserstraßen-Gesellschaft mbH +// Software engineering by Intevation GmbH +// +// Author(s): +// * Sascha L. Teichmann <sascha.teichmann@intevation.de> + +package imports + +import ( + "context" + "database/sql" + "errors" + + "gemma.intevation.de/gemma/pkg/common" +) + +type WaterwayGauge struct { + // URL is the URL of the SOAP service. + URL string `json:"url"` + // Username is the username used to authenticate. + Username string `json:"username"` + // Passwort is the password to authenticate. + Password string `json:"password"` + // Insecure indicates if HTTPS traffic + // should validate certificates or not. + Insecure bool `json:"insecure"` +} + +const WGJobKind JobKind = "wg" + +type wgJobCreator struct{} + +func init() { + RegisterJobCreator(WGJobKind, wgJobCreator{}) +} + +func (wgJobCreator) Description() string { return "waterway gauges" } + +func (wgJobCreator) AutoAccept() bool { return false } + +func (wgJobCreator) Create(_ JobKind, data string) (Job, error) { + wg := new(WaterwayGauge) + if err := common.FromJSONString(data, wg); err != nil { + return nil, err + } + return wg, nil +} + +func (wgJobCreator) Depends() []string { + return []string{ + "gauges", + } +} + +func (wgJobCreator) StageDone( + ctx context.Context, + tx *sql.Tx, + id int64, +) error { + // TODO: Implement me! + return nil +} + +func (*WaterwayGauge) CleanUp() error { return nil } + +func (wg *WaterwayGauge) Do( + ctx context.Context, + importID int64, + conn *sql.Conn, + feedback Feedback, +) (interface{}, error) { + // TODO: Implement me! + return nil, errors.New("Not implemented, yet!") +}