Skip to content

Commit b194b58

Browse files
committed
wip
1 parent 96cb7e5 commit b194b58

File tree

7 files changed

+167
-340
lines changed

7 files changed

+167
-340
lines changed

api/v3/shared_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ type Postgis struct {
196196

197197
// GeometryType of the table
198198
// +kubebuilder:validation:Pattern=`^(Multi)?(Point|LineString|Polygon)$`
199-
// +kubebuilder:validation:MinLength:=1
200199
GeometryType string `json:"geometryType"`
201200

202201
// Columns to expose from table

api/v3/wms_types.go

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,36 @@ const (
4848
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
4949
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
5050

51+
// +kubebuilder:object:root=true
52+
// +kubebuilder:storageversion
53+
// +kubebuilder:conversion:hub
54+
// +kubebuilder:subresource:status
55+
// versionName=v3
56+
// +kubebuilder:resource:categories=pdok
57+
// +kubebuilder:resource:path=wms
58+
59+
// WMS is the Schema for the wms API.
60+
type WMS struct {
61+
metav1.TypeMeta `json:",inline"`
62+
metav1.ObjectMeta `json:"metadata,omitempty"`
63+
64+
Spec WMSSpec `json:"spec"`
65+
Status smoothoperatormodel.OperatorStatus `json:"status,omitempty"`
66+
}
67+
68+
// +kubebuilder:object:root=true
69+
70+
// WMSList contains a list of WMS.
71+
type WMSList struct {
72+
metav1.TypeMeta `json:",inline"`
73+
metav1.ListMeta `json:"metadata,omitempty"`
74+
Items []WMS `json:"items"`
75+
}
76+
77+
func init() {
78+
SchemeBuilder.Register(&WMS{}, &WMSList{})
79+
}
80+
5181
// WMSSpec defines the desired state of WMS.
5282
// +kubebuilder:validation:XValidation:rule="!has(self.ingressRouteUrls) || self.ingressRouteUrls.exists_one(x, x.url == self.service.url)",messageExpression="'ingressRouteUrls should include service.url '+self.service.url"
5383
type WMSSpec struct {
@@ -145,9 +175,11 @@ func (wmsService WMSService) KeywordsIncludingInspireKeyword() []string {
145175

146176
// HealthCheck is the struct with all fields to configure custom healthchecks
147177
// +kubebuilder:validation:XValidation:rule="!has(self.querystring) || has(self.mimetype)",message="mimetype is required when a querystring is used"
148-
// +kubebuilder:validation:XValidation:rule="(has(self.boundingbox) || has(self.querystring)) && !(has(self.querystring) && has(self.boundingbox))", message="healthcheck should have querystring + mimetype or boundingbox, not both"
178+
// +kubebuilder:validation:XValidation:rule="(has(self.boundingbox) || has(self.querystring)) && !(has(self.querystring) && has(self.boundingbox))", message="healthcheck should have exactly 1 of querystring + mimetype or boundingbox"
179+
// +kubebuilder:validation:XValidation:rule="(has(self.boundingbox) || has(self.mimetype)) && !(has(self.mimetype) && has(self.boundingbox))", message="healthcheck should have exactly 1 of querystring + mimetype or boundingbox"
149180
type HealthCheckWMS struct {
150-
// +kubebuilder:validation:MinLength:=1
181+
// +kubebuilder:validation:XValidation:rule="self.contains('Service=WMS')",message="a valid healthcheck contains 'Service=WMS'"
182+
// +kubebuilder:validation:XValidation:rule="self.contains('Request=')",message="a valid healthcheck contains 'Request='"
151183
Querystring *string `json:"querystring,omitempty"`
152184
// +kubebuilder:validation:Pattern=(image/png|text/xml|text/html)
153185
Mimetype *string `json:"mimetype,omitempty"`
@@ -157,52 +189,51 @@ type HealthCheckWMS struct {
157189

158190
// +kubebuilder:validation:XValidation:message="Either blobKeys or configMapRefs is required",rule="has(self.blobKeys) || has(self.configMapRefs)"
159191
type StylingAssets struct {
160-
// +kubebuilder:validations:MinItems:=1
192+
// +kubebuilder:validation:MinItems:=1
161193
BlobKeys []string `json:"blobKeys,omitempty"`
162194

163-
// +kubebuilder:validations:MinItems:=1
195+
// +kubebuilder:validation:MinItems:=1
164196
ConfigMapRefs []ConfigMapRef `json:"configMapRefs,omitempty"`
165197
}
166198

167199
type ConfigMapRef struct {
168-
// +kubebuilder:validations:MinLength:=1
200+
// +kubebuilder:validation:MinLength:=1
169201
Name string `json:"name"`
170202

171-
// +kubebuilder:validations:MinItems:=1
203+
// +kubebuilder:validation:MinItems:=1
172204
Keys []string `json:"keys,omitempty"`
173205
}
174206

175-
// +kubebuilder:validation:XValidation:message="A layer should have sublayers or data, not both", rule="(has(self.data) || has(self.layers)) && !(has(self.data) && has(self.layers))"
207+
// +kubebuilder:validation:XValidation:message="A layer should have exactly one of sublayers or data", rule="(has(self.data) || has(self.layers)) && !(has(self.data) && has(self.layers))"
176208
// +kubebuilder:validation:XValidation:message="A layer with data attribute should have styling", rule="!has(self.data) || has(self.styles)"
177209
// +kubebuilder:validation:XValidation:message="A layer should have keywords when visible", rule="!self.visible || has(self.keywords)"
178210
// +kubebuilder:validation:XValidation:message="A layer should have a title when visible", rule="!self.visible || has(self.title)"
179211
// +kubebuilder:validation:XValidation:message="A layer should have an abstract when visible", rule="!self.visible || has(self.abstract)"
180-
// +kubebuilder:validation:XValidation:message="A layer should have an authority when visible and has a name", rule="!(self.visible && has(self.name)) || has(self.authority)"
181-
// +kubebuilder:validation:XValidation:message="A layer should have a datasetMetadataUrl when visible and has a name", rule="!(self.visible && has(self.name)) || has(self.datasetMetadataUrl)"
182212
type Layer struct {
183213
// Name of the layer, required for layers on the 2nd or 3rd level
184-
// +kubebuilder:validations:MinLength:=1
214+
// +kubebuilder:validation:MinLength:=1
185215
Name *string `json:"name,omitempty"`
186216

187217
// Title of the layer
188-
// +kubebuilder:validations:MinLength:=1
218+
// +kubebuilder:validation:MinLength:=1
189219
Title *string `json:"title,omitempty"`
190220

191221
// Abstract of the layer
192-
// +kubebuilder:validations:MinLength:=1
222+
// +kubebuilder:validation:MinLength:=1
193223
Abstract *string `json:"abstract,omitempty"`
194224

195225
// Keywords of the layer, required if the layer is visible
196-
// +kubebuilder:validations:MinItems:=1
226+
// +kubebuilder:validation:MinItems:=1
227+
// +kubebuilder:validation:items:MinLength:=1
197228
Keywords []string `json:"keywords,omitempty"`
198229

199230
// BoundingBoxes of the layer. If omitted the boundingboxes of the parent layer of the service is used.
200-
// +kubebuilder:validations:MinItems:=1
231+
// +kubebuilder:validation:MinItems:=1
201232
BoundingBoxes []WMSBoundingBox `json:"boundingBoxes,omitempty"`
202233

203234
// Whether or not the layer is visible. At least one of the layers must be visible.
204235
// +kubebuilder:default:=true
205-
Visible bool `json:"visible"`
236+
Visible bool `json:"visible,omitempty"`
206237

207238
// TODO ??
208239
Authority *Authority `json:"authority,omitempty"`
@@ -219,7 +250,7 @@ type Layer struct {
219250
MaxScaleDenominator *string `json:"maxscaledenominator,omitempty"`
220251

221252
// List of styles used by the layer
222-
// +kubebuilder:validations:MinItems:=1
253+
// +kubebuilder:validation:MinItems:=1
223254
Styles []Style `json:"styles,omitempty"`
224255

225256
// Mapfile setting, sets "LABEL_NO_CLIP=ON"
@@ -229,7 +260,8 @@ type Layer struct {
229260
Data *Data `json:"data,omitempty"`
230261

231262
// Sublayers of the layer
232-
// +kubebuilder:validations:MinItems:=1
263+
// +kubebuilder:validation:MinItems:=1
264+
// +kubebuilder:validation:Type=array
233265
Layers []Layer `json:"layers,omitempty"`
234266
}
235267

@@ -256,16 +288,16 @@ type Authority struct {
256288
}
257289

258290
type Style struct {
259-
// +kubebuilder:validations:MinLength:=1
291+
// +kubebuilder:validation:MinLength:=1
260292
Name string `json:"name"`
261293

262-
// +kubebuilder:validations:MinLength:=1
294+
// +kubebuilder:validation:MinLength:=1
263295
Title *string `json:"title,omitempty"`
264296

265-
// +kubebuilder:validations:MinLength:=1
297+
// +kubebuilder:validation:MinLength:=1
266298
Abstract *string `json:"abstract,omitempty"`
267299

268-
// +kubebuilder:validations:MinLength:=1
300+
// +kubebuilder:validation:MinLength:=1
269301
Visualization *string `json:"visualization,omitempty"`
270302

271303
Legend *Legend `json:"legend,omitempty"`
@@ -289,36 +321,6 @@ type Legend struct {
289321
BlobKey string `json:"blobKey"`
290322
}
291323

292-
// +kubebuilder:object:root=true
293-
// +kubebuilder:storageversion
294-
// +kubebuilder:conversion:hub
295-
// +kubebuilder:subresource:status
296-
// versionName=v3
297-
// +kubebuilder:resource:categories=pdok
298-
// +kubebuilder:resource:path=wms
299-
300-
// WMS is the Schema for the wms API.
301-
type WMS struct {
302-
metav1.TypeMeta `json:",inline"`
303-
metav1.ObjectMeta `json:"metadata,omitempty"`
304-
305-
Spec WMSSpec `json:"spec,omitempty"`
306-
Status smoothoperatormodel.OperatorStatus `json:"status,omitempty"`
307-
}
308-
309-
// +kubebuilder:object:root=true
310-
311-
// WMSList contains a list of WMS.
312-
type WMSList struct {
313-
metav1.TypeMeta `json:",inline"`
314-
metav1.ListMeta `json:"metadata,omitempty"`
315-
Items []WMS `json:"items"`
316-
}
317-
318-
func init() {
319-
SchemeBuilder.Register(&WMS{}, &WMSList{})
320-
}
321-
322324
func (wmsService *WMSService) GetBoundingBox() WMSBoundingBox {
323325
var boundingBox *WMSBoundingBox
324326

config/crd/bases/pdok.nl_wfs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,6 @@ spec:
12951295
type: array
12961296
geometryType:
12971297
description: GeometryType of the table
1298-
minLength: 1
12991298
pattern: ^(Multi)?(Point|LineString|Polygon)$
13001299
type: string
13011300
tableName:

0 commit comments

Comments
 (0)