Skip to content

Commit f17e92c

Browse files
committed
WFS and shared types markers added
1 parent bb95a0a commit f17e92c

File tree

2 files changed

+107
-28
lines changed

2 files changed

+107
-28
lines changed

api/v3/shared_types.go

Lines changed: 99 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222
ServiceTypeWFS ServiceType = "WFS"
2323
)
2424

25+
// WMSWFS is the common interface used for both WMS and WFS resources.
2526
// +kubebuilder:object:generate=false
2627
type WMSWFS interface {
2728
*WFS | *WMS
@@ -35,86 +36,165 @@ type WMSWFS interface {
3536
HasPostgisData() bool
3637
// Sha1 hash of the objects name
3738
ID() string
39+
// URLPath returns the configured service URL
3840
URLPath() string
3941

4042
GeoPackages() []*Gpkg
4143
}
4244

45+
// Mapfile references a ConfigMap key where an external mapfile is stored.
46+
// +kubebuilder:validation:Type=object
4347
type Mapfile struct {
4448
ConfigMapKeyRef corev1.ConfigMapKeySelector `json:"configMapKeyRef"`
4549
}
4650

51+
// Options configures optional behaviors of the operator, like ingress, casing, and data prefetching.
52+
// +kubebuilder:validation:Type=object
4753
type Options struct {
54+
// IncludeIngress dictates whether to deploy an Ingress or ensure none exists.
4855
// +kubebuilder:default:=true
4956
IncludeIngress bool `json:"includeIngress"`
5057

58+
// AutomaticCasing enables automatic conversion from snake_case to camelCase.
5159
// +kubebuilder:default:=true
5260
AutomaticCasing bool `json:"automaticCasing"`
5361

62+
// ValidateRequests enables request validation against the service schema.
5463
// +kubebuilder:default:=true
5564
ValidateRequests *bool `json:"validateRequests,omitempty"`
5665

66+
// RewriteGroupToDataLayers merges group layers into individual data layers.
5767
// +kubebuilder:default:=false
5868
RewriteGroupToDataLayers *bool `json:"rewriteGroupToDataLayers,omitempty"`
5969

70+
// DisableWebserviceProxy disables the built-in proxy for external web services.
6071
// +kubebuilder:default:=false
6172
DisableWebserviceProxy *bool `json:"disableWebserviceProxy,omitempty"`
6273

74+
// Whether to prefetch data from blob storage, and store it on the local filesystem.
75+
// If `false`, the data will be served directly out of blob storage
6376
// +kubebuilder:default:=true
6477
PrefetchData *bool `json:"prefetchData,omitempty"`
6578

79+
// ValidateChildStyleNameEqual ensures child style names match the parent style.
80+
// +kubebuilder:default=false
6681
ValidateChildStyleNameEqual *bool `json:"validateChildStyleNameEqual,omitempty"`
6782
}
6883

84+
// Inspire holds INSPIRE-specific metadata for the service.
85+
// +kubebuilder:validation:Type=object
6986
type Inspire struct {
70-
ServiceMetadataURL MetadataURL `json:"serviceMetadataUrl"`
71-
SpatialDatasetIdentifier string `json:"spatialDatasetIdentifier"`
72-
Language string `json:"language"`
87+
// ServiceMetadataURL references the CSW or custom metadata record.
88+
ServiceMetadataURL MetadataURL `json:"serviceMetadataUrl"`
89+
90+
// SpatialDatasetIdentifier is the ID uniquely identifying the dataset.
91+
SpatialDatasetIdentifier string `json:"spatialDatasetIdentifier"`
92+
93+
// Language of the INSPIRE metadata record (e.g., "nl" or "en").
94+
Language string `json:"language"`
7395
}
7496

7597
type MetadataURL struct {
76-
CSW *Metadata `json:"csw"`
77-
Custom *Custom `json:"custom,omitempty"`
98+
// CSW describes a metadata record via a metadataIdentifier (UUID).
99+
CSW *Metadata `json:"csw"`
100+
101+
// Custom allows arbitrary href
102+
Custom *Custom `json:"custom,omitempty"`
78103
}
79104

105+
// Metadata holds the UUID of a CSW metadata record
80106
type Metadata struct {
107+
// MetadataIdentifier is the record's UUID
108+
// +kubebuilder:validation:Format:=uuid
109+
// +kubebuilder:validation:MinLength:=1
81110
MetadataIdentifier string `json:"metadataIdentifier"`
82111
}
83112

113+
// Custom represents a non-CSW metadata link with an href and MIME type.
114+
// +kubebuilder:validation:Schemaless
115+
// +kubebuilder:pruning:PreserveUnknownFields
116+
// +kubebuilder:validation:Type=object
84117
type Custom struct {
118+
// +kubebuilder:validation:Pattern=`^https?://.*$`
119+
// +kubebuilder:validation:MinLength=1
85120
Href string `json:"href"`
86121
Type string `json:"type"`
87122
}
88123

124+
// Data holds the data source configuration
125+
// +kubebuilder:validation:XValidation:rule="has(self.gpkg) || has(self.tif) || has(self.postgis)", message="Atleast one of the datasource should be provided (postgis, gpkg, tif)"
89126
type Data struct {
90-
Gpkg *Gpkg `json:"gpkg,omitempty"`
127+
// Gpkg configures a GeoPackage file source
128+
Gpkg *Gpkg `json:"gpkg,omitempty"`
129+
130+
// Postgis configures a Postgis table source
91131
Postgis *Postgis `json:"postgis,omitempty"`
92-
TIF *TIF `json:"tif,omitempty"`
132+
133+
// TIF configures a GeoTIF raster source
134+
TIF *TIF `json:"tif,omitempty"`
93135
}
94136

137+
// Gpkg configures a Geopackage data source
138+
// +kubebuilder:validation:Type=object
95139
type Gpkg struct {
96-
BlobKey string `json:"blobKey"`
97-
TableName string `json:"tableName"`
98-
GeometryType string `json:"geometryType"`
99-
Columns []Column `json:"columns"`
140+
// Blobkey identifies the location/bucket of the .gpkg file
141+
// +kubebuilder:validation:Pattern=`\.gpkg$`
142+
BlobKey string `json:"blobKey"`
143+
144+
// TableName is the table within the geopackage
145+
// +kubebuilder:validation:MinLength:=1
146+
TableName string `json:"tableName"`
147+
148+
// GeometryType of the table, must match an OGC type
149+
// +kubebuilder:validation:Pattern:=`^(Multi)?(Point|LineString|Polygon)$`
150+
GeometryType string `json:"geometryType"`
151+
152+
// Columns to visualize for this table
153+
// +kubebuilder:validation:MinItems:=1
154+
Columns []Column `json:"columns"`
100155
}
101156

102157
// Postgis - reference to table in a Postgres database
158+
// +kubebuilder:validation:Type=object
103159
type Postgis struct {
104-
TableName string `json:"tableName"`
105-
GeometryType string `json:"geometryType"`
106-
Columns []Column `json:"columns"`
160+
// TableName in postGIS
161+
// +kubebuilder:validation:MinLength=1
162+
TableName string `json:"tableName"`
163+
164+
// GeometryType of the table
165+
// +kubebuilder:validation:Pattern=`^(Multi)?(Point|LineString|Polygon)$`
166+
GeometryType string `json:"geometryType"`
167+
168+
// Columns to expose from table
169+
// +kubebuilder:validation:MinItems=1
170+
Columns []Column `json:"columns"`
107171
}
108172

173+
// TIF configures a GeoTIFF raster data source
174+
// +kubebuilder:validation:Type=object
109175
type TIF struct {
110-
BlobKey string `json:"blobKey"`
111-
Resample *string `json:"resample,omitempty"`
112-
Offsite *string `json:"offsite,omitempty"`
113-
GetFeatureInfoIncludesClass *bool `json:"getFeatureInfoIncludesClass,omitempty"`
176+
// BlobKey to the TIFF file
177+
// +kubebuilder:validation:Pattern=`\.(tif|tiff)$`
178+
BlobKey string `json:"blobKey"`
179+
180+
// Resample method
181+
Resample *string `json:"resample,omitempty"`
182+
183+
// Offsite color for nodata removal
184+
Offsite *string `json:"offsite,omitempty"`
185+
186+
// Include class names in GetFeatureInfo responses
187+
GetFeatureInfoIncludesClass *bool `json:"getFeatureInfoIncludesClass,omitempty"`
114188
}
115189

190+
// Column maps a source column name to an optional alias for output.
191+
// +kubebuilder:validation:Type=object
116192
type Column struct {
117-
Name string `json:"name"`
193+
// Name of the column in the data source.
194+
// +kubebuilder:validation:MinLength=1
195+
Name string `json:"name"`
196+
197+
// Alias for the column in the service output.
118198
Alias *string `json:"alias,omitempty"`
119199
}
120200

api/v3/wfs_types.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,16 @@ func init() {
6868
type WFSSpec struct {
6969
// Optional lifecycle settings
7070
Lifecycle *shared_model.Lifecycle `json:"lifecycle,omitempty"`
71+
7172
// +kubebuilder:validation:Type=object
7273
// +kubebuilder:validation:Schemaless
7374
// +kubebuilder:pruning:PreserveUnknownFields
7475
// Optional strategic merge patch for the pod in the deployment. E.g. to patch the resources or add extra env vars.
75-
7676
PodSpecPatch *corev1.PodSpec `json:"podSpecPatch,omitempty"`
7777
HorizontalPodAutoscalerPatch *autoscalingv2.HorizontalPodAutoscalerSpec `json:"horizontalPodAutoscalerPatch,omitempty"`
7878
Options Options `json:"options,omitempty"`
7979

8080
// service configuration
81-
// +kubebuilder:validation:Required
8281
Service WFSService `json:"service"`
8382
}
8483

@@ -92,14 +91,12 @@ type WFSService struct {
9291
URL string `json:"url"`
9392

9493
// check for Inspire services
95-
// +kubebuilder:default="false"
9694
Inspire *Inspire `json:"inspire,omitempty"`
9795

9896
// External Mapfile reference
9997
Mapfile *Mapfile `json:"mapfile,omitempty"`
10098

10199
// Reference to OwnerInfo CR
102-
// TODO no webhook yet?
103100
// +kubebuilder:validation:MinLength:=1
104101
OwnerInfoRef string `json:"ownerInfoRef"`
105102

@@ -150,7 +147,6 @@ type Bbox struct {
150147
}
151148

152149
// FeatureType defines a WFS feature
153-
// +kubebuilder:validation:Required
154150
type FeatureType struct {
155151
// Name of the feature
156152
// +kubebuilder:validation:MinLength:=1
@@ -177,15 +173,18 @@ type FeatureType struct {
177173
// +kubebuilder:validation:Type:=object
178174
Bbox *FeatureBbox `json:"bbox,omitempty"`
179175

180-
// Featuretype data connection
181-
// +kubebuilder:validation:Required
176+
// FeatureType data connection
182177
Data Data `json:"data"`
183178
}
184179

180+
// FeatureType bounding box, if provided it overrides the default extent
185181
type FeatureBbox struct {
182+
// DefaultCRS defines the feature’s bounding box in the service’s own CRS
186183
//nolint:tagliatelle
187-
DefaultCRS shared_model.BBox `json:"defaultCRS"`
188-
WGS84 *shared_model.BBox `json:"wgs84,omitempty"`
184+
DefaultCRS shared_model.BBox `json:"defaultCRS"`
185+
186+
// WGS84, if provided, gives the same bounding box reprojected into EPSG:4326.
187+
WGS84 *shared_model.BBox `json:"wgs84,omitempty"`
189188
}
190189

191190
func (wfs *WFS) HasPostgisData() bool {

0 commit comments

Comments
 (0)