22using System ;
33using System . Collections . Generic ;
44using PoolName = System . String ;
5- using Endpoint = System . String ;
6- using GroupId = System . Guid ;
7- using PrincipalId = System . Guid ;
5+ using Region = System . String ;
6+ using Container = System . String ;
87
98namespace Microsoft . OneFuzz . Service ;
109
@@ -101,7 +100,7 @@ public enum NodeState
101100
102101public record ProxyHeartbeat
103102(
104- string Region ,
103+ Region Region ,
105104 Guid ProxyId ,
106105 List < ProxyForward > Forwards ,
107106 DateTimeOffset TimeStamp
@@ -125,7 +124,7 @@ bool DebugKeepNode
125124
126125public partial record ProxyForward
127126(
128- [ PartitionKey ] string Region ,
127+ [ PartitionKey ] Region Region ,
129128 [ RowKey ] int DstPort ,
130129 int SrcPort ,
131130 string DstIp
@@ -135,7 +134,7 @@ public partial record ProxyConfig
135134(
136135 Uri Url ,
137136 string Notification ,
138- string Region ,
137+ Region Region ,
139138 Guid ? ProxyId ,
140139 List < ProxyForward > Forwards ,
141140 string InstanceTelemetryKey ,
@@ -145,7 +144,7 @@ string MicrosoftTelemetryKey
145144
146145public partial record Proxy
147146(
148- [ PartitionKey ] string Region ,
147+ [ PartitionKey ] Region Region ,
149148 [ RowKey ] Guid ProxyId ,
150149 DateTimeOffset ? CreatedTimestamp ,
151150 VmState State ,
@@ -170,9 +169,72 @@ String InstanceName
170169) : EntityBase ( ) ;
171170
172171
173- //record AnyHttpUrl(AnyUrl):
174- // allowed_schemes = {'http', 'https
175- //
172+ public record TaskDetails (
173+
174+ TaskType Type ,
175+ int Duration ,
176+ string ? TargetExe ,
177+ Dictionary < string , string > ? TargetEnv ,
178+ List < string > ? TargetOptions ,
179+ int ? TargetWorkers ,
180+ bool ? TargetOptionsMerge ,
181+ bool ? CheckAsanLog ,
182+ bool ? CheckDebugger ,
183+ int ? CheckRetryCount ,
184+ bool ? CheckFuzzerHelp ,
185+ bool ? ExpectCrashOnFailure ,
186+ bool ? RenameOutput ,
187+ string ? SupervisorExe ,
188+ Dictionary < string , string > ? SupervisorEnv ,
189+ List < string > ? SupervisorOptions ,
190+ string ? SupervisorInputMarker ,
191+ string ? GeneratorExe ,
192+ Dictionary < string , string > ? GeneratorEnv ,
193+ List < string > ? GeneratorOptions ,
194+ string ? AnalyzerExe ,
195+ Dictionary < string , string > ? AnalyzerEnv ,
196+ List < string > AnalyzerOptions ,
197+ ContainerType ? WaitForFiles ,
198+ string ? StatsFile ,
199+ StatsFormat ? StatsFormat ,
200+ bool ? RebootAfterSetup ,
201+ int ? TargetTimeout ,
202+ int ? EnsembleSyncDelay ,
203+ bool ? PreserveExistingOutputs ,
204+ List < string > ? ReportList ,
205+ int ? MinimizedStackDepth ,
206+ string ? CoverageFilter
207+ ) ;
208+
209+ public record TaskVm (
210+ Region Region ,
211+ string Sku ,
212+ string Image ,
213+ int Count ,
214+ bool SpotInstance ,
215+ bool ? RebootAfterSetup
216+ ) ;
217+
218+ public record TaskPool (
219+ int Count ,
220+ PoolName PoolName
221+ ) ;
222+
223+ public record TaskContainers (
224+ ContainerType Type ,
225+ Container Name
226+ ) ;
227+ public record TaskConfig (
228+ Guid JobId ,
229+ List < Guid > ? PrereqTasks ,
230+ TaskDetails Task ,
231+ TaskVm ? Vm ,
232+ TaskPool ? Pool ,
233+ List < TaskContainers > ? Containers ,
234+ Dictionary < string , string > ? Tags ,
235+ List < TaskDebugFlag > ? Debug ,
236+ bool ? Colocate
237+ ) ;
176238
177239
178240public record TaskEventSummary (
@@ -204,118 +266,5 @@ public record Task(
204266{
205267 List < TaskEventSummary > Events { get ; set ; } = new List < TaskEventSummary > ( ) ;
206268 List < NodeAssignment > Nodes { get ; set ; } = new List < NodeAssignment > ( ) ;
207- }
208- public record AzureSecurityExtensionConfig ( ) ;
209- public record GenevaExtensionConfig ( ) ;
210-
211-
212- public record KeyvaultExtensionConfig (
213- string KeyVaultName ,
214- string CertName ,
215- string CertPath ,
216- string ExtensionStore
217- ) ;
218-
219- public record AzureMonitorExtensionConfig (
220- string ConfigVersion ,
221- string Moniker ,
222- string Namespace ,
223- [ property: JsonPropertyName ( "monitoringGSEnvironment" ) ] string MonitoringGSEnvironment ,
224- [ property: JsonPropertyName ( "monitoringGCSAccount" ) ] string MonitoringGCSAccount ,
225- [ property: JsonPropertyName ( "monitoringGCSAuthId" ) ] string MonitoringGCSAuthId ,
226- [ property: JsonPropertyName ( "monitoringGCSAuthIdType" ) ] string MonitoringGCSAuthIdType
227- ) ;
228269
229- public record AzureVmExtensionConfig (
230- KeyvaultExtensionConfig ? Keyvault ,
231- AzureMonitorExtensionConfig AzureMonitor
232- ) ;
233-
234- public record NetworkConfig (
235- string AddressSpace ,
236- string Subnet
237- )
238- {
239- public NetworkConfig ( ) : this ( "10.0.0.0/8" , "10.0.0.0/16" ) { }
240- }
241-
242- public record NetworkSecurityGroupConfig (
243- string [ ] AllowedServiceTags ,
244- string [ ] AllowedIps
245- )
246- {
247- public NetworkSecurityGroupConfig ( ) : this ( Array . Empty < string > ( ) , Array . Empty < string > ( ) ) { }
248- }
249-
250- public record ApiAccessRule (
251- string [ ] Methods ,
252- Guid [ ] AllowedGroups
253- ) ;
254-
255- public record InstanceConfig
256- (
257- [ PartitionKey , RowKey ] string InstanceName ,
258- //# initial set of admins can only be set during deployment.
259- //# if admins are set, only admins can update instance configs.
260- Guid [ ] ? Admins ,
261- //# if set, only admins can manage pools or scalesets
262- bool AllowPoolManagement ,
263- string [ ] AllowedAadTenants ,
264- NetworkConfig NetworkConfig ,
265- NetworkSecurityGroupConfig ProxyNsgConfig ,
266- AzureVmExtensionConfig ? Extensions ,
267- string ProxyVmSku ,
268- IDictionary < Endpoint , ApiAccessRule > ? ApiAccessRules ,
269- IDictionary < PrincipalId , GroupId [ ] > ? GroupMembership ,
270-
271- IDictionary < string , string > ? VmTags ,
272- IDictionary < string , string > ? VmssTags
273- ) : EntityBase ( )
274- {
275- public InstanceConfig ( string instanceName ) : this (
276- instanceName ,
277- null ,
278- true ,
279- Array . Empty < string > ( ) ,
280- new NetworkConfig ( ) ,
281- new NetworkSecurityGroupConfig ( ) ,
282- null ,
283- "Standard_B2s" ,
284- null ,
285- null ,
286- null ,
287- null )
288- { }
289-
290- public List < Guid > ? CheckAdmins ( List < Guid > ? value )
291- {
292- if ( value is not null && value . Count == 0 )
293- {
294- throw new ArgumentException ( "admins must be null or contain at least one UUID" ) ;
295- }
296- else
297- {
298- return value ;
299- }
300- }
301-
302-
303- //# At the moment, this only checks allowed_aad_tenants, however adding
304- //# support for 3rd party JWT validation is anticipated in a future release.
305- public ResultOk < List < string > > CheckInstanceConfig ( )
306- {
307- List < string > errors = new ( ) ;
308- if ( AllowedAadTenants . Length == 0 )
309- {
310- errors . Add ( "allowed_aad_tenants must not be empty" ) ;
311- }
312- if ( errors . Count == 0 )
313- {
314- return ResultOk < List < string > > . Ok ( ) ;
315- }
316- else
317- {
318- return ResultOk < List < string > > . Error ( errors ) ;
319- }
320- }
321270}
0 commit comments