-
Notifications
You must be signed in to change notification settings - Fork 20
/
build_get.rs
39 lines (31 loc) · 1.02 KB
/
build_get.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// build_get.rs
// Build get example.
use anyhow::Result;
use azure_devops_rust_api::build;
use std::env;
mod utils;
#[tokio::main]
async fn main() -> Result<()> {
// Get authentication credential
let credential = utils::get_credential()?;
// Get ADO configuration via environment variables
let organization = env::var("ADO_ORGANIZATION").expect("Must define ADO_ORGANIZATION");
let project = env::var("ADO_PROJECT").expect("Must define ADO_PROJECT");
let build_id: i32 = env::args()
.nth(1)
.expect("Usage: build_get <build-id>")
.parse()?;
// Create a build client
println!("Create build client");
let build_client = build::ClientBuilder::new(credential).build();
// Get specified build
println!("Get build {build_id}");
let build = build_client
.builds_client()
.get(organization, project, build_id)
.await?;
println!("Build:\n{:#?}", build);
Ok(())
}