diff --git a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs index 44e614e1003d..7a7746435395 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs @@ -4197,9 +4197,10 @@ public ComputeScheduledEventsProfile() { } } public partial class ComputeSecurityPostureReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ComputeSecurityPostureReference() { } - public System.Collections.Generic.IList ExcludeExtensions { get { throw null; } } + public ComputeSecurityPostureReference(Azure.Core.ResourceIdentifier id) { } + public System.Collections.Generic.IList ExcludeExtensions { get { throw null; } } public Azure.Core.ResourceIdentifier Id { get { throw null; } set { } } + public bool? IsOverridable { get { throw null; } set { } } Azure.ResourceManager.Compute.Models.ComputeSecurityPostureReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Compute.Models.ComputeSecurityPostureReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -7113,6 +7114,18 @@ public ScheduledEventsPolicy() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.SecurityEncryptionType left, Azure.ResourceManager.Compute.Models.SecurityEncryptionType right) { throw null; } public override string ToString() { throw null; } } + public partial class SecurityPostureReferenceUpdate : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecurityPostureReferenceUpdate() { } + public System.Collections.Generic.IList ExcludeExtensions { get { throw null; } } + public string Id { get { throw null; } set { } } + public bool? IsOverridable { get { throw null; } set { } } + Azure.ResourceManager.Compute.Models.SecurityPostureReferenceUpdate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Compute.Models.SecurityPostureReferenceUpdate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class SecurityProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public SecurityProfile() { } @@ -8874,6 +8887,7 @@ public VirtualMachineScaleSetUpdateVmProfile() { } public Azure.ResourceManager.Compute.Models.ComputeScheduledEventsProfile ScheduledEventsProfile { get { throw null; } set { } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public Azure.ResourceManager.Compute.Models.TerminateNotificationProfile ScheduledEventsTerminateNotificationProfile { get { throw null; } set { } } + public Azure.ResourceManager.Compute.Models.SecurityPostureReferenceUpdate SecurityPostureReference { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.SecurityProfile SecurityProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetUpdateStorageProfile StorageProfile { get { throw null; } set { } } public string UserData { get { throw null; } set { } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs index 47a1ff24f457..f5c5b39d945c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineScaleSetCollection.cs @@ -1938,9 +1938,13 @@ public async Task CreateOrUpdate_CreateAScaleSetWithSecurityPostureReference() } }, }, - SecurityPostureReference = new ComputeSecurityPostureReference() + SecurityPostureReference = new ComputeSecurityPostureReference(new ResourceIdentifier("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest")) { - Id = new ResourceIdentifier("/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest"), + ExcludeExtensions = +{ +"{securityPostureVMExtensionName}" +}, + IsOverridable = true, }, }, Overprovision = true, diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs index fabe19ebcbb5..7845598246fd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ArmComputeModelFactory.cs @@ -191,7 +191,7 @@ public static VirtualMachineScaleSetData VirtualMachineScaleSetData(ResourceIden /// Specifies the gallery applications that should be made available to the VM/VMSS. /// Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. /// Specifies the service artifact reference id used to set same image version for all virtual machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. - /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. + /// Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. /// Specifies the time in which this VM profile for the Virtual Machine Scale Set was created. Minimum API version for this property is 2024-03-01. This value will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile with minimum api-version 2024-03-01. /// A new instance for mocking. public static VirtualMachineScaleSetVmProfile VirtualMachineScaleSetVmProfile(VirtualMachineScaleSetOSProfile osProfile = null, VirtualMachineScaleSetStorageProfile storageProfile = null, VirtualMachineScaleSetNetworkProfile networkProfile = null, SecurityProfile securityProfile = null, BootDiagnostics bootDiagnostics = null, VirtualMachineScaleSetExtensionProfile extensionProfile = null, string licenseType = null, VirtualMachinePriorityType? priority = null, VirtualMachineEvictionPolicyType? evictionPolicy = null, double? billingMaxPrice = null, ComputeScheduledEventsProfile scheduledEventsProfile = null, string userData = null, ResourceIdentifier capacityReservationGroupId = null, IEnumerable galleryApplications = null, VirtualMachineSizeProperties hardwareVmSizeProperties = null, ResourceIdentifier serviceArtifactReferenceId = null, ComputeSecurityPostureReference securityPostureReference = null, DateTimeOffset? timeCreated = null) @@ -294,55 +294,6 @@ public static ComputeSubResourceData ComputeSubResourceData(ResourceIdentifier i return new ComputeSubResourceData(id, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// How the extension handler should be forced to update even if the extension configuration has not changed. - /// The name of the extension handler publisher. - /// Specifies the type of the extension; an example is "CustomScriptExtension". - /// Specifies the version of the script handler. - /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. - /// Json formatted public settings for the extension. - /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - /// The provisioning state, which only appears in the response. - /// The virtual machine extension instance view. - /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. - /// The extensions protected settings that are passed by reference, and consumed from key vault. - /// Collection of extension names after which this extension needs to be provisioned. - /// A new instance for mocking. - public static VirtualMachineExtensionData VirtualMachineExtensionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string forceUpdateTag = null, string publisher = null, string extensionType = null, string typeHandlerVersion = null, bool? autoUpgradeMinorVersion = null, bool? enableAutomaticUpgrade = null, BinaryData settings = null, BinaryData protectedSettings = null, string provisioningState = null, VirtualMachineExtensionInstanceView instanceView = null, bool? suppressFailures = null, KeyVaultSecretReference keyVaultProtectedSettings = null, IEnumerable provisionAfterExtensions = null) - { - tags ??= new Dictionary(); - provisionAfterExtensions ??= new List(); - - return new VirtualMachineExtensionData( - id, - name, - resourceType, - systemData, - tags, - location, - forceUpdateTag, - publisher, - extensionType, - typeHandlerVersion, - autoUpgradeMinorVersion, - enableAutomaticUpgrade, - settings, - protectedSettings, - provisioningState, - instanceView, - suppressFailures, - keyVaultProtectedSettings, - provisionAfterExtensions?.ToList(), - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The instance view status summary for the virtual machine scale set. /// The extensions information. @@ -869,6 +820,55 @@ public static VirtualMachineDataDisk VirtualMachineDataDisk(int lun = default, s serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// How the extension handler should be forced to update even if the extension configuration has not changed. + /// The name of the extension handler publisher. + /// Specifies the type of the extension; an example is "CustomScriptExtension". + /// Specifies the version of the script handler. + /// Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. + /// Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available. + /// Json formatted public settings for the extension. + /// The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. + /// The provisioning state, which only appears in the response. + /// The virtual machine extension instance view. + /// Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed regardless of this value). The default is false. + /// The extensions protected settings that are passed by reference, and consumed from key vault. + /// Collection of extension names after which this extension needs to be provisioned. + /// A new instance for mocking. + public static VirtualMachineExtensionData VirtualMachineExtensionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string forceUpdateTag = null, string publisher = null, string extensionType = null, string typeHandlerVersion = null, bool? autoUpgradeMinorVersion = null, bool? enableAutomaticUpgrade = null, BinaryData settings = null, BinaryData protectedSettings = null, string provisioningState = null, VirtualMachineExtensionInstanceView instanceView = null, bool? suppressFailures = null, KeyVaultSecretReference keyVaultProtectedSettings = null, IEnumerable provisionAfterExtensions = null) + { + tags ??= new Dictionary(); + provisionAfterExtensions ??= new List(); + + return new VirtualMachineExtensionData( + id, + name, + resourceType, + systemData, + tags, + location, + forceUpdateTag, + publisher, + extensionType, + typeHandlerVersion, + autoUpgradeMinorVersion, + enableAutomaticUpgrade, + settings, + protectedSettings, + provisioningState, + instanceView, + suppressFailures, + keyVaultProtectedSettings, + provisionAfterExtensions?.ToList(), + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The console screenshot blob URI. /// The serial console log blob URI. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs index 3fa687b1f362..aca64cd283e3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.Serialization.cs @@ -26,21 +26,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo } writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); if (Optional.IsCollectionDefined(ExcludeExtensions)) { writer.WritePropertyName("excludeExtensions"u8); writer.WriteStartArray(); foreach (var item in ExcludeExtensions) { - writer.WriteObjectValue(item, options); + writer.WriteStringValue(item); } writer.WriteEndArray(); } + if (Optional.IsDefined(IsOverridable)) + { + writer.WritePropertyName("isOverridable"u8); + writer.WriteBooleanValue(IsOverridable.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -80,17 +82,14 @@ internal static ComputeSecurityPostureReference DeserializeComputeSecurityPostur return null; } ResourceIdentifier id = default; - IList excludeExtensions = default; + IList excludeExtensions = default; + bool? isOverridable = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } id = new ResourceIdentifier(property.Value.GetString()); continue; } @@ -100,21 +99,30 @@ internal static ComputeSecurityPostureReference DeserializeComputeSecurityPostur { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(item, options)); + array.Add(item.GetString()); } excludeExtensions = array; continue; } + if (property.NameEquals("isOverridable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOverridable = property.Value.GetBoolean(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ComputeSecurityPostureReference(id, excludeExtensions ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ComputeSecurityPostureReference(id, excludeExtensions ?? new ChangeTrackingList(), isOverridable, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs index f47588301e28..ee01d65e79c9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ComputeSecurityPostureReference.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Compute.Models { - /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. + /// Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. public partial class ComputeSecurityPostureReference { /// @@ -47,25 +47,39 @@ public partial class ComputeSecurityPostureReference private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ComputeSecurityPostureReference() + /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + /// is null. + public ComputeSecurityPostureReference(ResourceIdentifier id) { - ExcludeExtensions = new ChangeTrackingList(); + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + ExcludeExtensions = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. - /// List of virtual machine extensions to exclude when applying the Security Posture. + /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + /// The list of virtual machine extension names to exclude when applying the security posture. + /// Whether the security posture can be overridden by the user. /// Keeps track of any properties unknown to the library. - internal ComputeSecurityPostureReference(ResourceIdentifier id, IList excludeExtensions, IDictionary serializedAdditionalRawData) + internal ComputeSecurityPostureReference(ResourceIdentifier id, IList excludeExtensions, bool? isOverridable, IDictionary serializedAdditionalRawData) { Id = id; ExcludeExtensions = excludeExtensions; + IsOverridable = isOverridable; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. + /// Initializes a new instance of for deserialization. + internal ComputeSecurityPostureReference() + { + } + + /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. public ResourceIdentifier Id { get; set; } - /// List of virtual machine extensions to exclude when applying the Security Posture. - public IList ExcludeExtensions { get; } + /// The list of virtual machine extension names to exclude when applying the security posture. + public IList ExcludeExtensions { get; } + /// Whether the security posture can be overridden by the user. + public bool? IsOverridable { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.Serialization.cs new file mode 100644 index 000000000000..c51262ccaf2e --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Compute.Models +{ + public partial class SecurityPostureReferenceUpdate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityPostureReferenceUpdate)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsCollectionDefined(ExcludeExtensions)) + { + writer.WritePropertyName("excludeExtensions"u8); + writer.WriteStartArray(); + foreach (var item in ExcludeExtensions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsOverridable)) + { + writer.WritePropertyName("isOverridable"u8); + writer.WriteBooleanValue(IsOverridable.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SecurityPostureReferenceUpdate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityPostureReferenceUpdate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityPostureReferenceUpdate(document.RootElement, options); + } + + internal static SecurityPostureReferenceUpdate DeserializeSecurityPostureReferenceUpdate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IList excludeExtensions = default; + bool? isOverridable = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("excludeExtensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + excludeExtensions = array; + continue; + } + if (property.NameEquals("isOverridable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOverridable = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecurityPostureReferenceUpdate(id, excludeExtensions ?? new ChangeTrackingList(), isOverridable, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecurityPostureReferenceUpdate)} does not support writing '{options.Format}' format."); + } + } + + SecurityPostureReferenceUpdate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecurityPostureReferenceUpdate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecurityPostureReferenceUpdate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.cs new file mode 100644 index 000000000000..d47cb1dbfa55 --- /dev/null +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SecurityPostureReferenceUpdate.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Compute.Models +{ + /// Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. + public partial class SecurityPostureReferenceUpdate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SecurityPostureReferenceUpdate() + { + ExcludeExtensions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + /// The list of virtual machine extension names to exclude when applying the security posture. + /// Whether the security posture can be overridden by the user. + /// Keeps track of any properties unknown to the library. + internal SecurityPostureReferenceUpdate(string id, IList excludeExtensions, bool? isOverridable, IDictionary serializedAdditionalRawData) + { + Id = id; + ExcludeExtensions = excludeExtensions; + IsOverridable = isOverridable; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest. + public string Id { get; set; } + /// The list of virtual machine extension names to exclude when applying the security posture. + public IList ExcludeExtensions { get; } + /// Whether the security posture can be overridden by the user. + public bool? IsOverridable { get; set; } + } +} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs index 550b33eee820..edd5928a0d20 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.Serialization.cs @@ -41,6 +41,11 @@ void IJsonModel.Write(Utf8JsonWriter writ writer.WritePropertyName("networkProfile"u8); writer.WriteObjectValue(NetworkProfile, options); } + if (Optional.IsDefined(SecurityPostureReference)) + { + writer.WritePropertyName("securityPostureReference"u8); + writer.WriteObjectValue(SecurityPostureReference, options); + } if (Optional.IsDefined(SecurityProfile)) { writer.WritePropertyName("securityProfile"u8); @@ -122,6 +127,7 @@ internal static VirtualMachineScaleSetUpdateVmProfile DeserializeVirtualMachineS VirtualMachineScaleSetUpdateOSProfile osProfile = default; VirtualMachineScaleSetUpdateStorageProfile storageProfile = default; VirtualMachineScaleSetUpdateNetworkProfile networkProfile = default; + SecurityPostureReferenceUpdate securityPostureReference = default; SecurityProfile securityProfile = default; DiagnosticsProfile diagnosticsProfile = default; VirtualMachineScaleSetExtensionProfile extensionProfile = default; @@ -161,6 +167,15 @@ internal static VirtualMachineScaleSetUpdateVmProfile DeserializeVirtualMachineS networkProfile = VirtualMachineScaleSetUpdateNetworkProfile.DeserializeVirtualMachineScaleSetUpdateNetworkProfile(property.Value, options); continue; } + if (property.NameEquals("securityPostureReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityPostureReference = SecurityPostureReferenceUpdate.DeserializeSecurityPostureReferenceUpdate(property.Value, options); + continue; + } if (property.NameEquals("securityProfile"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -235,6 +250,7 @@ internal static VirtualMachineScaleSetUpdateVmProfile DeserializeVirtualMachineS osProfile, storageProfile, networkProfile, + securityPostureReference, securityProfile, diagnosticsProfile, extensionProfile, diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs index f5c7d33a5f37..2077a6e9ebca 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateVmProfile.cs @@ -54,6 +54,7 @@ public VirtualMachineScaleSetUpdateVmProfile() /// The virtual machine scale set OS profile. /// The virtual machine scale set storage profile. /// The virtual machine scale set network profile. + /// The virtual machine scale set security posture reference. /// The virtual machine scale set Security profile. /// The virtual machine scale set diagnostics profile. /// The virtual machine scale set extension profile. @@ -63,11 +64,12 @@ public VirtualMachineScaleSetUpdateVmProfile() /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. /// Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. /// Keeps track of any properties unknown to the library. - internal VirtualMachineScaleSetUpdateVmProfile(VirtualMachineScaleSetUpdateOSProfile osProfile, VirtualMachineScaleSetUpdateStorageProfile storageProfile, VirtualMachineScaleSetUpdateNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, VirtualMachineScaleSetHardwareProfile hardwareProfile, IDictionary serializedAdditionalRawData) + internal VirtualMachineScaleSetUpdateVmProfile(VirtualMachineScaleSetUpdateOSProfile osProfile, VirtualMachineScaleSetUpdateStorageProfile storageProfile, VirtualMachineScaleSetUpdateNetworkProfile networkProfile, SecurityPostureReferenceUpdate securityPostureReference, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, VirtualMachineScaleSetHardwareProfile hardwareProfile, IDictionary serializedAdditionalRawData) { OSProfile = osProfile; StorageProfile = storageProfile; NetworkProfile = networkProfile; + SecurityPostureReference = securityPostureReference; SecurityProfile = securityProfile; DiagnosticsProfile = diagnosticsProfile; ExtensionProfile = extensionProfile; @@ -85,6 +87,8 @@ internal VirtualMachineScaleSetUpdateVmProfile(VirtualMachineScaleSetUpdateOSPro public VirtualMachineScaleSetUpdateStorageProfile StorageProfile { get; set; } /// The virtual machine scale set network profile. public VirtualMachineScaleSetUpdateNetworkProfile NetworkProfile { get; set; } + /// The virtual machine scale set security posture reference. + public SecurityPostureReferenceUpdate SecurityPostureReference { get; set; } /// The virtual machine scale set Security profile. public SecurityProfile SecurityProfile { get; set; } /// The virtual machine scale set diagnostics profile. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs index 732c9ab548fd..f66ac7bb4c28 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVmProfile.cs @@ -69,7 +69,7 @@ public VirtualMachineScaleSetVmProfile() /// Specifies the gallery applications that should be made available to the VM/VMSS. /// Specifies the hardware profile related details of a scale set. Minimum api-version: 2021-11-01. /// Specifies the service artifact reference id used to set same image version for all virtual machines in the scale set when using 'latest' image version. Minimum api-version: 2022-11-01. - /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. + /// Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. /// Specifies the time in which this VM profile for the Virtual Machine Scale Set was created. Minimum API version for this property is 2024-03-01. This value will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile with minimum api-version 2024-03-01. /// Keeps track of any properties unknown to the library. internal VirtualMachineScaleSetVmProfile(VirtualMachineScaleSetOSProfile osProfile, VirtualMachineScaleSetStorageProfile storageProfile, VirtualMachineScaleSetNetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, VirtualMachineScaleSetExtensionProfile extensionProfile, string licenseType, VirtualMachinePriorityType? priority, VirtualMachineEvictionPolicyType? evictionPolicy, BillingProfile billingProfile, ComputeScheduledEventsProfile scheduledEventsProfile, string userData, CapacityReservationProfile capacityReservation, ApplicationProfile applicationProfile, VirtualMachineScaleSetHardwareProfile hardwareProfile, WritableSubResource serviceArtifactReference, ComputeSecurityPostureReference securityPostureReference, DateTimeOffset? timeCreated, IDictionary serializedAdditionalRawData) @@ -198,7 +198,7 @@ public ResourceIdentifier ServiceArtifactReferenceId } } - /// Specifies the security posture to be used for all virtual machines in the scale set. Minimum api-version: 2023-03-01. + /// Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01. public ComputeSecurityPostureReference SecurityPostureReference { get; set; } /// Specifies the time in which this VM profile for the Virtual Machine Scale Set was created. Minimum API version for this property is 2024-03-01. This value will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile with minimum api-version 2024-03-01. public DateTimeOffset? TimeCreated { get; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index 7498b0c682a2..28c4bcde80c4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -850,7 +850,7 @@ internal HttpMessage CreateDeallocateRequest(string subscriptionId, string resou /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group. /// The name of the virtual machine. - /// Optional parameter to hibernate a virtual machine. (Feature in Preview). + /// Optional parameter to hibernate a virtual machine. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -876,7 +876,7 @@ public async Task DeallocateAsync(string subscriptionId, string resour /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. /// The name of the resource group. /// The name of the virtual machine. - /// Optional parameter to hibernate a virtual machine. (Feature in Preview). + /// Optional parameter to hibernate a virtual machine. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs index 4efc50bb46b0..b3057996424b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs @@ -771,7 +771,7 @@ public virtual ArmOperation ConvertToManagedDisks(WaitUntil waitUntil, Cancellat /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional parameter to hibernate a virtual machine. (Feature in Preview). + /// Optional parameter to hibernate a virtual machine. /// The cancellation token to use. public virtual async Task DeallocateAsync(WaitUntil waitUntil, bool? hibernate = null, CancellationToken cancellationToken = default) { @@ -814,7 +814,7 @@ public virtual async Task DeallocateAsync(WaitUntil waitUntil, boo /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional parameter to hibernate a virtual machine. (Feature in Preview). + /// Optional parameter to hibernate a virtual machine. /// The cancellation token to use. public virtual ArmOperation Deallocate(WaitUntil waitUntil, bool? hibernate = null, CancellationToken cancellationToken = default) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md b/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md index 8da64715947c..90665f8b1248 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md +++ b/sdk/compute/Azure.ResourceManager.Compute/src/autorest.md @@ -10,7 +10,7 @@ Run `dotnet build /t:GenerateCode` to generate code. azure-arm: true library-name: Compute namespace: Azure.ResourceManager.Compute -require: https://github.com/Azure/azure-rest-api-specs/blob/4e44971c375e4dbb03b75f8c6b91d0bd225f247d/specification/compute/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/compute/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: