forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCloudMachineFeature.cs
More file actions
31 lines (24 loc) · 1.02 KB
/
CloudMachineFeature.cs
File metadata and controls
31 lines (24 loc) · 1.02 KB
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.ComponentModel;
using Azure.CloudMachine;
using Azure.Provisioning.Primitives;
namespace Azure.Provisioning.CloudMachine;
public abstract class CloudMachineFeature
{
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual void AddTo(CloudMachineInfrastructure cm) => cm.Features.Add(this);
[EditorBrowsable(EditorBrowsableState.Never)]
public void Emit(CloudMachineInfrastructure cm)
{
if (Emitted != null)
return;
ProvisionableResource provisionable = EmitCore(cm);
Emitted = provisionable;
}
protected abstract ProvisionableResource EmitCore(CloudMachineInfrastructure cm);
[EditorBrowsable(EditorBrowsableState.Never)]
public ProvisionableResource Emitted { get; protected set; } = default!;
protected internal Dictionary<Provisionable, (string RoleName, string RoleId)[]> RequiredSystemRoles { get; } = [];
}