process_compose_openapi_client

Struct Client

source
pub struct Client { /* private fields */ }
Expand description

Client for Process Compose API

This is a sample Process Compose server.

Version: 1.0

Implementations§

source§

impl Client

source

pub fn new(baseurl: &str) -> Self

Create a new client.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

source

pub fn new_with_client(baseurl: &str, client: Client) -> Self

Construct a new client with an existing reqwest::Client, allowing more control over its configuration.

baseurl is the base URL provided to the internal reqwest::Client, and should include a scheme and hostname, as well as port and a path stem if applicable.

source

pub fn baseurl(&self) -> &String

Get the base URL to which requests are made.

source

pub fn client(&self) -> &Client

Get the internal reqwest::Client used to make requests.

source

pub fn api_version(&self) -> &'static str

Get the version of this API.

This string is pulled directly from the source OpenAPI document and may be in any format the API selects.

source§

impl Client

source

pub async fn get_host_name<'a>( &'a self, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Get Hostname

Get process compose hostname

Sends a GET request to /hostname

source

pub async fn is_alive<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>>

Liveness Check

Check if server is responding

Sends a GET request to /live

source

pub async fn update_process<'a>( &'a self, ) -> Result<ResponseValue<TypesProcessConfig>, Error<HashMap<String, String>>>

Updates process configuration

Update porcess

Sends a POST request to /process

source

pub async fn get_process_info<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<TypesProcessConfig>, Error<HashMap<String, String>>>

Get process config

Retrieves the given process and its config

Sends a GET request to /process/info/{name}

Arguments:

  • name: Process Name
source

pub async fn get_process_logs<'a>( &'a self, name: &'a str, end_offset: i64, limit: i64, ) -> Result<ResponseValue<HashMap<String, Vec<String>>>, Error<HashMap<String, String>>>

Get process logs

Retrieves the process logs

Sends a GET request to /process/logs/{name}/{endOffset}/{limit}

Arguments:

  • name: Process Name
  • end_offset: Offset from the end of the log
  • limit: Limit of lines to get (0 will get all the lines till the end)
source

pub async fn get_process_ports<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<TypesProcessPorts>, Error<HashMap<String, String>>>

Get process ports

Retrieves process open ports

Sends a GET request to /process/ports/{name}

Arguments:

  • name: Process Name
source

pub async fn restart_process<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Restart a process

Restarts the process

Sends a POST request to /process/restart/{name}

Arguments:

  • name: Process Name
source

pub async fn scale_process<'a>( &'a self, name: &'a str, scale: i64, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Scale a process to a given replicas count

Scale a process

Sends a PATCH request to /process/scale/{name}/{scale}

Arguments:

  • name: Process Name
  • scale: New amount of process replicas
source

pub async fn start_process<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Start a process

Starts the process if the state is not ‘running’ or ‘pending’

Sends a POST request to /process/start/{name}

Arguments:

  • name: Process Name
source

pub async fn stop_process<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Stop a process

Sends kill signal to the process

Sends a PATCH request to /process/stop/{name}

Arguments:

  • name: Process Name
source

pub async fn get_process<'a>( &'a self, name: &'a str, ) -> Result<ResponseValue<TypesProcessState>, Error<HashMap<String, String>>>

Get process state

Retrieves the given process and its status

Sends a GET request to /process/{name}

Arguments:

  • name: Process Name
source

pub async fn get_processes<'a>( &'a self, ) -> Result<ResponseValue<TypesProcessesState>, Error<HashMap<String, String>>>

Get all processes

Retrieves all the configured processes and their status

Sends a GET request to /processes

source

pub async fn stop_processes<'a>( &'a self, body: &'a Vec<String>, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Stop processes

Sends kill signal to the processes list

Sends a PATCH request to /processes/stop

Arguments:

  • body: Processes Names
source

pub async fn update_project<'a>( &'a self, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Updates running processes

Update running project

Sends a POST request to /project

source

pub async fn reload_project<'a>( &'a self, ) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>

Reload project

Reload project state from config

Sends a POST request to /project/configuration

source

pub async fn get_project_state<'a>( &'a self, ) -> Result<ResponseValue<TypesProjectState>, Error<HashMap<String, String>>>

Get project state

Retrieves project state information

Sends a GET request to /project/state

source

pub async fn shut_down_project<'a>( &'a self, ) -> Result<ResponseValue<HashMap<String, String>>, Error<()>>

Stops all the processes and the server

Shuts down the server

Sends a POST request to /project/stop

Trait Implementations§

source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy 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 Debug for Client

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.
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