Skip to content

Commit

Permalink
Use new endpoint for ping
Browse files Browse the repository at this point in the history
The /api/v0/health endpoint has existed for a while, but we have
continued to use the old endpoint. This patch fixes that.
  • Loading branch information
kylewillmon committed May 11, 2022
1 parent 472c151 commit b96c493
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cli/src/api/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pub fn put_submit_package(api_uri: &str) -> String {
format!("{api_uri}/{API_PATH}/job")
}

/// GET /job/heartbeat
/// GET /health
pub fn get_ping(api_uri: &str) -> String {
format!("{api_uri}/{API_PATH}/job/heartbeat")
format!("{api_uri}/{API_PATH}/health")
}

/// GET /job/
Expand Down
2 changes: 1 addition & 1 deletion cli/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl PhylumApi {
Ok(self
.get::<PingResponse>(endpoints::get_ping(&self.api_uri))
.await?
.msg)
.response)
}

/// Get information about the authenticated user
Expand Down
7 changes: 0 additions & 7 deletions cli/src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use phylum_types::types::project::*;
use prettytable::*;

use crate::print::{self, table_format};
use crate::types::PingResponse;

pub trait Renderable {
fn render(&self) -> String;
Expand Down Expand Up @@ -286,12 +285,6 @@ impl Renderable for CancelJobResponse {
}
}

impl Renderable for PingResponse {
fn render(&self) -> String {
format!("Ping response: {}", self.msg)
}
}

impl Renderable for ProjectThresholds {
fn render(&self) -> String {
let normalize = |t: f32| (t * 100.0).round() as u32;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub struct PingResponse {
pub msg: String,
pub response: String,
}

// TODO Deprecate
Expand Down

0 comments on commit b96c493

Please sign in to comment.