pub struct ResourceUpdate {
pub name: String,
pub collection: Option<String>,
pub enabled: Option<bool>,
pub description: Option<String>,
pub config: Value,
pub backup_config: Option<Value>,
/* private fields */
}Expand description
One resource to update, an item of the signature-checked array PUT
(capture C3a, Decision D3). The signature is PRIVATE and always
serialized, so an update without one cannot be built: construction
goes through ResourceUpdate::new or ResourceUpdate::from_record,
both of which refuse an empty signature as
resource_signature_rejected (missing) before any request exists.
The signature must be the one of the copy being updated (D7: copies in different collections carry different signatures), read just before the write; every successful write rotates it.
Fields§
§name: StringThe resource name; an update of an unknown name is a bare 404 (D10).
collection: Option<String>Collection of the copy being updated.
enabled: Option<bool>enabled.
description: Option<String>description.
config: ValueThe new resource config.
backup_config: Option<Value>backupConfig.
Implementations§
Source§impl ResourceUpdate
impl ResourceUpdate
Sourcepub fn new(
name: impl Into<String>,
signature: impl Into<String>,
config: Value,
) -> Result<Self, CoreError>
pub fn new( name: impl Into<String>, signature: impl Into<String>, config: Value, ) -> Result<Self, CoreError>
An update of name carrying signature and the new config.
An empty or whitespace-only signature is
resource_signature_rejected (missing); an empty name is
invalid_input. Both are refused before any request.
Sourcepub fn from_record(record: &ResourceRecord) -> Result<Self, CoreError>
pub fn from_record(record: &ResourceRecord) -> Result<Self, CoreError>
An update seeded from a record just read: its name, signature,
collection, enabled, description, config and backupConfig.
A record without a signature is resource_signature_rejected
(missing); one without a name (a singleton) is invalid_input.
Every capture of a PUT body (C3a) carries only name, signature,
description and config. Whether the gateway accepts collection,
enabled and backupConfig on a PUT, and which copy a collection-less
PUT updates, is NOT settled by any capture: the 20-06 live gate
updates with ResourceUpdate::new only. The live section that
exercises this constructor (two copies present, one update per copy)
is written but has not been run against a gateway yet (20-REVIEW
WR-03), so until it has, treat the extra keys as unproven and prefer
ResourceUpdate::new with ResourceUpdate::with_collection only
when a copy must be targeted.
Sourcepub fn with_collection(self, collection: impl Into<String>) -> Self
pub fn with_collection(self, collection: impl Into<String>) -> Self
Target a collection.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Set enabled.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set description.
Sourcepub fn with_backup_config(self, backup_config: Value) -> Self
pub fn with_backup_config(self, backup_config: Value) -> Self
Set backupConfig.