@@ -6,17 +6,17 @@ open Farmer
6
6
open Farmer.Image
7
7
open Farmer.GalleryValidation
8
8
9
- let galleries = ResourceType( " Microsoft.Compute/galleries" , " 2022-03 -03" )
10
- let galleryImages = ResourceType( " Microsoft.Compute/galleries/images" , " 2022-03 -03" )
9
+ let galleries = ResourceType( " Microsoft.Compute/galleries" , " 2023-07 -03" )
10
+ let galleryImages = ResourceType( " Microsoft.Compute/galleries/images" , " 2023-07 -03" )
11
11
12
12
let imageVersions =
13
- ResourceType( " Microsoft.Compute/galleries/images/versions" , " 2022-03 -03" )
13
+ ResourceType( " Microsoft.Compute/galleries/images/versions" , " 2023-07 -03" )
14
14
15
15
let galleryApplications =
16
- ResourceType( " Microsoft.Compute/galleries/applications" , " 2022-03 -03" )
16
+ ResourceType( " Microsoft.Compute/galleries/applications" , " 2023-07 -03" )
17
17
18
18
let galleryApplicationVersions =
19
- ResourceType( " Microsoft.Compute/galleries/applications/versions" , " 2022-03 -03" )
19
+ ResourceType( " Microsoft.Compute/galleries/applications/versions" , " 2023-07 -03" )
20
20
21
21
type CommunityGalleryInfo = {
22
22
Eula: string
@@ -172,4 +172,223 @@ type GalleryImage = {
172
172
|}
173
173
releaseNoteUri = this.ReleaseNoteUri |> Option.map ( fun uri -> uri.AbsoluteUri) |> Option.toObj
174
174
|}
175
+ |}
176
+
177
+ [<RequireQualifiedAccess>]
178
+ type ParameterType =
179
+ | ConfigurationDataBlob
180
+ | LogOutputBlob
181
+ | String of DefaultValue : string option
182
+
183
+ member internal this.ToArmJson =
184
+ match this with
185
+ | ConfigurationDataBlob -> " ConfigurationDataBlob"
186
+ | LogOutputBlob -> " LogOutputBlob"
187
+ | String _ -> " String"
188
+
189
+ type CustomActionParameter = {
190
+ Description: string option
191
+ Name: string
192
+ Required: bool option
193
+ ParameterType: ParameterType
194
+ } with
195
+
196
+ member internal this.ToArmJson = {|
197
+ defaultValue =
198
+ match this.ParameterType with
199
+ | ParameterType.String( Some defaultVal) -> defaultVal
200
+ | _ -> null
201
+ description = this.Description |> Option.toObj
202
+ name = this.Name
203
+ required = this.Required |> Option.toNullable
204
+ `` type `` = this.ParameterType.ToArmJson
205
+ |}
206
+
207
+ type CustomAction = {
208
+ Description: string option
209
+ Name: string
210
+ Parameters: CustomActionParameter list
211
+ Script: string
212
+ } with
213
+
214
+ member internal this.ToArmJson = {|
215
+ description = this.Description |> Option.toObj
216
+ name = this.Name
217
+ parameters = this.Parameters |> List.map _. ToArmJson
218
+ script = this.Script
219
+ |}
220
+
221
+ type GalleryApplication = {
222
+ Name: GalleryApplicationName
223
+ GalleryName: GalleryName
224
+ Location: Location
225
+ CustomActions: CustomAction list
226
+ Description: string option
227
+ EndOfLifeDate: DateTimeOffset option
228
+ Eula: string option
229
+ OsType: OS
230
+ PrivacyStatementUri: Uri option
231
+ ReleaseNoteUri: Uri option
232
+ Tags: Map < string , string >
233
+ Dependencies: Set < ResourceId >
234
+ } with
235
+
236
+ interface IArmResource with
237
+ member this.ResourceId =
238
+ galleryApplications.resourceId ( this.GalleryName.ResourceName, this.Name.ResourceName)
239
+
240
+ member this.JsonModel = {|
241
+ galleryApplications.Create(
242
+ this.GalleryName.ResourceName / this.Name.ResourceName,
243
+ this.Location,
244
+ dependsOn = this.Dependencies,
245
+ tags = this.Tags
246
+ ) with
247
+ properties = {|
248
+ customActions = this.CustomActions |> List.map _. ToArmJson
249
+ description = this.Description |> Option.toObj
250
+ endOfLifeDate = this.EndOfLifeDate |> Option.map (_. ToString( " yyyy-MM-dd" )) |> Option.toObj
251
+ eula = this.Eula |> Option.toObj
252
+ supportedOSType = string< OS> this.OsType
253
+ privacyStatementUri =
254
+ this.PrivacyStatementUri
255
+ |> Option.map ( fun uri -> uri.AbsoluteUri)
256
+ |> Option.toObj
257
+ releaseNoteUri = this.ReleaseNoteUri |> Option.map ( fun uri -> uri.AbsoluteUri) |> Option.toObj
258
+ |}
259
+ |}
260
+
261
+ type ManageActions = {
262
+ Install: string
263
+ Remove: string
264
+ Update: string option
265
+ } with
266
+
267
+ static member Empty = {
268
+ Install = " "
269
+ Remove = " "
270
+ Update = None
271
+ }
272
+
273
+ member internal this.ToArmJson = {|
274
+ install = this.Install
275
+ remove = this.Remove
276
+ update = this.Update |> Option.toObj
277
+ |}
278
+
279
+ type ReplicationMode =
280
+ | Full
281
+ | Shallow
282
+
283
+ member this.ArmValue =
284
+ match this with
285
+ | Full -> " Full"
286
+ | Shallow -> " Shallow"
287
+
288
+ type UserArtifactSettings = {
289
+ ConfigFileName: string option
290
+ PackageFileName: string option
291
+ } with
292
+
293
+ member internal this.ToArmJson = {|
294
+ configFileName = this.ConfigFileName |> Option.toObj
295
+ packageFileName = this.PackageFileName |> Option.toObj
296
+ |}
297
+
298
+ type UserArtifactSource = {
299
+ DefaultConfigurationLink: Uri option
300
+ MediaLink: Uri
301
+ } with
302
+
303
+ static member Empty = {
304
+ DefaultConfigurationLink = None
305
+ MediaLink = null
306
+ }
307
+
308
+ member internal this.ToArmJson = {|
309
+ defaultConfigurationLink = this.DefaultConfigurationLink |> Option.toObj
310
+ mediaLink = this.MediaLink
311
+ |}
312
+
313
+ [<RequireQualifiedAccess>]
314
+ type StorageAccountType =
315
+ | Premium_ LRS
316
+ | Standard_ LRS
317
+ | Standard_ ZRS
318
+
319
+ member internal this.ArmValue =
320
+ match this with
321
+ | Premium_ LRS -> " Premium_LRS"
322
+ | Standard_ LRS -> " Standard_LRS"
323
+ | Standard_ ZRS -> " Standard_ZRS"
324
+
325
+ type TargetRegion = {
326
+ ExcludeFromLatest: bool option
327
+ Name: Location
328
+ RegionalReplicaCount: int option
329
+ StorageAccountType: StorageAccountType option
330
+ } with
331
+
332
+ member internal this.ToArmJson = {|
333
+ excludeFromLatest = this.ExcludeFromLatest |> Option.toNullable
334
+ name = this.Name.ArmValue
335
+ regionalReplicaCount = this.RegionalReplicaCount |> Option.toNullable
336
+ storageAccountType = this.StorageAccountType |> Option.map _. ArmValue |> Option.toObj
337
+ |}
338
+
339
+ type GalleryApplicationVersion = {
340
+ Name: GalleryApplicationVersionName
341
+ GalleryApplicationName: GalleryApplicationName
342
+ GalleryName: GalleryName
343
+ Location: Location
344
+ CustomActions: CustomAction list
345
+ EnableHealthCheck: bool option
346
+ EndOfLifeDate: DateTimeOffset option
347
+ ExcludeFromLatest: bool option
348
+ ManageActions: ManageActions
349
+ ReplicaCount: int option
350
+ ReplicationMode: ReplicationMode option
351
+ Settings: UserArtifactSettings option
352
+ Source: UserArtifactSource
353
+ StorageAccountType: StorageAccountType option
354
+ TargetRegions: TargetRegion list
355
+ Tags: Map < string , string >
356
+ Dependencies: Set < ResourceId >
357
+ } with
358
+
359
+ interface IArmResource with
360
+ member this.ResourceId =
361
+ galleryApplicationVersions.resourceId (
362
+ this.GalleryName.ResourceName
363
+ / this.GalleryApplicationName.ResourceName
364
+ / this.Name.ResourceName
365
+ )
366
+
367
+ member this.JsonModel = {|
368
+ galleryApplicationVersions.Create(
369
+ this.GalleryName.ResourceName
370
+ / this.GalleryApplicationName.ResourceName
371
+ / this.Name.ResourceName,
372
+ this.Location,
373
+ dependsOn = this.Dependencies,
374
+ tags = this.Tags
375
+ ) with
376
+ properties = {|
377
+ publishingProfile = {|
378
+ customActions = this.CustomActions |> List.map _. ToArmJson
379
+ enableHealthCheck = this.EnableHealthCheck |> Option.toNullable
380
+ endOfLifeDate = this.EndOfLifeDate |> Option.map (_. ToString( " yyyy-MM-dd" )) |> Option.toObj
381
+ excludeFromLatest = this.ExcludeFromLatest |> Option.toNullable
382
+ manageActions = this.ManageActions.ToArmJson
383
+ replicaCount = this.ReplicaCount |> Option.toNullable
384
+ replicationMode = this.ReplicationMode |> Option.map _. ArmValue |> Option.toObj
385
+ settings =
386
+ this.Settings
387
+ |> Option.map _. ToArmJson
388
+ |> Option.defaultValue Unchecked.defaultof<_>
389
+ source = this.Source.ToArmJson
390
+ storageAccountType = this.StorageAccountType |> Option.map _. ArmValue |> Option.toObj
391
+ targetRegions = this.TargetRegions |> List.map _. ToArmJson
392
+ |}
393
+ |}
175
394
|}
0 commit comments