From 1ffcd53e464f24518f15e47783f7758d3108a9b8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 26 Mar 2024 21:27:56 +0000 Subject: [PATCH] Autogen code --- src/Compute/Compute/ChangeLog.md | 4 ++++ .../Disk/Config/SetAzDiskSecurityProfile.cs | 23 +++++++++++-------- .../Compute/Generated/Models/PSDisk.cs | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index c9aee39449a1..aa2b7217ac05 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -20,6 +20,10 @@ --> ## Upcoming Release +* Updated `Set-AzDiskSecurityProfile` cmdlet. + - Added new business logic for the existing parameter `SecurityType`. The default value is now set to `ConfidentialVM` unless the user specifies a value. The `SecurityType` value is temporarily changed to all lower case for verification and then changed back to all upper case after assignment. +* Fixed `New-AzVmss` to correctly work when using `-EdgeZone` by creating the Load Balancer in the correct edge zone. +* Removed references to image aliases in `New-AzVM` and `New-AzVmss` to images that were removed. * Fixed `New-AzVmss` to correctly work when using `-EdgeZone` by creating the Load Balancer in the correct edge zone. * Removed references to image aliases in `New-AzVM` and `New-AzVmss` to images that were removed. diff --git a/src/Compute/Compute/Generated/Disk/Config/SetAzDiskSecurityProfile.cs b/src/Compute/Compute/Generated/Disk/Config/SetAzDiskSecurityProfile.cs index 47e72f79c7d6..f6a2aed2f32e 100644 --- a/src/Compute/Compute/Generated/Disk/Config/SetAzDiskSecurityProfile.cs +++ b/src/Compute/Compute/Generated/Disk/Config/SetAzDiskSecurityProfile.cs @@ -1,4 +1,4 @@ -// ---------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,12 +41,12 @@ public class SetAzDiskSecurityProfile : Microsoft.Azure.Commands.ResourceManager public PSDisk Disk { get; set; } [Parameter( - Mandatory = true, + Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Gets or sets the SecurityType property. Possible values include: TrustedLaunch, ConfidentialVM_DiskEncryptedWithCustomerKey, ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey, ConfidentialVM_DiskEncryptedWithPlatformKey")] [PSArgumentCompleter("Standard", "TrustedLaunch", "ConfidentialVM_DiskEncryptedWithCustomerKey", "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", "ConfidentialVM_DiskEncryptedWithPlatformKey")] - public string SecurityType { get; set; } + public string SecurityType { get; set; } = "ConfidentialVM"; [Parameter( Mandatory = false, @@ -64,9 +64,14 @@ protected override void ProcessRecord() private void Run() { - // At this time, it is impossible to set SecurityType to Standard ("") as it is a mandatory property on the backend. - // If Standard is used, then there should be no securityProfile at all for now. - if (SecurityType.ToLower() != ConstantValues.StandardSecurityType) + SecurityType = SecurityType.ToLower(); + if (SecurityType != "standard" && SecurityType != "confidentialvm" && SecurityType != "trustedlaunch") + { + throw new ArgumentException($"Invalid SecurityType value: {SecurityType}"); + } + SecurityType = SecurityType.ToUpper(); + + if (SecurityType != ConstantValues.StandardSecurityType) { if(this.Disk.SecurityProfile == null) { @@ -75,8 +80,7 @@ private void Run() this.Disk.SecurityProfile.SecurityType = SecurityType; } - // Allow the Standard scenario, which will be nulled out just before the .Net SDK create call for disks. - if (SecurityType.ToLower() == ConstantValues.StandardSecurityType) + if (SecurityType == ConstantValues.StandardSecurityType) { if (this.Disk.SecurityProfile == null) { @@ -98,4 +102,5 @@ private void Run() } } -} \ No newline at end of file +} + diff --git a/src/Compute/Compute/Generated/Models/PSDisk.cs b/src/Compute/Compute/Generated/Models/PSDisk.cs index d257855adaae..fbc18b433486 100644 --- a/src/Compute/Compute/Generated/Models/PSDisk.cs +++ b/src/Compute/Compute/Generated/Models/PSDisk.cs @@ -1,4 +1,4 @@ -// + // // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License");