2022-09-13 22:54:49 +02:00
|
|
|
package schema
|
|
|
|
|
|
|
|
import "gopkg.in/yaml.v3"
|
|
|
|
|
|
|
|
type KrakenSchema struct {
|
|
|
|
ApiVersion string `yaml:"apiVersion"`
|
|
|
|
Name string `yaml:"name"`
|
|
|
|
Select struct {
|
|
|
|
Repositories []string `yaml:"repositories"`
|
|
|
|
Providers []struct {
|
|
|
|
Gitea string `yaml:"gitea"`
|
|
|
|
Organisation string `yaml:"organisation"`
|
|
|
|
} `yaml:"providers"`
|
|
|
|
} `yaml:"select"`
|
2022-09-14 23:40:58 +02:00
|
|
|
Actions []struct {
|
|
|
|
Type string `yaml:"type"`
|
|
|
|
Entry string `yaml:"entry"`
|
|
|
|
} `yaml:"actions"`
|
2022-09-18 15:48:58 +02:00
|
|
|
Queries []struct {
|
|
|
|
Type string `yaml:"type"`
|
|
|
|
Query string `yaml:"query"`
|
|
|
|
} `yaml:"queries"`
|
2022-09-13 22:54:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Unmarshal(raw string) (*KrakenSchema, error) {
|
|
|
|
k := &KrakenSchema{}
|
|
|
|
err := yaml.Unmarshal([]byte(raw), k)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return k, nil
|
|
|
|
}
|