-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArmParameters.cs
63 lines (47 loc) · 2.07 KB
/
ArmParameters.cs
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
62
63
using CloudWorker.Client.SDK.ARM;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
namespace CloudWorker.Client.SDK;
public class ArmParamValue<T> where T : notnull
{
public T Value { get; set; }
public ArmParamValue(T value)
{
Value = value;
}
[return: NotNullIfNotNull(nameof(value))]
static public ArmParamValue<T>? Create(T? value)
{
return value == null ? null : new ArmParamValue<T>(value);
}
[return: NotNullIfNotNull(nameof(value))]
static public ArmParamValue<ST>? Create<ST>(Nullable<ST> value) where ST : struct
{
return value.HasValue ? new ArmParamValue<ST>(value.Value) : null;
}
}
//TODO: Validate ArmParamValue<T> in IValidatable.Validate?
public class StarterParameters
{
//TODO: Validate this property?
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<string>? Location { get; set; }
//TODO: Support custom service
public required ArmParamValue<string> Service { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<IEnumerable<SecureEnvironmentVariable>>? EnvironmentVariables { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<IEnumerable<FileShareMount>>? FileShares { get; set; }
public required ArmParamValue<string> MessagingRgName { get; set; }
public required ArmParamValue<string> ComputingRgName { get; set; }
public required ArmParamValue<string> ServiceBusName { get; set; }
public required ArmParamValue<string> AppInsightsName { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<int>? NodeCount { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<ServiceBusQueueOptions>? ServiceBusQueueOptions { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ArmParamValue<NodeOptions>? NodeOptions { get; set; }
}