Skip to content

Commit

Permalink
chore: sync API
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudNativePG Automated Updates committed Dec 4, 2024
1 parent d77f49d commit 9201354
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions pkg/api/v1/database_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const (
)

// DatabaseSpec is the specification of a Postgresql Database
// +kubebuilder:validation:XValidation:rule="!has(self.builtinLocale) || self.localeProvider == 'builtin'",message="builtinLocale is only available when localeProvider is set to `builtin`"
// +kubebuilder:validation:XValidation:rule="!has(self.icuLocale) || self.localeProvider == 'icu'",message="icuLocale is only available when localeProvider is set to `icu`"
// +kubebuilder:validation:XValidation:rule="!has(self.icuRules) || self.localeProvider == 'icu'",message="icuRules is only available when localeProvider is set to `icu`"
type DatabaseSpec struct {
// The corresponding cluster
ClusterRef corev1.LocalObjectReference `json:"cluster"`
Expand Down Expand Up @@ -67,44 +70,56 @@ type DatabaseSpec struct {
Encoding string `json:"encoding,omitempty"`

// The locale (cannot be changed)
// Sets the default collation order and character classification in the new database.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale is immutable"
// +optional
Locale string `json:"locale,omitempty"`

// The locale provider (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="locale_provider is immutable"
// The LOCALE_PROVIDER (cannot be changed)
// This option sets the locale provider for databases created in the new cluster.
// Available from PostgreSQL 16.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeProvider is immutable"
// +optional
LocaleProvider string `json:"locale_provider,omitempty"`
LocaleProvider string `json:"localeProvider,omitempty"`

// The LC_COLLATE (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_collate is immutable"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCollate is immutable"
// +optional
LcCollate string `json:"lc_collate,omitempty"`
LcCollate string `json:"localeCollate,omitempty"`

// The LC_CTYPE (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="lc_ctype is immutable"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="localeCType is immutable"
// +optional
LcCtype string `json:"lc_ctype,omitempty"`
LcCtype string `json:"localeCType,omitempty"`

// The ICU_LOCALE (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_locale is immutable"
// Specifies the ICU locale when the ICU provider is used.
// This option requires `localeProvider` to be set to `icu`.
// Available from PostgreSQL 15.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuLocale is immutable"
// +optional
IcuLocale string `json:"icu_locale,omitempty"`
IcuLocale string `json:"icuLocale,omitempty"`

// The ICU_RULES (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icu_rules is immutable"
// Specifies additional collation rules to customize the behavior of the default collation.
// This option requires `localeProvider` to be set to `icu`.
// Available from PostgreSQL 16.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="icuRules is immutable"
// +optional
IcuRules string `json:"icu_rules,omitempty"`
IcuRules string `json:"icuRules,omitempty"`

// The BUILTIN_LOCALE (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtin_locale is immutable"
// Specifies the locale name when the builtin provider is used.
// This option requires `localeProvider` to be set to `builtin`.
// Available from PostgreSQL 17.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="builtinLocale is immutable"
// +optional
BuiltinLocale string `json:"builtin_locale,omitempty"`
BuiltinLocale string `json:"builtinLocale,omitempty"`

// The COLLATION_VERSION (cannot be changed)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collation_version is immutable"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="collationVersion is immutable"
// +optional
CollationVersion string `json:"collation_version,omitempty"`
CollationVersion string `json:"collationVersion,omitempty"`

// True when the database is a template
// +optional
Expand Down

0 comments on commit 9201354

Please sign in to comment.