Skip to main content

ResourceDefinition

Trait ResourceDefinition 

Source
pub trait ResourceDefinition:
    Debug
    + Send
    + Sync
    + 'static
    + Serialize
    + Deserialize {
    // Required methods
    fn resource_type() -> ResourceType
       where Self: Sized;
    fn get_resource_type(&self) -> ResourceType;
    fn id(&self) -> &str;
    fn get_dependencies(&self) -> Vec<ResourceRef>;
    fn validate_update(&self, new_config: &dyn ResourceDefinition) -> Result<()>;
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn box_clone(&self) -> Box<dyn ResourceDefinition>;
    fn resource_eq(&self, other: &dyn ResourceDefinition) -> bool;

    // Provided method
    fn get_permissions(&self) -> Option<&str> { ... }
}
Expand description

Trait that defines the interface for all resource types in the Alien system. This trait enables extensibility by allowing new resource types to be registered and managed alongside built-in resources.

Required Methods§

Source

fn resource_type() -> ResourceType
where Self: Sized,

Returns the static type identifier for this resource type (e.g., “Function”, “Storage”)

Source

fn get_resource_type(&self) -> ResourceType

Returns the resource type for this instance (calls the static method)

Source

fn id(&self) -> &str

Returns the unique identifier for this specific resource instance

Source

fn get_dependencies(&self) -> Vec<ResourceRef>

Returns the list of other resources this resource depends on

Source

fn validate_update(&self, new_config: &dyn ResourceDefinition) -> Result<()>

Validates if an update from the current configuration to a new configuration is allowed

Source

fn as_any(&self) -> &dyn Any

Provides access to the underlying concrete type for downcasting

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Provides mutable access to the underlying concrete type for downcasting

Source

fn box_clone(&self) -> Box<dyn ResourceDefinition>

Creates a boxed clone of this resource definition

Source

fn resource_eq(&self, other: &dyn ResourceDefinition) -> bool

For equality comparison between resource definitions

Provided Methods§

Source

fn get_permissions(&self) -> Option<&str>

Returns the permission profile name for this resource, if it has one.

Used by ServiceAccountDependenciesMutation to wire the corresponding {profile}-sa service account as a declared dependency so the executor enforces ordering and propagates SA changes automatically.

Override in concrete types that carry a permissions field (Container, Function).

Trait Implementations§

Source§

impl Clone for Box<dyn ResourceDefinition>

Clone implementation for boxed ResourceDefinition trait objects

Source§

fn clone(&self) -> Self

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<'typetag> Serialize for dyn ResourceDefinition + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn ResourceDefinition + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn ResourceDefinition + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn ResourceDefinition + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Implementors§