-
Notifications
You must be signed in to change notification settings - Fork 31
/
spec.go
157 lines (149 loc) · 4.11 KB
/
spec.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
Copyright © 2023 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: MPL-2.0
*/
package spec
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
const (
ChartsKey = "charts"
SpecKey = "spec"
APIVersionKey = "api_version"
AppVersionKey = "app_version"
DeprecatedKey = "deprecated"
KubeVersionKey = "kube_version"
ReleasedAtKey = "released_at"
SourcesKey = "sources"
UrlsKey = "urls"
ValuesConfigKey = "values_config"
DependenciesKey = "dependencies"
AliasKey = "alias"
ChartNameKey = "chart_name"
ChartVersionKey = "chart_version"
ConditionKey = "condition"
ImportValuesKey = "import_values"
RepositoryKey = "repository"
TagsKey = "tags"
nameKey = "name"
chartMetadataNameKey = "chart_metadata_name"
)
var Charts = &schema.Schema{
Type: schema.TypeList,
Description: "List Helm charts.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
nameKey: {
Type: schema.TypeString,
Computed: true,
Description: "Version of helm chart such as 0.5.1",
},
chartMetadataNameKey: {
Type: schema.TypeString,
Computed: true,
Description: "Name of the helm chart.",
},
SpecKey: specSchema,
},
},
}
var dependencySchema = &schema.Schema{
Type: schema.TypeList,
Description: "List of the chart requirements.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
AliasKey: {
Type: schema.TypeString,
Description: "Alias to be used for the chart.",
Computed: true,
},
ChartNameKey: {
Type: schema.TypeString,
Description: "Name of the chart.",
Computed: true,
},
ChartVersionKey: {
Type: schema.TypeBool,
Description: "Version of the chart.",
Computed: true,
},
ConditionKey: {
Type: schema.TypeString,
Description: "Yaml path that resolves to a boolean, used for enabling/disabling charts.",
Computed: true,
},
ImportValuesKey: {
Type: schema.TypeList,
Description: "Holds the mapping of source values to parent key to be imported.",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
RepositoryKey: {
Type: schema.TypeList,
Description: "Repository URL.",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
TagsKey: {
Type: schema.TypeList,
Description: "Tags can be used to group charts for enabling/disabling together.",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
}
var specSchema = &schema.Schema{
Type: schema.TypeList,
Description: "Spec for the Helm chart.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
APIVersionKey: {
Type: schema.TypeString,
Description: "The chart API version.",
Computed: true,
},
AppVersionKey: {
Type: schema.TypeString,
Description: "Application version of the chart.",
Computed: true,
},
DeprecatedKey: {
Type: schema.TypeBool,
Description: "Whether this chart is deprecated.",
Computed: true,
},
KubeVersionKey: {
Type: schema.TypeString,
Description: "A SemVer range of compatible Kubernetes versions.",
Computed: true,
},
ReleasedAtKey: {
Type: schema.TypeString,
Description: "Date on which helm chart is released.",
Computed: true,
},
SourcesKey: {
Type: schema.TypeList,
Description: "List of URLs to source code for this project.",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
UrlsKey: {
Type: schema.TypeList,
Description: "List of URLs to download helm chart bundle.",
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
ValuesConfigKey: {
Type: schema.TypeString,
Description: "Default configuration values for this chart.",
Computed: true,
},
DependenciesKey: dependencySchema,
},
},
}