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
impl Client
sourcepub fn new(baseurl: &str) -> Self
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.
sourcepub fn new_with_client(baseurl: &str, client: Client) -> Self
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.
sourcepub fn api_version(&self) -> &'static str
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
impl Client
sourcepub async fn get_host_name<'a>(
&'a self,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn is_alive<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>>
pub async fn is_alive<'a>(&'a self) -> Result<ResponseValue<()>, Error<()>>
Liveness Check
Check if server is responding
Sends a GET request to /live
sourcepub async fn update_process<'a>(
&'a self,
) -> Result<ResponseValue<TypesProcessConfig>, Error<HashMap<String, String>>>
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
sourcepub async fn get_process_info<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<TypesProcessConfig>, Error<HashMap<String, String>>>
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
sourcepub 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>>>
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 Nameend_offset: Offset from the end of the loglimit: Limit of lines to get (0 will get all the lines till the end)
sourcepub async fn get_process_ports<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<TypesProcessPorts>, Error<HashMap<String, String>>>
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
sourcepub async fn restart_process<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn scale_process<'a>(
&'a self,
name: &'a str,
scale: i64,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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 Namescale: New amount of process replicas
sourcepub async fn start_process<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn stop_process<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn get_process<'a>(
&'a self,
name: &'a str,
) -> Result<ResponseValue<TypesProcessState>, Error<HashMap<String, String>>>
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
sourcepub async fn get_processes<'a>(
&'a self,
) -> Result<ResponseValue<TypesProcessesState>, Error<HashMap<String, String>>>
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
sourcepub async fn stop_processes<'a>(
&'a self,
body: &'a Vec<String>,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn update_project<'a>(
&'a self,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn reload_project<'a>(
&'a self,
) -> Result<ResponseValue<HashMap<String, String>>, Error<HashMap<String, String>>>
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
sourcepub async fn get_project_state<'a>(
&'a self,
) -> Result<ResponseValue<TypesProjectState>, Error<HashMap<String, String>>>
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
sourcepub async fn shut_down_project<'a>(
&'a self,
) -> Result<ResponseValue<HashMap<String, String>>, Error<()>>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)