FormationsReq

Struct FormationsReq 

Source
pub struct FormationsReq { /* private fields */ }
Expand description

Wraps an SDK FormationsRequest where we do additional things like re-use request access tokens, allow changing the Formation this request is pointed to, and map errors appropriately.

Implementations§

Source§

impl FormationsReq

Source

pub fn new<S: Into<String>>(ctx: &Ctx, name: Option<S>) -> Result<Self>

Builds a FormationsRequest and immediately requests an access token using the given API key.

If the name is None it should be noted that the only request that can be made without error is FormationsRequest::list_names

Source

pub fn new_delay_token(ctx: &Ctx) -> Result<Self>

Builds a FormationsRequest but does not request an access token using the given API key.

You must call refresh_token to have the access token requested.

Source

pub fn refresh_token(&mut self) -> Result<()>

Request a new Access Token

Source

pub fn token_or_refresh(&mut self) -> Result<&str>

Retrieves the JWT access token, requesting a new one if required.

Source

pub fn set_name<S: Into<String>>(&mut self, name: S) -> Result<()>

Sets the Formation name and re-builds the inner FormationsRequest also requesting a new access token if required

Source

pub fn get_all_formations<S: AsRef<str>>( &mut self, formation_names: &[S], pb: &Pb, ) -> Result<Formations>

Retrieves all Formations and their Formation Configurations (both active and inactive) from the Compute API. Makes multiple calls against the API to gather the info and returns a Formations struct.

It should be noted that the local IDs associated with all the items in the Formations struct are generated unique after retrieval from the compute API. i.e. they do not match anything existing in the local DB even if the contents are otherwise identical.

Source

pub fn get_formation_names(&mut self) -> Result<Vec<String>>

Return a Vec of all known formation names if this FormationsReq currently has no name associated with it. Otherwise it returns the single name associated with this FormationsReq (returned in a Vec). This is used when the CLI supports either doing something to all formations, or just a single one that is passed in by the user.

Source§

impl FormationsReq

Source

pub fn list_names(&mut self) -> Result<FormationNamesModel>

Source

pub fn get_metadata(&mut self) -> Result<FormationMetadataModel>

Source

pub fn create( &mut self, configuration: &FormationConfigurationModel, active: bool, ) -> Result<Vec<Uuid>>

Source

pub fn clone_from( &mut self, source_name: &str, active: bool, ) -> Result<Vec<Uuid>>

Source

pub fn delete(&mut self, force: bool) -> Result<Vec<Uuid>>

Source

pub fn get_active_configurations(&mut self) -> Result<ActiveConfigurationsModel>

Source

pub fn stop(&mut self) -> Result<()>

Source

pub fn set_active_configurations( &mut self, configs: &ActiveConfigurationsModel, force: bool, ) -> Result<()>

Source

pub fn get_containers(&mut self) -> Result<ContainersModel>

Source

pub fn get_container(&mut self, container_id: Uuid) -> Result<ContainerModel>

Source

pub fn get_configuration( &mut self, uuid: Uuid, ) -> Result<FormationConfigurationModel>

Source

pub fn list_configuration_ids(&mut self) -> Result<Vec<Uuid>>

Source

pub fn remove_configuration(&mut self, uuid: Uuid, force: bool) -> Result<Uuid>

Source

pub fn add_configuration( &mut self, configuration: &FormationConfigurationModel, active: bool, ) -> Result<Uuid>

Trait Implementations§

Source§

impl Debug for FormationsReq

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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, 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,