Skip to content

Commit 48c3945

Browse files
author
Kamran Khan
committed
Use VolumeEncryptionSettings instead of separate contexts for Windows and Linux
1 parent 8aacd21 commit 48c3945

File tree

3 files changed

+8
-55
lines changed

3 files changed

+8
-55
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/GetAzureDiskEncryptionStatus.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,14 @@ public override void ExecuteCmdlet()
214214
switch (osType)
215215
{
216216
case OSType.Windows:
217-
AzureDiskEncryptionStatusContext encryptionStatus = new AzureDiskEncryptionStatusContext
218-
{
219-
OsVolumeEncrypted = osVolumeEncrypted,
220-
OsVolumeEncryptionSettings = osVolumeEncryptionSettings,
221-
DataVolumesEncrypted = dataVolumesEncrypted
222-
};
223-
WriteObject(encryptionStatus);
224-
break;
225217
case OSType.Linux:
226-
AzureDiskEncryptionStatusLinuxContext encryptionStatusLinux = new AzureDiskEncryptionStatusLinuxContext
218+
AzureDiskEncryptionStatusContext encryptionStatus = new AzureDiskEncryptionStatusContext
227219
{
228220
OsVolumeEncrypted = osVolumeEncrypted,
229-
OsVolumeEncryptionSettings = null,
230221
DataVolumesEncrypted = dataVolumesEncrypted,
231-
DataVolumeEncryptionSettings = osVolumeEncryptionSettings
222+
VolumeEncryptionSettings = osVolumeEncryptionSettings
232223
};
233-
WriteObject(encryptionStatusLinux);
224+
WriteObject(encryptionStatus);
234225
break;
235226
case OSType.Unknown:
236227
ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, "OS type unknown.")),

src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -548,49 +548,18 @@
548548
<Label>OsVolumeEncrypted</Label>
549549
<PropertyName>OsVolumeEncrypted</PropertyName>
550550
</ListItem>
551-
<ListItem>
552-
<Label>OsVolumeEncryptionSettings</Label>
553-
<PropertyName>OsVolumeEncryptionSettingsText</PropertyName>
554-
</ListItem>
555551
<ListItem>
556552
<Label>DataVolumesEncrypted</Label>
557553
<PropertyName>DataVolumesEncrypted</PropertyName>
558554
</ListItem>
555+
<ListItem>
556+
<Label>VolumeEncryptionSettings</Label>
557+
<PropertyName>VolumeEncryptionSettings</PropertyName>
558+
</ListItem>
559559
</ListItems>
560560
</ListEntry>
561561
</ListEntries>
562562
</ListControl>
563563
</View>
564-
<View>
565-
<Name>Microsoft.Azure.Commands.Compute.Models.AzureDiskEncryptionStatusLinuxContext</Name>
566-
<OutOfBand />
567-
<ViewSelectedBy>
568-
<TypeName>Microsoft.Azure.Commands.Compute.Models.AzureDiskEncryptionStatusLinuxContext</TypeName>
569-
</ViewSelectedBy>
570-
<ListControl>
571-
<ListEntries>
572-
<ListEntry>
573-
<ListItems>
574-
<ListItem>
575-
<Label>OsVolumeEncrypted</Label>
576-
<PropertyName>OsVolumeEncrypted</PropertyName>
577-
</ListItem>
578-
<ListItem>
579-
<Label>OsVolumeEncryptionSettings</Label>
580-
<PropertyName>OsVolumeEncryptionSettingsText</PropertyName>
581-
</ListItem>
582-
<ListItem>
583-
<Label>DataVolumesEncrypted</Label>
584-
<PropertyName>DataVolumesEncrypted</PropertyName>
585-
</ListItem>
586-
<ListItem>
587-
<Label>DataVolumeEncryptionSettings</Label>
588-
<PropertyName>DataVolumeEncryptionSettingsText</PropertyName>
589-
</ListItem>
590-
</ListItems>
591-
</ListEntry>
592-
</ListEntries>
593-
</ListControl>
594-
</View>
595564
</ViewDefinitions>
596565
</Configuration>

src/ResourceManager/Compute/Commands.Compute/Models/AzureDiskEncryptionStatusContext.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ enum EncryptionStatus
1313
class AzureDiskEncryptionStatusContext
1414
{
1515
public EncryptionStatus OsVolumeEncrypted { get; set; }
16-
public DiskEncryptionSettings OsVolumeEncryptionSettings { get; set; }
17-
public EncryptionStatus DataVolumesEncrypted { get; set; }
18-
}
19-
class AzureDiskEncryptionStatusLinuxContext
20-
{
21-
public EncryptionStatus OsVolumeEncrypted { get; set; }
22-
public DiskEncryptionSettings OsVolumeEncryptionSettings { get; set; }
23-
public DiskEncryptionSettings DataVolumeEncryptionSettings { get; set; }
16+
public DiskEncryptionSettings VolumeEncryptionSettings { get; set; }
2417
public EncryptionStatus DataVolumesEncrypted { get; set; }
2518
}
2619
}

0 commit comments

Comments
 (0)