Client

Struct Client 

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

Apache Livy REST API client

Implementations§

Source§

impl Client

Source

pub fn new( url: &str, gssnegotiate: Option<bool>, username: Option<String>, ) -> Client

Constructs a new Client.

§Examples
use livy::client::Client;

let client = Client::new("http://example.com:8998", None, None);
use livy::client::Client;

let client = Client::new("http://example.com:8998", Some(true), Some("username".to_string()));
Source

pub fn get_sessions( &self, from: Option<i64>, size: Option<i64>, ) -> Result<Sessions, String>

Gets information of sessions and returns it.

§HTTP Request

GET /sessions

Source

pub fn create_session( &self, new_session_request: NewSessionRequest, ) -> Result<Session, String>

Creates a new session.

§HTTP Request

POST /sessions

Source

pub fn get_session(&self, session_id: i64) -> Result<Session, String>

Gets information of a single session and returns it.

§HTTP Request

GET /sessions/{sessionId}

Source

pub fn get_session_state( &self, session_id: i64, ) -> Result<SessionStateOnly, String>

Gets session state information of a single session and returns it.

§HTTP Request

GET /sessions/{sessionId}/state

Source

pub fn kill_session(&self, session_id: i64) -> Result<SessionKillResult, String>

Kills the session whose id is equal to session_id.

§HTTP Request

DELETE /sessions/{sessionId}

Source

pub fn get_session_log( &self, session_id: i64, from: Option<i64>, size: Option<i64>, ) -> Result<SessionLog, String>

Gets the log lines of a single session and returns them.

§HTTP Request

GET /sessions/{sessionId}/log

Source

pub fn get_statements(&self, session_id: i64) -> Result<Statements, String>

Gets the statements of a single session and returns them.

§HTTP Request

GET /sessions/{sessionId}/statements

Source

pub fn run_statement( &self, session_id: i64, run_statement_request: RunStatementRequest, ) -> Result<Statement, String>

Runs a statement in a session.

§HTTP Request

POST /sessions/{sessionId}/statements

Source

pub fn get_statement( &self, session_id: i64, statement_id: i64, ) -> Result<Statement, String>

Gets a single statement of a single session and returns it.

§HTTP Request

GET /sessions/{sessionId}/statements/{statementId}

Source

pub fn cancel_statement( &self, session_id: i64, statement_id: i64, ) -> Result<StatementCancelResult, String>

Cancel a single statement.

§HTTP Request

POST /sessions/{sessionId}/statements/{statementId}/cancel

Source

pub fn get_batches( &self, from: Option<i64>, size: Option<i64>, ) -> Result<Batches, String>

Gets information of batches and returns it.

§HTTP Request

GET /batches

Source

pub fn create_batch( &self, new_batch_request: NewBatchRequest, ) -> Result<Batch, String>

Creates a new batch.

§HTTP Request

POST /batches

Source

pub fn get_batch(&self, batch_id: i64) -> Result<Batch, String>

Gets a batch and returns it.

§HTTP Request

GET /batches/{batchId}

Source

pub fn get_batch_state(&self, batch_id: i64) -> Result<BatchStateOnly, String>

Gets the state of batch session.

§HTTP Request

GET /batches/{batchId}/state

Source

pub fn kill_batch(&self, batch_id: i64) -> Result<BatchKillResult, String>

Kills the batch job.

§HTTP Request

DELETE /batches/{batchId}

Source

pub fn get_batch_log( &self, batch_id: i64, from: Option<i64>, size: Option<i64>, ) -> Result<BatchLog, String>

Gets the log lines from a batch and returns them.

§HTTP Request

GET /batches/{batchId}/log

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.