Skip to content

Commit 0936a50

Browse files
authored
Merge pull request #1174 from CompositionalIT/vm_features
VM support for Azure Linux 3.0, Standard SKU Public IP, Gallery Apps
2 parents 2b168ce + 541450e commit 0936a50

File tree

13 files changed

+1769
-849
lines changed

13 files changed

+1769
-849
lines changed

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Release Notes
22
=============
33

4+
## 1.9.9
5+
* Virtual Machines: support for Azure Linux 3.0
6+
* Virtual Machines: support for Standard SKU Public IP Address
7+
* Galleries: support for Gallery Applications to distribute applications for Virtual Machines and Virtual Machine Scale Sets
8+
49
## 1.9.8
510
* AKS Cluster: support for node pool availability zones
611

docs/content/api-overview/resources/gallery.md

Lines changed: 105 additions & 31 deletions
Large diffs are not rendered by default.

docs/content/api-overview/resources/virtual-machine.md

Lines changed: 57 additions & 56 deletions
Large diffs are not rendered by default.

src/Farmer/Arm/AutoscaleSettings.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let autoscaleSettings =
1111

1212
// Have avoided SRTPs in the past but end up with a lot of repetitive code, so trying them.
1313

14-
module private Option =
14+
module internal Option =
1515
let defaultUnchecked<'t> = Option.defaultValue Unchecked.defaultof<'t>
1616

1717
let inline toArmJson resourceOpt =

src/Farmer/Arm/Gallery.fs

Lines changed: 224 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ open Farmer
66
open Farmer.Image
77
open Farmer.GalleryValidation
88

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")
1111

1212
let imageVersions =
13-
ResourceType("Microsoft.Compute/galleries/images/versions", "2022-03-03")
13+
ResourceType("Microsoft.Compute/galleries/images/versions", "2023-07-03")
1414

1515
let galleryApplications =
16-
ResourceType("Microsoft.Compute/galleries/applications", "2022-03-03")
16+
ResourceType("Microsoft.Compute/galleries/applications", "2023-07-03")
1717

1818
let galleryApplicationVersions =
19-
ResourceType("Microsoft.Compute/galleries/applications/versions", "2022-03-03")
19+
ResourceType("Microsoft.Compute/galleries/applications/versions", "2023-07-03")
2020

2121
type CommunityGalleryInfo = {
2222
Eula: string
@@ -172,4 +172,223 @@ type GalleryImage = {
172172
|}
173173
releaseNoteUri = this.ReleaseNoteUri |> Option.map (fun uri -> uri.AbsoluteUri) |> Option.toObj
174174
|}
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+
|}
175394
|}

src/Farmer/Builders/Builders.AutoscaleSettings.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ type AutoscaleSettingsBuilder() =
392392

393393
member _.Yield _ = {
394394
AutoscaleSettings.Name = ResourceName.Empty
395-
Location = Location.Location "[resourceGroup().Location]"
395+
Location = Location.ResourceGroup
396396
Dependencies = Set.empty
397397
Tags = Map.empty
398398
Properties = AutoscaleSettingsPropertiesBuilder().Yield()

0 commit comments

Comments
 (0)