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
| Name | Type | Description |
|---|---|---|
id | Uuid | Unique identifier for the agent target. |
agent_id | Uuid | ID of the agent associated with this target. |
stack_id | Uuid | ID 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
| Name | Type | Description |
|---|---|---|
agent_id | Uuid | ID of the agent to associate with a stack. |
stack_id | Uuid | ID 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:
| Name | Type | Description |
|---|---|---|
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 })
}
}