-
Notifications
You must be signed in to change notification settings - Fork 14
/
functions.ts
33 lines (21 loc) · 1.41 KB
/
functions.ts
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
import {BaseUtility, IngredientManager} from '@azbake/core'
import { ResourceManagementClient } from '@azure/arm-resources';
export class AvailabilitySetUtils extends BaseUtility {
public create_resource_name(): string {
let util = IngredientManager.getIngredientFunction("coreutils", this.context);
const name = util.create_resource_name("avail", null, true);
return name;
}
public async get_fault_domain_count(): Promise<number> {
let util = IngredientManager.getIngredientFunction("coreutils", this.context);
let client = new ResourceManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);
let availResource = await client.resources.get(await util.resource_group(), "Microsoft.Compute", "", "availabilitySets", name, "2018-06-01");
return availResource.properties.platformFaultDomainCount;
}
public async get_update_domain_count(): Promise<number> {
let util = IngredientManager.getIngredientFunction("coreutils", this.context);
let client = new ResourceManagementClient(this.context.AuthToken, this.context.Environment.authentication.subscriptionId);
let availResource = await client.resources.get(await util.resource_group(), "Microsoft.Compute", "", "availabilitySets", name, "2018-06-01");
return availResource.properties.platformUpdateDomainCount;
}
}