-
Notifications
You must be signed in to change notification settings - Fork 20
/
extension_management_list.rs
49 lines (40 loc) · 1.43 KB
/
extension_management_list.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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// extension_management_list.rs
// extension_management_list example.
use anyhow::Result;
use azure_devops_rust_api::extension_management;
use azure_devops_rust_api::extension_management::models::InstalledExtension;
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");
// Create a extension_management_client
let extension_management_client = extension_management::ClientBuilder::new(credential).build();
// Get all the installed extensions
let installed_extensions = extension_management_client
.installed_extensions_client()
.list(organization)
.await?
.value;
println!("Installed extensions:");
for extension in installed_extensions.iter() {
if let InstalledExtension {
extension_name: Some(name),
publisher_name: Some(publisher),
version: Some(version),
..
} = extension
{
println!("{:65}{:24}{:40}", name, version, publisher);
}
}
if let Some(extension) = installed_extensions.first() {
println!("\nExample extension:\n{:#?}", extension);
}
Ok(())
}