Skip to content

Commit 554f0b9

Browse files
author
Filiz Topatan
committed
stor blueprint versions in an array
1 parent 7bcef1c commit 554f0b9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Blueprint/Blueprint/Blueprint.format.ps1xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@
111111
<ListItem>
112112
<Label>Versions</Label>
113113
<PropertyName>Versions</PropertyName>
114+
<ItemSelectionCondition>
115+
<ScriptBlock>
116+
$_.Versions.count -gt 0
117+
</ScriptBlock>
118+
</ItemSelectionCondition>
114119
</ListItem>
115120
<ListItem>
116121
<PropertyName>Description</PropertyName>

src/Blueprint/Blueprint/Models/PSBlueprint.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@
1414

1515
using Microsoft.Azure.Management.Blueprint.Models;
1616
using System;
17+
using System.Collections;
1718
using System.Collections.Generic;
1819
using System.Linq;
1920
using Microsoft.Azure.Commands.Blueprint.Common;
21+
using Newtonsoft.Json;
22+
using Newtonsoft.Json.Linq;
2023

2124
namespace Microsoft.Azure.Commands.Blueprint.Models
2225
{
2326
public class PSBlueprint : PSBlueprintBase
2427
{
25-
public object Versions { get; set; }
28+
public string[] Versions { get; set; }
2629

2730
/// <summary>
2831
/// Create a PSBlueprint object from a BlueprintModel.
@@ -43,9 +46,15 @@ internal static PSBlueprint FromBlueprintModel(BlueprintModel model, string scop
4346
TargetScope = PSBlueprintTargetScope.Unknown,
4447
Parameters = new Dictionary<string, PSParameterDefinition>(),
4548
ResourceGroups = new Dictionary<string, PSResourceGroupDefinition>(),
46-
Versions = model.Versions
49+
Versions = null
4750
};
4851

52+
if (model.Versions != null)
53+
{
54+
var versionsDict = JObject.FromObject(model.Versions).ToObject<Dictionary<string, object>>();
55+
psBlueprint.Versions = versionsDict.Keys.ToArray();
56+
}
57+
4958
if (DateTime.TryParse(model.Status.TimeCreated, out DateTime timeCreated))
5059
{
5160
psBlueprint.Status.TimeCreated = timeCreated;

0 commit comments

Comments
 (0)