-
Notifications
You must be signed in to change notification settings - Fork 10
/
types.go
107 lines (94 loc) · 2.68 KB
/
types.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package manifest
import jsoniter "github.com/json-iterator/go"
type ChartManifest struct {
Id string
Name string
VersionId string
Version string
}
type TerraformManifest struct {
Id string
Name string
}
type Dependency struct {
Repo string
}
type Metadata struct {
Name string
Labels map[string]string `yaml:",omitempty"`
}
type Manifest struct {
Id string
Name string
Cluster string
Project string
Bucket string
Provider string
Region string
License string
Wait bool
Charts []*ChartManifest
Terraform []*TerraformManifest
Dependencies []*Dependency
Context map[string]interface{}
Links *Links `yaml:"links,omitempty"`
}
type Owner struct {
Email string
Endpoint string `yaml:"endpoint,omitempty"`
}
type NetworkConfig struct {
Subdomain string `json:"subdomain"`
PluralDns bool `json:"pluralDns"`
}
type ProjectManifest struct {
ClusterAPI bool
Cluster string
Bucket string
Project string
Provider string
Region string
Owner *Owner
Network *NetworkConfig
AvailabilityZones []string
BucketPrefix string `yaml:"bucketPrefix"`
Context map[string]interface{}
}
func (this *ProjectManifest) MarshalJSON() ([]byte, error) {
json := jsoniter.ConfigCompatibleWithStandardLibrary
return json.Marshal(&struct {
Cluster string `json:"cluster"`
Bucket string `json:"bucket"`
Project string `json:"project"`
Provider string `json:"provider"`
Region string `json:"region"`
Owner *Owner `json:"owner"`
Network *NetworkConfig `json:"network"`
AvailabilityZones []string `json:"availabilityZones"`
BucketPrefix string `yaml:"bucketPrefix" json:"bucketPrefix"`
Context map[string]interface{} `json:"context"`
}{
Cluster: this.Cluster,
Bucket: this.Bucket,
Project: this.Project,
Provider: this.Provider,
Region: this.Region,
Owner: this.Owner,
Network: this.Network,
AvailabilityZones: this.AvailabilityZones,
BucketPrefix: this.BucketPrefix,
Context: this.Context,
})
}
type VersionedManifest struct {
ApiVersion string `yaml:"apiVersion"`
Kind string
Metadata *Metadata
Spec *Manifest
}
type VersionedProjectManifest struct {
ApiVersion string `yaml:"apiVersion"`
Kind string
Metadata *Metadata
Spec *ProjectManifest
}