Server

Struct Server 

Source
pub struct Server {
Show 36 fields pub uuid: Uuid, pub uuid_short: i32, pub external_id: Option<CompactString>, pub allocation: Option<ServerAllocation>, pub destination_allocation_uuid: Option<Uuid>, pub node: Fetchable<Node>, pub destination_node: Option<Fetchable<Node>>, pub owner: User, pub egg: Box<NestEgg>, pub nest: Box<Nest>, pub backup_configuration: Option<Fetchable<BackupConfiguration>>, pub status: Option<ServerStatus>, pub suspended: bool, pub name: CompactString, pub description: Option<CompactString>, pub memory: i64, pub memory_overhead: i64, pub swap: i64, pub disk: i64, pub io_weight: Option<i16>, pub cpu: i32, pub pinned_cpus: Vec<i16>, pub startup: CompactString, pub image: CompactString, pub auto_kill: ServerConfigurationAutoKill, pub auto_start_behavior: ServerAutoStartBehavior, pub timezone: Option<CompactString>, pub hugepages_passthrough_enabled: bool, pub kvm_passthrough_enabled: bool, pub allocation_limit: i32, pub database_limit: i32, pub backup_limit: i32, pub schedule_limit: i32, pub subuser_permissions: Option<Arc<Vec<CompactString>>>, pub subuser_ignored_files: Option<Vec<CompactString>>, pub created: NaiveDateTime, /* private fields */
}

Fields§

§uuid: Uuid§uuid_short: i32§external_id: Option<CompactString>§allocation: Option<ServerAllocation>§destination_allocation_uuid: Option<Uuid>§node: Fetchable<Node>§destination_node: Option<Fetchable<Node>>§owner: User§egg: Box<NestEgg>§nest: Box<Nest>§backup_configuration: Option<Fetchable<BackupConfiguration>>§status: Option<ServerStatus>§suspended: bool§name: CompactString§description: Option<CompactString>§memory: i64§memory_overhead: i64§swap: i64§disk: i64§io_weight: Option<i16>§cpu: i32§pinned_cpus: Vec<i16>§startup: CompactString§image: CompactString§auto_kill: ServerConfigurationAutoKill§auto_start_behavior: ServerAutoStartBehavior§timezone: Option<CompactString>§hugepages_passthrough_enabled: bool§kvm_passthrough_enabled: bool§allocation_limit: i32§database_limit: i32§backup_limit: i32§schedule_limit: i32§subuser_permissions: Option<Arc<Vec<CompactString>>>§subuser_ignored_files: Option<Vec<CompactString>>§created: NaiveDateTime

Implementations§

Source§

impl Server

Source

pub async fn by_node_uuid_uuid( database: &Database, node_uuid: Uuid, uuid: Uuid, ) -> Result<Option<Self>, DatabaseError>

Source

pub async fn by_external_id( database: &Database, external_id: &str, ) -> Result<Option<Self>, DatabaseError>

Source

pub async fn by_identifier( database: &Database, identifier: &str, ) -> Result<Option<Self>, DatabaseError>

Source

pub async fn by_user_identifier( database: &Database, user: &User, identifier: &str, ) -> Result<Option<Self>, Error>

Get a server by its identifier, ensuring the user has access to it.

Cached for 5 seconds.

Source

pub async fn by_owner_uuid_with_pagination( database: &Database, owner_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_user_uuid_server_order_with_pagination( database: &Database, owner_uuid: Uuid, server_order: &[Uuid], page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_user_uuid_with_pagination( database: &Database, user_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn all_uuids_by_node_uuid_user_uuid( database: &Database, node_uuid: Uuid, user_uuid: Uuid, ) -> Result<Vec<Uuid>, DatabaseError>

Source

pub async fn by_not_user_uuid_with_pagination( database: &Database, user_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_node_uuid_with_pagination( database: &Database, node_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_node_uuid_transferring_with_pagination( database: &Database, node_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_egg_uuid_with_pagination( database: &Database, egg_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn by_backup_configuration_uuid_with_pagination( database: &Database, backup_configuration_uuid: Uuid, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn all_with_pagination( database: &Database, page: i64, per_page: i64, search: Option<&str>, ) -> Result<Pagination<Self>, DatabaseError>

Source

pub async fn count_by_user_uuid(database: &Database, user_uuid: Uuid) -> i64

Source

pub async fn count_by_node_uuid(database: &Database, node_uuid: Uuid) -> i64

Source

pub async fn count_by_egg_uuid(database: &Database, egg_uuid: Uuid) -> i64

Source

pub async fn sync(self, database: &Database) -> Result<(), Error>

Source

pub async fn install( &self, state: &State, truncate_directory: bool, installation_script: Option<InstallationScript>, ) -> Result<(), Error>

Triggers a re-installation of the server on the node. This will only work if the server is in a state that allows re-installation. (None status) If this is not the case, a DisplayError will be returned.

Source

pub async fn transfer( self, state: &State, options: ServerTransferOptions, ) -> Result<(), Error>

Triggers a transfer of the server to another node. This will only work if the server is in a state that allows transferring. (None status) If this is not the case, a DisplayError will be returned.

Source

pub fn wings_permissions( &self, settings: &AppSettings, user: &User, ) -> Vec<&str>

Source

pub fn wings_subuser_permissions<'a>( &self, settings: &AppSettings, subuser: &'a ServerSubuser, ) -> Vec<&'a str>

Source

pub async fn backup_configuration( &self, database: &Database, ) -> Option<BackupConfiguration>

Source

pub fn is_ignored(&mut self, path: impl AsRef<Path>, is_dir: bool) -> bool

Source

pub async fn into_remote_api_object( self, database: &Database, ) -> Result<RemoteApiServer, Error>

Source

pub async fn into_admin_api_object( self, database: &Database, storage_url_retriever: &StorageUrlRetriever<'_>, ) -> Result<AdminApiServer, Error>

Source

pub async fn into_api_object( self, database: &Database, user: &User, ) -> Result<ApiServer, Error>

Trait Implementations§

Source§

impl BaseModel for Server

Source§

const NAME: &'static str = "server"

Source§

fn columns(prefix: Option<&str>) -> BTreeMap<&'static str, CompactString>

Source§

fn map(prefix: Option<&str>, row: &PgRow) -> Result<Self, DatabaseError>

Source§

fn columns_sql(prefix: Option<&str>) -> CompactString

Source§

impl ByUuid for Server

Source§

fn by_uuid<'life0, 'async_trait>( database: &'life0 Database, uuid: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn by_uuid_cached<'life0, 'async_trait>( database: &'life0 Database, uuid: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn by_uuid_optional<'life0, 'async_trait>( database: &'life0 Database, uuid: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, DatabaseError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn by_uuid_optional_cached<'life0, 'async_trait>( database: &'life0 Database, uuid: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn get_fetchable(uuid: Uuid) -> Fetchable<Self>

Source§

fn get_fetchable_from_row( row: &PgRow, column: impl AsRef<str>, ) -> Option<Fetchable<Self>>

Source§

impl Clone for Server

Source§

fn clone(&self) -> Server

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 CreatableModel for Server

Source§

type CreateOptions<'a> = CreateServerOptions

Source§

type CreateResult = Server

Source§

fn get_create_handlers() -> &'static LazyLock<CreateListenerList<Self>>

Source§

fn create<'life0, 'life1, 'async_trait>( state: &'life0 State, options: Self::CreateOptions<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn register_create_handler<'async_trait, F>( priority: ListenerPriority, callback: F, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static, Self: 'async_trait,

Source§

fn blocking_register_create_handler<F: for<'a> Fn(&'a mut Self::CreateOptions<'_>, &'a mut InsertQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>( priority: ListenerPriority, callback: F, )

Warning Read more
Source§

fn run_create_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( options: &'life0 mut Self::CreateOptions<'life1>, query_builder: &'life2 mut InsertQueryBuilder<'_>, state: &'life3 State, transaction: &'life4 mut Transaction<'life5, Postgres>, ) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Source§

impl DeletableModel for Server

Source§

type DeleteOptions = DeleteServerOptions

Source§

fn get_delete_handlers() -> &'static LazyLock<DeleteListenerList<Self>>

Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 State, options: Self::DeleteOptions, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn register_delete_handler<'async_trait, F>( priority: ListenerPriority, callback: F, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a Self, &'a Self::DeleteOptions, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> + Send + Sync + 'static, Self: 'async_trait,

Source§

fn blocking_register_delete_handler<F: for<'a> Fn(&'a Self, &'a Self::DeleteOptions, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> + Send + Sync + 'static>( priority: ListenerPriority, callback: F, )

Warning Read more
Source§

fn run_delete_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, options: &'life1 Self::DeleteOptions, state: &'life2 State, transaction: &'life3 mut Transaction<'life4, Postgres>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Source§

impl<'de> Deserialize<'de> for Server

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl EventEmittingModel for Server

Source§

type Event = ServerEvent

Source§

fn get_event_emitter() -> &'static EventEmitter<Self::Event>

Source§

fn register_event_handler<'async_trait, F, Fut>( listener: F, ) -> Pin<Box<dyn Future<Output = EventHandlerHandle> + Send + 'async_trait>>
where F: 'async_trait + Fn(State, Arc<Self::Event>) -> Fut + Send + Sync + 'static, Fut: 'async_trait + Future<Output = Result<(), Error>> + Send + 'static, Self: Send + 'async_trait,

Source§

fn blocking_register_event_handler<F: Fn(State, Arc<Self::Event>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<(), Error>> + Send + 'static>( listener: F, ) -> EventHandlerHandle

Warning Read more
Source§

impl Serialize for Server

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 UpdatableModel for Server

Source§

type UpdateOptions = UpdateServerOptions

Source§

fn get_update_handlers() -> &'static LazyLock<UpdateListenerList<Self>>

Source§

fn update<'life0, 'life1, 'async_trait>( &'life0 mut self, state: &'life1 State, options: Self::UpdateOptions, ) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn register_update_handler<'async_trait, F>( priority: ListenerPriority, callback: F, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where F: 'async_trait + for<'a> Fn(&'a mut Self, &'a mut Self::UpdateOptions, &'a mut UpdateQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static, Self: 'async_trait,

Source§

fn blocking_register_update_handler<F: for<'a> Fn(&'a mut Self, &'a mut Self::UpdateOptions, &'a mut UpdateQueryBuilder<'_>, &'a State, &'a mut Transaction<'_, Postgres>) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'a>> + Send + Sync + 'static>( priority: ListenerPriority, callback: F, )

Warning Read more
Source§

fn run_update_handlers<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 mut self, options: &'life1 mut Self::UpdateOptions, query_builder: &'life2 mut UpdateQueryBuilder<'_>, state: &'life3 State, transaction: &'life4 mut Transaction<'life5, Postgres>, ) -> Pin<Box<dyn Future<Output = Result<(), DatabaseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait,

Auto Trait Implementations§

§

impl Freeze for Server

§

impl RefUnwindSafe for Server

§

impl Send for Server

§

impl Sync for Server

§

impl Unpin for Server

§

impl UnwindSafe for Server

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Chain<T> for T

§

fn len(&self) -> usize

The number of items that this chain link consists of.
§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Container<T> for T
where T: Clone,

§

type Iter = Once<T>

An iterator over the items within this container, by value.
§

fn get_iter(&self) -> <T as Container<T>>::Iter

Iterate over the elements of the container (using internal iteration because GATs are unstable).
§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromBase64 for T
where T: for<'de> Deserialize<'de>,

§

fn from_base64<Input>(raw: &Input) -> Result<T, Error>
where Input: AsRef<[u8]> + ?Sized,

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<C> SignWithKey<String> for C
where C: ToBase64,

§

fn sign_with_key(self, key: &impl SigningAlgorithm) -> Result<String, Error>

§

impl<T> ToBase64 for T
where T: Serialize,

§

fn to_base64(&self) -> Result<Cow<'_, str>, Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> OrderedContainer<T> for T
where T: Clone,

§

impl<'de, T> Response for T
where T: Deserialize<'de>,