-
Notifications
You must be signed in to change notification settings - Fork 265
/
imageconfig.go
49 lines (41 loc) · 1.22 KB
/
imageconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ociinstaller
import (
"encoding/json"
)
const DefaultConfigSchema string = "2020-11-18"
type config struct {
SchemaVersion string `json:"schemaVersion"`
Plugin *configPlugin `json:"plugin,omitempty"`
Database *configDb `json:"db,omitempty"`
Fdw *configFdw `json:"fdw,omitempty"`
}
type configPlugin struct {
Name string `json:"name,omitempty"`
Organization string `json:"organization,omitempty"`
Version string `json:"version"`
}
type configDb struct {
Name string `json:"name,omitempty"`
Organization string `json:"organization,omitempty"`
Version string `json:"version"`
DBVersion string `json:"dbVersion,omitempty"`
}
type configFdw struct {
Name string `json:"name,omitempty"`
Organization string `json:"organization,omitempty"`
Version string `json:"version"`
}
func newSteampipeImageConfig(configBytes []byte) (*config, error) {
configData := &config{
Plugin: &configPlugin{},
Database: &configDb{},
Fdw: &configFdw{},
}
if err := json.Unmarshal(configBytes, configData); err != nil {
return nil, err
}
if configData.SchemaVersion == "" {
configData.SchemaVersion = DefaultConfigSchema
}
return configData, nil
}