diff --git a/src/Farmer/Arm/DBforPostgreSQL.fs b/src/Farmer/Arm/DBforPostgreSQL.fs index 3e902572d..328c79239 100644 --- a/src/Farmer/Arm/DBforPostgreSQL.fs +++ b/src/Farmer/Arm/DBforPostgreSQL.fs @@ -10,7 +10,16 @@ let databases = ResourceType "Microsoft.DBforPostgreSQL/servers/databases" let firewallRules = ResourceType "Microsoft.DBforPostgreSQL/servers/firewallrules" let servers = ResourceType "Microsoft.DBforPostgreSQL/servers" -type [] PostgreSQLFamily = Gen5 +type [] PostgreSQLFamily = +| Gen5 + + override this.ToString() = + match this with + | Gen5 -> "Gen5" + + member this.AsArmValue = + match this with + | Gen5 -> "Gen5" module Servers = type Database = @@ -60,7 +69,7 @@ type Server = BackupRetention : int } member this.Sku = - {| name = sprintf "%s_%O_%d" this.Tier.Name this.Family this.Capacity + {| name = sprintf "%s_%s_%d" this.Tier.Name this.Family.AsArmValue this.Capacity tier = string this.Tier capacity = this.Capacity family = string this.Family diff --git a/src/Tests/PostgreSQL.fs b/src/Tests/PostgreSQL.fs index 8ad2b5d6c..525fb5b80 100644 --- a/src/Tests/PostgreSQL.fs +++ b/src/Tests/PostgreSQL.fs @@ -7,6 +7,7 @@ open Farmer open Farmer.PostgreSQL open Farmer.Builders open Newtonsoft.Json.Linq +open Farmer.Arm type PostgresSku = { name : string @@ -266,4 +267,9 @@ let tests = testList "PostgreSQL Database Service" [ Expect.throws (fun () -> Validate.capacity 13) "Capacity not a power of two" Expect.throwsNot (fun () -> Validate.capacity 16) "Capacity just right" } + + test "Family name should not include type name" { + Expect.equal PostgreSQLFamily.Gen5.AsArmValue "Gen5" "Wrong value for Gen5 family" + Expect.equal (PostgreSQLFamily.Gen5.ToString()) "Gen5" "Wrong value for Gen5 family" + } ] \ No newline at end of file