Skip to content

Commit 1420641

Browse files
author
CloudNativePG Automated Updates
committed
chore: sync API
1 parent aa4db1f commit 1420641

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed

pkg/api/v1/database_types.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ type DatabaseSpec struct {
173173
// The list of extensions to be managed in the database
174174
// +optional
175175
Extensions []ExtensionSpec `json:"extensions,omitempty"`
176+
177+
// The list of foreign data wrappers to be managed in the database
178+
// +optional
179+
FDWs []FDWSpec `json:"fdws,omitempty"`
176180
}
177181

178182
// DatabaseObjectSpec contains the fields which are common to every
@@ -220,6 +224,74 @@ type ExtensionSpec struct {
220224
Schema string `json:"schema,omitempty"`
221225
}
222226

227+
// FDWSpec configures an Foreign Data Wrapper in a database
228+
type FDWSpec struct {
229+
// Common fields
230+
DatabaseObjectSpec `json:",inline"`
231+
232+
// Name of the handler function (e.g., "postgres_fdw_handler").
233+
// This will be empty if no handler is specified. In that case,
234+
// the default handler is registered when the FDW extension is created.
235+
// +optional
236+
Handler string `json:"handler,omitempty"`
237+
238+
// Name of the validator function (e.g., "postgres_fdw_validator").
239+
// This will be empty if no validator is specified. In that case,
240+
// the default validator is registered when the FDW extension is created.
241+
// +optional
242+
Validator string `json:"validator,omitempty"`
243+
244+
// Owner specifies the database role that will own the Foreign Data Wrapper.
245+
// The role must have superuser privileges in the target database.
246+
// +optional
247+
Owner string `json:"owner,omitempty"`
248+
249+
// Options specifies the configuration options for the FDW
250+
// (key is the option name, value is the option value).
251+
// +optional
252+
Options []OptionSpec `json:"options,omitempty"`
253+
254+
// List of roles for which `USAGE` privileges on the FDW are granted or revoked.
255+
// +optional
256+
Usages []UsageSpec `json:"usage,omitempty"`
257+
}
258+
259+
// OptionSpec holds the name, value and the ensure field for an option
260+
type OptionSpec struct {
261+
// Name of the option
262+
Name string `json:"name"`
263+
264+
// Value and ensure field of the option
265+
OptionSpecValue `json:",inline"`
266+
}
267+
268+
// OptionSpecValue holds the value and the ensure field for an option
269+
type OptionSpecValue struct {
270+
// Value of the option
271+
Value string `json:"value"`
272+
273+
// Specifies whether an option should be present or absent in
274+
// the database. If set to `present`, the option will be
275+
// created if it does not exist. If set to `absent`, the
276+
// option will be removed if it exists.
277+
// +kubebuilder:default:="present"
278+
// +kubebuilder:validation:Enum=present;absent
279+
// +optional
280+
Ensure EnsureOption `json:"ensure,omitempty"`
281+
}
282+
283+
// UsageSpec configures a usage for a foreign data wrapper
284+
type UsageSpec struct {
285+
// Name of the usage
286+
Name string `json:"name"`
287+
288+
// The type of usage
289+
// +kubebuilder:default:="grant"
290+
// +kubebuilder:validation:Enum=grant;revoke
291+
// +optional
292+
Type string `json:"type,omitempty"`
293+
}
294+
223295
// DatabaseStatus defines the observed state of Database
224296
type DatabaseStatus struct {
225297
// A sequence number representing the latest
@@ -242,6 +314,10 @@ type DatabaseStatus struct {
242314
// Extensions is the status of the managed extensions
243315
// +optional
244316
Extensions []DatabaseObjectStatus `json:"extensions,omitempty"`
317+
318+
// FDWs is the status of the managed FDWs
319+
// +optional
320+
FDWs []DatabaseObjectStatus `json:"fdws,omitempty"`
245321
}
246322

247323
// DatabaseObjectStatus is the status of the managed database objects

pkg/api/v1/zz_generated.deepcopy.go

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)