pub struct PostgresPolicySpec {Show 13 fields
pub connection: ConnectionSpec,
pub interval: String,
pub suspend: bool,
pub mode: PolicyMode,
pub reconciliation_mode: CrdReconciliationMode,
pub default_owner: Option<String>,
pub profiles: HashMap<String, ProfileSpec>,
pub schemas: Vec<SchemaBinding>,
pub roles: Vec<RoleSpec>,
pub grants: Vec<Grant>,
pub default_privileges: Vec<DefaultPrivilege>,
pub memberships: Vec<Membership>,
pub retirements: Vec<RoleRetirement>,
}Expand description
Spec for a PostgresPolicy custom resource.
Defines the desired state of PostgreSQL roles, grants, default privileges, and memberships for a single database connection.
Fields§
§connection: ConnectionSpecDatabase connection configuration.
interval: StringReconciliation interval (e.g. “5m”, “1h”). Defaults to “5m”.
suspend: boolSuspend reconciliation when true. Defaults to false.
mode: PolicyModeReconciliation mode: apply executes SQL, plan computes drift only.
reconciliation_mode: CrdReconciliationModeConvergence strategy: how aggressively to converge the database.
authoritative(default): full convergence — anything not in the manifest is revoked/dropped.additive: only grant, never revoke — safe for incremental adoption.adopt: manage declared roles fully, but never drop undeclared roles.
default_owner: Option<String>Default owner for ALTER DEFAULT PRIVILEGES (e.g. “app_owner”).
profiles: HashMap<String, ProfileSpec>Reusable privilege profiles.
schemas: Vec<SchemaBinding>Schema bindings that expand profiles into concrete roles/grants.
roles: Vec<RoleSpec>One-off role definitions.
grants: Vec<Grant>One-off grants.
default_privileges: Vec<DefaultPrivilege>One-off default privileges.
memberships: Vec<Membership>Membership edges.
retirements: Vec<RoleRetirement>Explicit role-retirement workflows for roles that should be removed.
Implementations§
Source§impl PostgresPolicySpec
impl PostgresPolicySpec
pub fn validate_password_specs( &self, policy_name: &str, ) -> Result<(), PasswordValidationError>
Sourcepub fn referenced_secret_names(&self, policy_name: &str) -> BTreeSet<String>
pub fn referenced_secret_names(&self, policy_name: &str) -> BTreeSet<String>
All Kubernetes Secret names referenced by this spec.
Includes the connection Secret, password secretRef Secrets, and
generated password Secrets. Used by the controller to trigger
reconciliation when any of these Secrets change (or are deleted).
Source§impl PostgresPolicySpec
impl PostgresPolicySpec
Sourcepub fn to_policy_manifest(&self) -> PolicyManifest
pub fn to_policy_manifest(&self) -> PolicyManifest
Convert the CRD spec into a PolicyManifest for use with the core library.
Sourcepub fn ownership_claims(&self) -> Result<OwnershipClaims, ManifestError>
pub fn ownership_claims(&self) -> Result<OwnershipClaims, ManifestError>
Derive a conservative ownership claim set from the policy spec.
This intentionally claims all declared/expanded roles and all referenced schemas so overlapping policies are rejected safely.
Trait Implementations§
Source§impl Clone for PostgresPolicySpec
impl Clone for PostgresPolicySpec
Source§fn clone(&self) -> PostgresPolicySpec
fn clone(&self) -> PostgresPolicySpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PostgresPolicySpec
impl Debug for PostgresPolicySpec
Source§impl<'de> Deserialize<'de> for PostgresPolicySpec
impl<'de> Deserialize<'de> for PostgresPolicySpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for PostgresPolicySpec
impl JsonSchema for PostgresPolicySpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for PostgresPolicySpec
impl RefUnwindSafe for PostgresPolicySpec
impl Send for PostgresPolicySpec
impl Sync for PostgresPolicySpec
impl Unpin for PostgresPolicySpec
impl UnsafeUnpin for PostgresPolicySpec
impl UnwindSafe for PostgresPolicySpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request