Skip to main content

AmqpConfig

Struct AmqpConfig 

Source
pub struct AmqpConfig {
Show 13 fields pub enabled: bool, pub amqp_url: String, pub exchange: String, pub routing_keys: Vec<String>, pub queue: Option<String>, pub ca_cert: Option<PathBuf>, pub client_cert: Option<PathBuf>, pub client_key: Option<PathBuf>, pub sender_label: String, pub content_template: String, pub thread_id_field: String, pub durable_ack: bool, pub excluded_tools: Vec<String>,
}
Expand description

Generic AMQP 0-9-1 channel configuration (RabbitMQ, Fedora Messaging, etc.).

Subscribes to an exchange via routing keys and lifts each delivery into an inbound ChannelMessage. The mapping from a JSON delivery body to message fields is config-driven (content_template, thread_id_field) so a new source — Anitya, an internal bus, anything publishing JSON — is onboarded by configuration rather than code.

Fields§

§enabled: bool

Whether this channel is active. The runtime only loads channels whose enabled = true. Default: false so an operator who pastes a partial [channels.<type>.<alias>] block doesn’t accidentally bring a channel live before the rest of its config is filled in.

§amqp_url: String

AMQP broker URL. Use amqp:// for plain or amqps:// for TLS (e.g. amqps://fedora:@rabbitmq.fedoraproject.org/%2Fpublic_pubsub).

§exchange: String

Exchange to bind the consumer queue to (e.g. amq.topic).

§routing_keys: Vec<String>

Routing keys to bind. Scope these to the topics of interest; binding # consumes the entire exchange and is almost never what you want.

§queue: Option<String>

Queue name. Leave unset for a server-generated, transient, auto-deleted, exclusive queue. Set a stable name (UUID recommended) only when durable delivery across reconnects is required.

§ca_cert: Option<PathBuf>

Path to the CA certificate bundle for amqps:// connections.

§client_cert: Option<PathBuf>

Path to the client certificate for broker mutual-TLS auth (Fedora Messaging requires a client cert).

§client_key: Option<PathBuf>

Path to the client private key matching client_cert.

§sender_label: String

Value placed in ChannelMessage.sender for every delivery from this source (e.g. anitya). Lets the orchestrator’s self-loop guard and per-channel routing identify the origin.

§content_template: String

Template for the inbound message content. {field} placeholders are interpolated from the JSON delivery body’s top-level keys. When empty, the raw delivery body is used verbatim.

§thread_id_field: String

Dotted path into the JSON delivery body whose value becomes the message thread_ts, correlating replies to the originating event (e.g. message.project.name). Empty disables threading.

§durable_ack: bool

Acknowledgement mode. When true (default), deliveries are acked only after the message is durably handed to the agent loop, giving at-least-once semantics: a crash before hand-off redelivers the event. Set false for at-most-once (broker acks on dispatch), which silently drops in-flight events on crash and is only appropriate for non-side-effecting, drop-on-overload consumers.

§excluded_tools: Vec<String>

Tools excluded from this channel’s tool spec. When set, these tools are not exposed to the model when responding via this channel.

Implementations§

Source§

impl AmqpConfig

Source

pub fn configurable_prefix() -> &'static str

Returns the #[prefix] value for this Configurable struct.

Source

pub fn secret_fields(&self) -> Vec<SecretFieldInfo>

Returns metadata about all #[secret] fields on this struct and nested children.

Source

pub fn secret_field_terminals() -> Vec<&'static str>

Static enumeration of every #[secret] field’s terminal name (snake_case, matching the on-disk TOML key) reachable from this type via #[nested] traversal. Unlike secret_fields(), this requires no instance — the per-struct codegen literals are joined at call time with recursive calls into the inner types’ own secret_field_terminals().

Used by the migration crate’s raw-TOML encrypt walker as the secret-key allowlist. prop_fields()-derived allowlists skip compound (non-Vec) #[secret] fields, so this method is the authoritative source.

Source

pub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>

Encrypt all secret fields in place using the provided store.

Source

pub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<(), Error>

Decrypt all secret fields in place using the provided store.

Source

pub fn set_secret(&mut self, name: &str, value: String) -> Result<(), Error>

Set a secret field by its full dotted name, dispatching to nested children.

Source

pub fn prop_fields(&self) -> Vec<PropFieldInfo>

Returns metadata about all property fields on this struct and nested children.

Source

pub fn get_prop(&self, name: &str) -> Result<String, Error>

Get a property value by its full dotted name, returning it as a display string.

Source

pub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<(), Error>

Set a property value by its full dotted name, parsing from string.

Source

pub fn prop_is_secret(name: &str) -> bool

Check if a property name refers to a secret field (static, no instance needed).

Source

pub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>

Instantiate None nested sections whose prefix matches. Returns the prefixes that were initialized.

Source

pub fn map_key_sections() -> Vec<MapKeySection>

Enumerate every map-keyed (HashMap<String, T>) and list-shaped (Vec<T>) section discoverable from this Configurable’s tree. The dashboard / CLI consume this to surface “+ Add” affordances without hardcoding the section list.

Source

pub fn nested_section_help(name: &str) -> Option<&'static str>

Help blurb for a #[nested] field on this struct, sourced from the field-level /// docstring. Returns None for unknown names so callers can fall through to a different lookup.

Source

pub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>

Return the current alias keys at section_path, or None if the path doesn’t resolve to a map-keyed section in this tree.

Source

pub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>

Snapshot of every #[nested] Option<T> field on this struct as (field_name, is_some) tuples, in declaration order.

field_name is the raw Rust ident (snake_case) — consumers can map to display names via their own table. The schema is the single source of truth: adding a new pub foo: Option<FooConfig> field with #[nested] surfaces here without touching any caller.

Source

pub fn create_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>

Insert a default-valued entry under a map-keyed section, or append to a list-shaped one, with map_key as the new entry’s natural identifier (HashMap key for Map sections; identifier field for List sections).

Returns Ok(true) if a new entry was created, Ok(false) if the entry already existed (idempotent), or Err(reason) if the section path doesn’t resolve to a Map/List in this tree.

Source

pub fn delete_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>

Remove the entry identified by map_key from the map-keyed section at section_path.

Returns Ok(true) if the entry existed and was removed, Ok(false) if it didn’t exist, or Err(reason) if the section path doesn’t resolve.

Source

pub fn rename_map_key( &mut self, section_path: &str, map_key: &str, new_key: &str, ) -> Result<bool, String>

Rename map_key to new_key within the map-keyed section at section_path, preserving the entry’s value.

Returns Ok(true) if renamed, Ok(false) if map_key didn’t exist, or Err(reason) if new_key already exists or the section path doesn’t resolve.

Source§

impl AmqpConfig

Source

pub fn validate(&self) -> Result<(), Error>

Validate the AMQP configuration.

Checks:

  • amqp_url uses a valid scheme (amqp:// or amqps://)
  • amqps:// connections carry a CA certificate
  • client_cert and client_key are supplied together (mutual TLS)
  • the exchange is non-empty
  • at least one routing key is bound

Trait Implementations§

Source§

impl ChannelConfig for AmqpConfig

Source§

fn name() -> &'static str

human-readable name
Source§

fn desc() -> &'static str

short description
Source§

impl Clone for AmqpConfig

Source§

fn clone(&self) -> AmqpConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AmqpConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for AmqpConfig

Source§

fn default() -> AmqpConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AmqpConfig

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<AmqpConfig, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for AmqpConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl MaskSecrets for AmqpConfig

Source§

fn mask_secrets(&mut self)

Source§

fn restore_secrets_from(&mut self, current: &AmqpConfig)

Source§

impl Serialize for AmqpConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,