Init
This commit is contained in:
parent
8e3436b473
commit
77f8120a1f
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
.idea/
|
1678
Cargo.lock
generated
Normal file
1678
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
Cargo.toml
Normal file
16
Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "lnvps"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
http = "1.1.0"
|
||||||
|
proxmox-client = { git = "https://github.com/proxmox/proxmox-rs", version = "0.3.1", features = ["hyper-client"] }
|
||||||
|
proxmox-login = { git = "https://github.com/proxmox/proxmox-rs", version = "0.1.1" }
|
||||||
|
tokio = { version = "1.37.0", features = ["rt", "rt-multi-thread", "macros"] }
|
||||||
|
anyhow = "1.0.83"
|
||||||
|
log = "0.4.21"
|
||||||
|
config = "0.14.0"
|
||||||
|
pretty_env_logger = "0.5.0"
|
@ -0,0 +1,3 @@
|
|||||||
|
server = "10.97.0.234"
|
||||||
|
token_id = "root@pam!test-dev"
|
||||||
|
secret = "e2d8d39f-63ce-48f0-a025-b428d29a26e3"
|
27
src/main.rs
Normal file
27
src/main.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
use std::default;
|
||||||
|
|
||||||
|
use log::info;
|
||||||
|
use proxmox_client::{AuthenticationKind, HttpApiClient, TlsOptions, Token};
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), anyhow::Error> {
|
||||||
|
pretty_env_logger::init();
|
||||||
|
|
||||||
|
let addr = "https://10.97.0.234:8006/";
|
||||||
|
let url = addr.parse().unwrap();
|
||||||
|
let client = proxmox_client::Client::with_options(
|
||||||
|
url,
|
||||||
|
TlsOptions::Insecure,
|
||||||
|
Default::default())?;
|
||||||
|
|
||||||
|
client.set_authentication(AuthenticationKind::Token(Token {
|
||||||
|
userid: "root@pam!test-dev".to_string(),
|
||||||
|
prefix: "PVEAPIToken".to_string(),
|
||||||
|
value: "e2d8d39f-63ce-48f0-a025-b428d29a26e3".to_string(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
let rsp = client.get("/api2/json/version").await?;
|
||||||
|
let string = String::from_utf8(rsp.body)?;
|
||||||
|
info!("Version: {}", string);
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user