Skip to content

Commit

Permalink
CLI: use namespace instead of org name (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmiller609 committed May 13, 2024
1 parent 6b33be3 commit acff77d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions tembo-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tembo-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
workspace = { members = ["temboclient", "tembodataclient"] }
[package]
name = "tembo-cli"
version = "0.20.4"
version = "0.20.5"
edition = "2021"
authors = ["Tembo.io"]
description = "The CLI for Tembo"
Expand Down Expand Up @@ -54,7 +54,7 @@ dateparser = "0.2.0"
log = "0.4.20"
tera = "1.18.1"
curl = "0.4.44"
temboclient = { version = "1.0.1", path = "temboclient" }
temboclient = { version = "1.0.2", path = "temboclient" }
tembodataclient = { version = "0.0.2", path = "tembodataclient" }
tokio = { version = "1.26.0", features = [
"rt",
Expand All @@ -76,7 +76,7 @@ tembo-stacks = "0.7.0"
itertools = "0.12.1"
random-string = "1.1.0"
test-case = "=2.0.0-rc2"
clap-markdown = { git = "https://github.com/tembo-io/clap-markdown.git", branch = "main" }
clap-markdown = { git = "https://github.com/tembo-io/clap-markdown.git", branch = "main", version = "0.1.3" }

[target.aarch64-unknown-linux-musl.dependencies]
openssl = { version = "0.10", features = ["vendored"] }
Expand Down
7 changes: 3 additions & 4 deletions tembo-cli/src/cmd/top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ async fn fetch_metrics_loop(
}

for value in instance_settings.values() {
let org_name = get_instance_org_name(config, &env, &value.instance_name).await?;
let namespace = format!("org-{}-inst-{}", org_name, &value.instance_name);
let namespace = get_instance_namespace(config, &env, &value.instance_name).await?;
let namespace_encoded = urlencoding::encode(&namespace);

let mut cpu_value = String::new();
Expand Down Expand Up @@ -227,7 +226,7 @@ async fn fetch_metric(
Ok(response)
}

async fn get_instance_org_name(
async fn get_instance_namespace(
config: &Configuration,
env: &Environment,
instance_name: &String,
Expand All @@ -250,7 +249,7 @@ async fn get_instance_org_name(

let instance_result = get_instance(config, org_id, &instance_id).await;
match instance_result {
Ok(instance) => Ok(instance.organization_name),
Ok(instance) => Ok(instance.namespace),
Err(e) => Err(e.into()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion tembo-cli/temboclient/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "temboclient"
version = "1.0.1"
version = "1.0.2"
authors = ["OpenAPI Generator team and contributors"]
description = "Platform API for Tembo Cloud </br> </br> To find a Tembo Data API, please find it here: </br> </br> [AWS US East 1](https://api.data-1.use1.tembo.io/swagger-ui/) "
# Override this license by providing a License Object in the OpenAPI.
Expand Down
26 changes: 12 additions & 14 deletions tembo-cli/temboclient/docs/Instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,26 @@ Name | Type | Description | Notes
**app_services** | Option<[**Vec<crate::models::AppType>**](AppType.md)> | | [optional]
**connection_info** | Option<[**crate::models::ConnectionInfo**](ConnectionInfo.md)> | | [optional]
**connection_pooler** | Option<[**crate::models::ConnectionPooler**](ConnectionPooler.md)> | | [optional]
**cpu** | [**crate::models::Cpu**](Cpu.md) | |
**cpu** | [**crate::models::Cpu**](Cpu.md) | |
**created_at** | Option<**String**> | | [optional]
**environment** | [**crate::models::Environment**](Environment.md) | |
**environment** | [**crate::models::Environment**](Environment.md) | |
**extensions** | Option<[**Vec<crate::models::ExtensionStatus>**](ExtensionStatus.md)> | | [optional]
**extra_domains_rw** | Option<**Vec<String>**> | | [optional]
**first_recoverability_time** | Option<**String**> | | [optional]
**instance_id** | **String** | |
**instance_name** | **String** | |
**instance_id** | **String** | |
**instance_name** | **String** | |
**ip_allow_list** | Option<**Vec<String>**> | | [optional]
**last_updated_at** | Option<**String**> | | [optional]
**memory** | [**crate::models::Memory**](Memory.md) | |
**organization_id** | **String** | |
**organization_name** | **String** | |
**memory** | [**crate::models::Memory**](Memory.md) | |
**organization_id** | **String** | |
**namespace** | **String** | |
**postgres_configs** | Option<[**Vec<crate::models::PgConfig>**](PgConfig.md)> | | [optional]
**postgres_version** | **i32** | Major Postgres version this instance is using. Currently: 14, 15 or 16 |
**replicas** | **i32** | |
**postgres_version** | **i32** | Major Postgres version this instance is using. Currently: 14, 15 or 16 |
**replicas** | **i32** | |
**runtime_config** | Option<[**Vec<crate::models::PgConfig>**](PgConfig.md)> | | [optional]
**stack_type** | [**crate::models::StackType**](StackType.md) | |
**state** | [**crate::models::State**](State.md) | |
**storage** | [**crate::models::Storage**](Storage.md) | |
**stack_type** | [**crate::models::StackType**](StackType.md) | |
**state** | [**crate::models::State**](State.md) | |
**storage** | [**crate::models::Storage**](Storage.md) | |
**trunk_installs** | Option<[**Vec<crate::models::TrunkInstallStatus>**](TrunkInstallStatus.md)> | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


8 changes: 4 additions & 4 deletions tembo-cli/temboclient/src/models/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub struct Instance {
pub memory: crate::models::Memory,
#[serde(rename = "organization_id")]
pub organization_id: String,
#[serde(rename = "organization_name")]
pub organization_name: String,
#[serde(rename = "namespace")]
pub namespace: String,
#[serde(
rename = "postgres_configs",
default,
Expand Down Expand Up @@ -114,7 +114,7 @@ impl Instance {
instance_name: String,
memory: crate::models::Memory,
organization_id: String,
organization_name: String,
namespace: String,
postgres_version: i32,
replicas: i32,
stack_type: crate::models::StackType,
Expand All @@ -137,7 +137,7 @@ impl Instance {
last_updated_at: None,
memory,
organization_id,
organization_name,
namespace,
postgres_configs: None,
postgres_version,
replicas,
Expand Down

0 comments on commit acff77d

Please sign in to comment.