Skip to content

Commit

Permalink
feat(c-s beta): enable resource delete (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
oddgrd authored Apr 19, 2024
1 parent a44d095 commit fe9f49c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
19 changes: 12 additions & 7 deletions cargo-shuttle/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,18 @@ impl ShuttleApiClient {
project: &str,
resource_type: &resource::Type,
) -> Result<()> {
let path = format!(
"/projects/{project}/services/{project}/resources/{}",
utf8_percent_encode(
&resource_type.to_string(),
percent_encoding::NON_ALPHANUMERIC
),
);
let r#type = resource_type.to_string();

let r#type = utf8_percent_encode(&r#type, percent_encoding::NON_ALPHANUMERIC).to_owned();

let path = if self.beta {
format!("/projects/{project}/resources/{}", r#type)
} else {
format!(
"/projects/{project}/services/{project}/resources/{}",
r#type
)
};

self.delete(path).await
}
Expand Down
8 changes: 1 addition & 7 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@ impl Shuttle {
) {
unimplemented!("This command is deprecated on the beta platform");
}
if matches!(
args.cmd,
Command::Resource(ResourceCommand::Delete { .. })
| Command::Stop
| Command::Clean
| Command::Status
) {
if matches!(args.cmd, Command::Stop | Command::Clean | Command::Status) {
unimplemented!("This command is not yet implemented on the beta platform");
}
eprintln!("INFO: Using beta platform API");
Expand Down
8 changes: 8 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ impl DatabaseInfo {
self.database_name,
)
}

pub fn role_name(&self) -> String {
self.role_name.to_string()
}

pub fn database_name(&self) -> String {
self.database_name.to_string()
}
}

/// Used to request a container from the local run provisioner
Expand Down

0 comments on commit fe9f49c

Please sign in to comment.