-
Notifications
You must be signed in to change notification settings - Fork 1
/
ApiObject.go
294 lines (253 loc) · 6.44 KB
/
ApiObject.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
package cdk8s
import (
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
_init_ "github.com/cdk8s-team/cdk8s-core-go/cdk8s/jsii"
"github.com/aws/constructs-go/constructs/v3"
"github.com/cdk8s-team/cdk8s-core-go/cdk8s/internal"
)
type ApiObject interface {
constructs.Construct
// The group portion of the API version (e.g. `authorization.k8s.io`).
ApiGroup() *string
// The object's API version (e.g. `authorization.k8s.io/v1`).
ApiVersion() *string
// The chart in which this object is defined.
Chart() Chart
// The object kind.
Kind() *string
// Metadata associated with this API object.
Metadata() ApiObjectMetadataDefinition
// The name of the API object.
//
// If a name is specified in `metadata.name` this will be the name returned.
// Otherwise, a name will be generated by calling
// `Chart.of(this).generatedObjectName(this)`, which by default uses the
// construct path to generate a DNS-compatible name for the resource.
Name() *string
// Create a dependency between this ApiObject and other constructs.
//
// These can be other ApiObjects, Charts, or custom.
AddDependency(dependencies ...constructs.IConstruct)
// Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object.
//
// Example:
// kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true));
//
AddJsonPatch(ops ...JsonPatch)
// Perform final modifications before synthesis.
//
// This method can be implemented by derived constructs in order to perform
// final changes before synthesis. prepare() will be called after child
// constructs have been prepared.
//
// This is an advanced framework feature. Only use this if you
// understand the implications.
OnPrepare()
// Allows this construct to emit artifacts into the cloud assembly during synthesis.
//
// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
// as they participate in synthesizing the cloud assembly.
OnSynthesize(session constructs.ISynthesisSession)
// Validate the current construct.
//
// This method can be implemented by derived constructs in order to perform
// validation logic. It is called on all constructs before synthesis.
//
// Returns: An array of validation error messages, or an empty array if there the construct is valid.
// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
// instead of overriding this method.
OnValidate() *[]*string
// Renders the object to Kubernetes JSON.
//
// To disable sorting of dictionary keys in output object set the
// `CDK8S_DISABLE_SORT` environment variable to any non-empty value.
ToJson() interface{}
// Returns a string representation of this construct.
ToString() *string
}
// The jsii proxy struct for ApiObject
type jsiiProxy_ApiObject struct {
internal.Type__constructsConstruct
}
func (j *jsiiProxy_ApiObject) ApiGroup() *string {
var returns *string
_jsii_.Get(
j,
"apiGroup",
&returns,
)
return returns
}
func (j *jsiiProxy_ApiObject) ApiVersion() *string {
var returns *string
_jsii_.Get(
j,
"apiVersion",
&returns,
)
return returns
}
func (j *jsiiProxy_ApiObject) Chart() Chart {
var returns Chart
_jsii_.Get(
j,
"chart",
&returns,
)
return returns
}
func (j *jsiiProxy_ApiObject) Kind() *string {
var returns *string
_jsii_.Get(
j,
"kind",
&returns,
)
return returns
}
func (j *jsiiProxy_ApiObject) Metadata() ApiObjectMetadataDefinition {
var returns ApiObjectMetadataDefinition
_jsii_.Get(
j,
"metadata",
&returns,
)
return returns
}
func (j *jsiiProxy_ApiObject) Name() *string {
var returns *string
_jsii_.Get(
j,
"name",
&returns,
)
return returns
}
// Defines an API object.
func NewApiObject(scope constructs.Construct, id *string, props *ApiObjectProps) ApiObject {
_init_.Initialize()
if err := validateNewApiObjectParameters(scope, id, props); err != nil {
panic(err)
}
j := jsiiProxy_ApiObject{}
_jsii_.Create(
"cdk8s.ApiObject",
[]interface{}{scope, id, props},
&j,
)
return &j
}
// Defines an API object.
func NewApiObject_Override(a ApiObject, scope constructs.Construct, id *string, props *ApiObjectProps) {
_init_.Initialize()
_jsii_.Create(
"cdk8s.ApiObject",
[]interface{}{scope, id, props},
a,
)
}
// Return whether the given object is an `ApiObject`.
//
// We do attribute detection since we can't reliably use 'instanceof'.
func ApiObject_IsApiObject(o interface{}) *bool {
_init_.Initialize()
if err := validateApiObject_IsApiObjectParameters(o); err != nil {
panic(err)
}
var returns *bool
_jsii_.StaticInvoke(
"cdk8s.ApiObject",
"isApiObject",
[]interface{}{o},
&returns,
)
return returns
}
// Returns the `ApiObject` named `Resource` which is a child of the given construct.
//
// If `c` is an `ApiObject`, it is returned directly. Throws an
// exception if the construct does not have a child named `Default` _or_ if
// this child is not an `ApiObject`.
func ApiObject_Of(c constructs.IConstruct) ApiObject {
_init_.Initialize()
if err := validateApiObject_OfParameters(c); err != nil {
panic(err)
}
var returns ApiObject
_jsii_.StaticInvoke(
"cdk8s.ApiObject",
"of",
[]interface{}{c},
&returns,
)
return returns
}
func (a *jsiiProxy_ApiObject) AddDependency(dependencies ...constructs.IConstruct) {
args := []interface{}{}
for _, a := range dependencies {
args = append(args, a)
}
_jsii_.InvokeVoid(
a,
"addDependency",
args,
)
}
func (a *jsiiProxy_ApiObject) AddJsonPatch(ops ...JsonPatch) {
args := []interface{}{}
for _, a := range ops {
args = append(args, a)
}
_jsii_.InvokeVoid(
a,
"addJsonPatch",
args,
)
}
func (a *jsiiProxy_ApiObject) OnPrepare() {
_jsii_.InvokeVoid(
a,
"onPrepare",
nil, // no parameters
)
}
func (a *jsiiProxy_ApiObject) OnSynthesize(session constructs.ISynthesisSession) {
if err := a.validateOnSynthesizeParameters(session); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
a,
"onSynthesize",
[]interface{}{session},
)
}
func (a *jsiiProxy_ApiObject) OnValidate() *[]*string {
var returns *[]*string
_jsii_.Invoke(
a,
"onValidate",
nil, // no parameters
&returns,
)
return returns
}
func (a *jsiiProxy_ApiObject) ToJson() interface{} {
var returns interface{}
_jsii_.Invoke(
a,
"toJson",
nil, // no parameters
&returns,
)
return returns
}
func (a *jsiiProxy_ApiObject) ToString() *string {
var returns *string
_jsii_.Invoke(
a,
"toString",
nil, // no parameters
&returns,
)
return returns
}