-
Notifications
You must be signed in to change notification settings - Fork 20
/
release.rs
61 lines (52 loc) · 1.59 KB
/
release.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// release.rs
// Release example
use anyhow::Result;
use azure_devops_rust_api::release;
use std::env;
mod utils;
#[tokio::main]
async fn main() -> Result<()> {
// Get authentication credential
let credential = utils::get_credential()?;
// Get ADO server 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");
// Create release client
let release_client = release::ClientBuilder::new(credential).build();
let folder_path = r"\".to_string();
// Get list of approvals
println!("Approvals:");
let approvals = release_client
.approvals_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", approvals);
// Get list of folders
println!("\nFolders:");
let folders = release_client
.folders_client()
.list(&organization, &project, &folder_path)
.await?
.value;
println!("{:#?}", folders);
// Get list of deployments
println!("\nDeployments:");
let deployments = release_client
.deployments_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", deployments);
// Get a list of releases
println!("\nReleases:");
let releases = release_client
.releases_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", releases);
Ok(())
}