Skip to content

Commit cecd472

Browse files
committed
Initial Lustre Api Commit
1 parent 003a141 commit cecd472

File tree

24 files changed

+3276
-0
lines changed

24 files changed

+3276
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ members = [
44
"gcloud-sdk",
55
"gcloud-protos-generator",
66
"examples/firestore-client",
7+
"examples/lustre-client",
78
"examples/secrets-manager-client",
89
"examples/gcs-rest-client",
910
"examples/simple-api-client",

examples/lustre-client/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "lustre-client"
3+
version = "0.1.0"
4+
authors = ["jparris@ddn.com"]
5+
edition = "2021"
6+
7+
[dependencies]
8+
gcloud-sdk = { path = "./../../gcloud-sdk", default-features = false, features = ["rest", "google-rest-lustre-v1alpha"] }
9+
tokio = { version = "1.20", features = ["full"] }
10+
tracing = "0.1"
11+
tracing-subscriber = { version ="0.3", features = ["env-filter"] }
12+
futures = "0.3"
13+
bytes = "1.2"

examples/lustre-client/src/main.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#![allow(dead_code)]
2+
3+
use gcloud_sdk::GoogleRestApi;
4+
5+
#[tokio::main]
6+
async fn main() -> Result<(), Box<dyn std::error::Error>> {
7+
// Debug logging
8+
let subscriber = tracing_subscriber::fmt()
9+
.with_max_level(tracing::Level::TRACE)
10+
//.with_env_filter("gcloud_sdk=debug")
11+
.finish();
12+
tracing::subscriber::set_global_default(subscriber)?;
13+
14+
// Detect Google project ID using environment variables PROJECT_ID/GCP_PROJECT_ID
15+
// or GKE metadata server when the app runs inside GKE
16+
let google_project_id = gcloud_sdk::GoogleEnvironment::detect_google_project_id().await
17+
.expect("No Google Project ID detected. Please specify it explicitly using env variable: PROJECT_ID");
18+
19+
let google_rest_client = gcloud_sdk::GoogleRestApi::new().await?;
20+
21+
let client = google_rest_client.create_google_lustre_v1alpha_config().await?;
22+
println!("JDP");
23+
let response = gcloud_sdk::google_rest_apis::lustre_v1alpha::projects_api::autopush_lustre_sandbox_projects_locations_instances_list(
24+
&client,
25+
gcloud_sdk::google_rest_apis::lustre_v1alpha::projects_api::AutopushLustreSandboxPeriodProjectsPeriodLocationsPeriodInstancesPeriodListParams {
26+
parent: format!("v1alpha/projects/{google_project_id}/locations/us-central1-a/instances"),
27+
access_token: None,
28+
alt: None,
29+
callback: None,
30+
fields: None,
31+
key: None,
32+
oauth_token: None,
33+
pretty_print: None,
34+
quota_user: None,
35+
upload_protocol: None,
36+
upload_type: None,
37+
dollar_xgafv: None,
38+
filter: None,
39+
order_by: None,
40+
page_size: None,
41+
page_token: None,
42+
}
43+
).await?;
44+
45+
println!("{:?}", response);
46+
47+
Ok(())
48+
}

0 commit comments

Comments
 (0)