Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

brokkr-models::models::agent_targets Rust

Structs

brokkr-models::models::agent_targets::AgentTarget

pub

Derives: Queryable, Selectable, Identifiable, AsChangeset, Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash, ToSchema, ``

Represents an agent target in the database.

Fields

NameTypeDescription
idUuidUnique identifier for the agent target.
agent_idUuidID of the agent associated with this target.
stack_idUuidID of the stack associated with this target.

brokkr-models::models::agent_targets::NewAgentTarget

pub

Derives: Insertable, Debug, Clone, Serialize, Deserialize, ToSchema

Represents a new agent target to be inserted into the database.

Fields

NameTypeDescription
agent_idUuidID of the agent to associate with a stack.
stack_idUuidID of the stack to associate with an agent.

Methods

new pub
#![allow(unused)]
fn main() {
fn new (agent_id : Uuid , stack_id : Uuid) -> Result < Self , String >
}

Creates a new NewAgentTarget instance.

Parameters:

NameTypeDescription
agent_id-UUID of the agent to associate with a stack.
stack_id-UUID of the stack to associate with an agent.

Returns:

Returns Ok(NewAgentTarget) if both UUIDs are valid and non-nil, otherwise returns an Err with a description of the validation failure.

Source
#![allow(unused)]
fn main() {
    pub fn new(agent_id: Uuid, stack_id: Uuid) -> Result<Self, String> {
        // Validate agent_id
        if agent_id.is_nil() {
            return Err("Invalid agent ID".to_string());
        }

        // Validate stack_id
        if stack_id.is_nil() {
            return Err("Invalid stack ID".to_string());
        }

        Ok(NewAgentTarget { agent_id, stack_id })
    }
}