Skip to content

Commit

Permalink
docs(example): update sc example
Browse files Browse the repository at this point in the history
  • Loading branch information
r4ntix committed Jul 14, 2023
1 parent fccb324 commit ec65ef6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions examples/sc.rs
@@ -1,6 +1,20 @@
use aliyun_openapi_core_rust_sdk::client::roa::ROAClient;
use std::env;
use std::error::Error;
use std::{collections::HashMap, env};

use aliyun_openapi_core_rust_sdk::client::roa::ROAClient;
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
struct ClusterList {
clusters: HashMap<String, Vec<Value>>,
page_index: usize,
page_size: usize,
request_id: String,
total_count: usize,
total_page: usize,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
Expand All @@ -15,10 +29,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
let response = aliyun_openapi_client
.version("2018-11-11")
.get("/api/v2/clusters")
.text()
.json::<ClusterList>()
.await?;

println!("ListCluster response:\n{response}");
println!("ListCluster response: {response:#?}");

Ok(())
}

0 comments on commit ec65ef6

Please sign in to comment.