-
Notifications
You must be signed in to change notification settings - Fork 20
/
distributed_task.rs
51 lines (43 loc) · 1.67 KB
/
distributed_task.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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// distributed_task.rs
// Distributed Task example
use anyhow::Result;
use azure_devops_rust_api::distributed_task;
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 distributed task client
let distributed_task_client = distributed_task::ClientBuilder::new(credential).build();
// Get a list of agent pools for the org
println!("Agents pools for the org are:");
let distributed_task_agents_pools = distributed_task_client
.pools_client()
.get_agent_pools(&organization)
.await?
.value;
println!("{:#?}", distributed_task_agents_pools);
// Get a list of agent queues for the project
println!("Agents queues for the project are:");
let distributed_task_agent_queues = distributed_task_client
.queues_client()
.get_agent_queues(&organization, &project)
.await?
.value;
println!("{:#?}", distributed_task_agent_queues);
// Get all variable groups for the project
println!("Variable groups for the project are:");
let distributed_task_variable_groups = distributed_task_client
.variablegroups_client()
.get_variable_groups(&organization, &project)
.await?
.value;
println!("{:#?}", distributed_task_variable_groups);
Ok(())
}