Function get_instance_by_id

Source
pub async fn get_instance_by_id(pool: &Pool<MySql>, id: i64) -> Result<Instance>
Expand description

Retrieves a specific instance by its unique identifier.

This function fetches detailed information about a single compute instance. It’s typically used when specific instance details are needed, such as for status monitoring or management operations.

§Arguments

  • pool - Database connection pool for executing the query
  • id - Unique identifier of the instance to retrieve

§Returns

  • Ok(Instance) - Successfully retrieved instance information
  • Err(anyhow::Error) - Failed to fetch instance (including if not found)

§Error Handling

Returns an error if no instance with the given ID exists or if a database error occurs during the query execution.