pub fn get_controllers() -> Controllers
Expand description
Retrieve the controllers of the Satellite.
This function retrieves the list of controllers currently set for the application.
A controller is represented as a key-value pair where the key is the ControllerId
(a Principal
) and the value is a Controller
struct containing metadata and scope
details about the controller.
§Returns
Controllers
: AHashMap
where:- The key is a
ControllerId
(type alias forPrincipal
). - The value is a
Controller
struct that includes:metadata
: Additional metadata about the controller, such as name or description.created_at
: The timestamp when the controller was created.updated_at
: The timestamp when the controller was last updated.expires_at
: An optional timestamp indicating when the controller expires.scope
: TheControllerScope
, which specifies the access level (Write
orAdmin
).
- The key is a
§Example
let controllers = get_controllers();
for (controller_id, controller) in controllers.iter() {
println!("Controller ID: {}", controller_id);
println!("Scope: {:?}", controller.scope);
if let Some(expires_at) = controller.expires_at {
println!("Expires at: {}", expires_at);
}
}
This function is useful for checking the current permissions.