octopush/internal/schema/kraken.go
Kasper Juul Hermansen d6d98c2ce8 v0.2 (#14)
Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: #14
2022-09-21 22:55:52 +02:00

33 lines
735 B
Go

package schema
import "gopkg.in/yaml.v3"
type OctopushSchema 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"`
Actions []struct {
Type string `yaml:"type"`
Entry string `yaml:"entry"`
} `yaml:"actions"`
Queries []struct {
Type string `yaml:"type"`
Query string `yaml:"query"`
} `yaml:"queries"`
}
func Unmarshal(raw string) (*OctopushSchema, error) {
k := &OctopushSchema{}
err := yaml.Unmarshal([]byte(raw), k)
if err != nil {
return nil, err
}
return k, nil
}