implement server destroy

This commit is contained in:
Robin Appelman 2021-03-29 20:50:58 +02:00
commit 55f11c6ccb
2 changed files with 10 additions and 3 deletions

View file

@ -17,4 +17,4 @@ FROM alpine:latest
COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/dispenser / COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/dispenser /
CMD ["/dispenser" "/config.toml"] CMD ["/dispenser", "/config.toml"]

View file

@ -74,8 +74,15 @@ impl Cloud for Vultr {
} }
} }
async fn kill(&self, _id: &str) -> Result<()> { async fn kill(&self, id: &str) -> Result<()> {
todo!() let response = self
.client
.delete(format!("https://api.vultr.com/v2/instances/{}", id))
.bearer_auth(&self.token)
.send()
.await
.map_err(NetworkError::from)?;
CloudError::from_status_code(response.status())
} }
async fn wait_for_ip(&self, id: &str) -> Result<Server> { async fn wait_for_ip(&self, id: &str) -> Result<Server> {