diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.Serialization.cs new file mode 100644 index 000000000000..dc3b1dde4432 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.Serialization.cs @@ -0,0 +1,756 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class ActiveSessionHostConfigurationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version.Value, "O"); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsCollectionDefined(VmTags)) + { + writer.WritePropertyName("vmTags"u8); + writer.WriteStartObject(); + foreach (var item in VmTags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(VmLocation)) + { + writer.WritePropertyName("vmLocation"u8); + writer.WriteStringValue(VmLocation); + } + if (Optional.IsDefined(VmResourceGroup)) + { + writer.WritePropertyName("vmResourceGroup"u8); + writer.WriteStringValue(VmResourceGroup); + } + writer.WritePropertyName("vmNamePrefix"u8); + writer.WriteStringValue(VmNamePrefix); + if (Optional.IsCollectionDefined(AvailabilityZones)) + { + writer.WritePropertyName("availabilityZones"u8); + writer.WriteStartArray(); + foreach (var item in AvailabilityZones) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("networkInfo"u8); + writer.WriteObjectValue(NetworkInfo, options); + writer.WritePropertyName("vmSizeId"u8); + writer.WriteStringValue(VmSizeId); + writer.WritePropertyName("diskInfo"u8); + writer.WriteObjectValue(DiskInfo, options); + if (Optional.IsDefined(CustomConfigurationScriptUri)) + { + writer.WritePropertyName("customConfigurationScriptUrl"u8); + writer.WriteStringValue(CustomConfigurationScriptUri.AbsoluteUri); + } + writer.WritePropertyName("imageInfo"u8); + writer.WriteObjectValue(ImageInfo, options); + writer.WritePropertyName("domainInfo"u8); + writer.WriteObjectValue(DomainInfo, options); + if (Optional.IsDefined(SecurityInfo)) + { + writer.WritePropertyName("securityInfo"u8); + writer.WriteObjectValue(SecurityInfo, options); + } + writer.WritePropertyName("vmAdminCredentials"u8); + writer.WriteObjectValue(VmAdminCredentials, options); + if (Optional.IsDefined(BootDiagnosticsInfo)) + { + writer.WritePropertyName("bootDiagnosticsInfo"u8); + writer.WriteObjectValue(BootDiagnosticsInfo, options); + } + writer.WriteEndObject(); + } + + ActiveSessionHostConfigurationData 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(ActiveSessionHostConfigurationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveSessionHostConfigurationData(document.RootElement, options); + } + + internal static ActiveSessionHostConfigurationData DeserializeActiveSessionHostConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + DateTimeOffset? version = default; + string friendlyName = default; + IDictionary vmTags = default; + string vmLocation = default; + string vmResourceGroup = default; + string vmNamePrefix = default; + IList availabilityZones = default; + NetworkInfoProperties networkInfo = default; + string vmSizeId = default; + DiskInfoProperties diskInfo = default; + Uri customConfigurationScriptUrl = default; + ImageInfoProperties imageInfo = default; + DomainInfoProperties domainInfo = default; + SecurityInfoProperties securityInfo = default; + KeyVaultCredentialsProperties vmAdminCredentials = default; + BootDiagnosticsInfoProperties bootDiagnosticsInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("version"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("friendlyName"u8)) + { + friendlyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmTags"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + vmTags = dictionary; + continue; + } + if (property0.NameEquals("vmLocation"u8)) + { + vmLocation = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmResourceGroup"u8)) + { + vmResourceGroup = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmNamePrefix"u8)) + { + vmNamePrefix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("availabilityZones"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + availabilityZones = array; + continue; + } + if (property0.NameEquals("networkInfo"u8)) + { + networkInfo = NetworkInfoProperties.DeserializeNetworkInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmSizeId"u8)) + { + vmSizeId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("diskInfo"u8)) + { + diskInfo = DiskInfoProperties.DeserializeDiskInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("customConfigurationScriptUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customConfigurationScriptUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("imageInfo"u8)) + { + imageInfo = ImageInfoProperties.DeserializeImageInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("domainInfo"u8)) + { + domainInfo = DomainInfoProperties.DeserializeDomainInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("securityInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityInfo = SecurityInfoProperties.DeserializeSecurityInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmAdminCredentials"u8)) + { + vmAdminCredentials = KeyVaultCredentialsProperties.DeserializeKeyVaultCredentialsProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("bootDiagnosticsInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootDiagnosticsInfo = BootDiagnosticsInfoProperties.DeserializeBootDiagnosticsInfoProperties(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActiveSessionHostConfigurationData( + id, + name, + type, + systemData, + version, + friendlyName, + vmTags ?? new ChangeTrackingDictionary(), + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones ?? new ChangeTrackingList(), + networkInfo, + vmSizeId, + diskInfo, + customConfigurationScriptUrl, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + var formattedDateTimeString = TypeFormatters.ToString(Version.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FriendlyName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" friendlyName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FriendlyName)) + { + builder.Append(" friendlyName: "); + if (FriendlyName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FriendlyName}'''"); + } + else + { + builder.AppendLine($"'{FriendlyName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmTags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmTags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VmTags)) + { + if (VmTags.Any()) + { + builder.Append(" vmTags: "); + builder.AppendLine("{"); + foreach (var item in VmTags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmLocation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmLocation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmLocation)) + { + builder.Append(" vmLocation: "); + if (VmLocation.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmLocation}'''"); + } + else + { + builder.AppendLine($"'{VmLocation}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmResourceGroup), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmResourceGroup: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmResourceGroup)) + { + builder.Append(" vmResourceGroup: "); + if (VmResourceGroup.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmResourceGroup}'''"); + } + else + { + builder.AppendLine($"'{VmResourceGroup}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmNamePrefix), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmNamePrefix: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmNamePrefix)) + { + builder.Append(" vmNamePrefix: "); + if (VmNamePrefix.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmNamePrefix}'''"); + } + else + { + builder.AppendLine($"'{VmNamePrefix}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailabilityZones), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availabilityZones: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AvailabilityZones)) + { + if (AvailabilityZones.Any()) + { + builder.Append(" availabilityZones: "); + builder.AppendLine("["); + foreach (var item in AvailabilityZones) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkInfo)) + { + builder.Append(" networkInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkInfo, options, 4, false, " networkInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSizeId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmSizeId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmSizeId)) + { + builder.Append(" vmSizeId: "); + if (VmSizeId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmSizeId}'''"); + } + else + { + builder.AppendLine($"'{VmSizeId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiskInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diskInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DiskInfo)) + { + builder.Append(" diskInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, DiskInfo, options, 4, false, " diskInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomConfigurationScriptUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customConfigurationScriptUrl: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomConfigurationScriptUri)) + { + builder.Append(" customConfigurationScriptUrl: "); + builder.AppendLine($"'{CustomConfigurationScriptUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" imageInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ImageInfo)) + { + builder.Append(" imageInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, ImageInfo, options, 4, false, " imageInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DomainInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" domainInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DomainInfo)) + { + builder.Append(" domainInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, DomainInfo, options, 4, false, " domainInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityInfo)) + { + builder.Append(" securityInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityInfo, options, 4, false, " securityInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmAdminCredentials), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmAdminCredentials: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmAdminCredentials)) + { + builder.Append(" vmAdminCredentials: "); + BicepSerializationHelpers.AppendChildObject(builder, VmAdminCredentials, options, 4, false, " vmAdminCredentials: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BootDiagnosticsInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bootDiagnosticsInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BootDiagnosticsInfo)) + { + builder.Append(" bootDiagnosticsInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, BootDiagnosticsInfo, options, 4, false, " bootDiagnosticsInfo: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationData)} does not support writing '{options.Format}' format."); + } + } + + ActiveSessionHostConfigurationData 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeActiveSessionHostConfigurationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.cs new file mode 100644 index 000000000000..f64eed0f5e90 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A class representing the ActiveSessionHostConfiguration data model. + /// Represents a ActiveSessionHostConfiguration definition. This has all of the sessionHostConfiguration properties except provisioningState + /// + public partial class ActiveSessionHostConfigurationData : ResourceData + { + /// + /// 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 . + /// The prefix that should be associated with session host names. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Local Admin credentials for session hosts. + /// , , , , , or is null. + public ActiveSessionHostConfigurationData(string vmNamePrefix, NetworkInfoProperties networkInfo, string vmSizeId, DiskInfoProperties diskInfo, ImageInfoProperties imageInfo, DomainInfoProperties domainInfo, KeyVaultCredentialsProperties vmAdminCredentials) + { + Argument.AssertNotNull(vmNamePrefix, nameof(vmNamePrefix)); + Argument.AssertNotNull(networkInfo, nameof(networkInfo)); + Argument.AssertNotNull(vmSizeId, nameof(vmSizeId)); + Argument.AssertNotNull(diskInfo, nameof(diskInfo)); + Argument.AssertNotNull(imageInfo, nameof(imageInfo)); + Argument.AssertNotNull(domainInfo, nameof(domainInfo)); + Argument.AssertNotNull(vmAdminCredentials, nameof(vmAdminCredentials)); + + VmTags = new ChangeTrackingDictionary(); + VmNamePrefix = vmNamePrefix; + AvailabilityZones = new ChangeTrackingList(); + NetworkInfo = networkInfo; + VmSizeId = vmSizeId; + DiskInfo = diskInfo; + ImageInfo = imageInfo; + DomainInfo = domainInfo; + VmAdminCredentials = vmAdminCredentials; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The timestamp of the last update. + /// Friendly name to describe this version of the SessionHostConfiguration. + /// Hashtable that lists key/value pair tags to apply to the VMs. + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + /// The prefix that should be associated with session host names. + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Security information. + /// Local Admin credentials for session hosts. + /// Boot Diagnostics information. + /// Keeps track of any properties unknown to the library. + internal ActiveSessionHostConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? version, string friendlyName, IDictionary vmTags, string vmLocation, string vmResourceGroup, string vmNamePrefix, IList availabilityZones, NetworkInfoProperties networkInfo, string vmSizeId, DiskInfoProperties diskInfo, Uri customConfigurationScriptUri, ImageInfoProperties imageInfo, DomainInfoProperties domainInfo, SecurityInfoProperties securityInfo, KeyVaultCredentialsProperties vmAdminCredentials, BootDiagnosticsInfoProperties bootDiagnosticsInfo, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Version = version; + FriendlyName = friendlyName; + VmTags = vmTags; + VmLocation = vmLocation; + VmResourceGroup = vmResourceGroup; + VmNamePrefix = vmNamePrefix; + AvailabilityZones = availabilityZones; + NetworkInfo = networkInfo; + VmSizeId = vmSizeId; + DiskInfo = diskInfo; + CustomConfigurationScriptUri = customConfigurationScriptUri; + ImageInfo = imageInfo; + DomainInfo = domainInfo; + SecurityInfo = securityInfo; + VmAdminCredentials = vmAdminCredentials; + BootDiagnosticsInfo = bootDiagnosticsInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ActiveSessionHostConfigurationData() + { + } + + /// The timestamp of the last update. + [WirePath("properties.version")] + public DateTimeOffset? Version { get; } + /// Friendly name to describe this version of the SessionHostConfiguration. + [WirePath("properties.friendlyName")] + public string FriendlyName { get; set; } + /// Hashtable that lists key/value pair tags to apply to the VMs. + [WirePath("properties.vmTags")] + public IDictionary VmTags { get; } + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + [WirePath("properties.vmLocation")] + public string VmLocation { get; set; } + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + [WirePath("properties.vmResourceGroup")] + public string VmResourceGroup { get; set; } + /// The prefix that should be associated with session host names. + [WirePath("properties.vmNamePrefix")] + public string VmNamePrefix { get; set; } + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + [WirePath("properties.availabilityZones")] + public IList AvailabilityZones { get; } + /// Network information. + [WirePath("properties.networkInfo")] + public NetworkInfoProperties NetworkInfo { get; set; } + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + [WirePath("properties.vmSizeId")] + public string VmSizeId { get; set; } + /// Disk information. + [WirePath("properties.diskInfo")] + public DiskInfoProperties DiskInfo { get; set; } + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + [WirePath("properties.customConfigurationScriptUrl")] + public Uri CustomConfigurationScriptUri { get; set; } + /// Image configurations of HostPool. + [WirePath("properties.imageInfo")] + public ImageInfoProperties ImageInfo { get; set; } + /// Domain configurations of session hosts. + [WirePath("properties.domainInfo")] + public DomainInfoProperties DomainInfo { get; set; } + /// Security information. + [WirePath("properties.securityInfo")] + public SecurityInfoProperties SecurityInfo { get; set; } + /// Local Admin credentials for session hosts. + [WirePath("properties.vmAdminCredentials")] + public KeyVaultCredentialsProperties VmAdminCredentials { get; set; } + /// Boot Diagnostics information. + [WirePath("properties.bootDiagnosticsInfo")] + public BootDiagnosticsInfoProperties BootDiagnosticsInfo { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..02ea848ec80e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class ActiveSessionHostConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ActiveSessionHostConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + ActiveSessionHostConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.cs new file mode 100644 index 000000000000..a9616e1a5b76 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationResource.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A Class representing an ActiveSessionHostConfiguration along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetActiveSessionHostConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetActiveSessionHostConfiguration method. + /// + public partial class ActiveSessionHostConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _activeSessionHostConfigurationClientDiagnostics; + private readonly ActiveSessionHostConfigurationsRestOperations _activeSessionHostConfigurationRestClient; + private readonly ActiveSessionHostConfigurationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DesktopVirtualization/hostPools/activeSessionHostConfigurations"; + + /// Initializes a new instance of the class for mocking. + protected ActiveSessionHostConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ActiveSessionHostConfigurationResource(ArmClient client, ActiveSessionHostConfigurationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ActiveSessionHostConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _activeSessionHostConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string activeSessionHostConfigurationApiVersion); + _activeSessionHostConfigurationRestClient = new ActiveSessionHostConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, activeSessionHostConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ActiveSessionHostConfigurationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update operations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default + /// + /// + /// Operation Id + /// ActiveSessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _activeSessionHostConfigurationClientDiagnostics.CreateScope("ActiveSessionHostConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _activeSessionHostConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ActiveSessionHostConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update operations. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default + /// + /// + /// Operation Id + /// ActiveSessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _activeSessionHostConfigurationClientDiagnostics.CreateScope("ActiveSessionHostConfigurationResource.Get"); + scope.Start(); + try + { + var response = _activeSessionHostConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ActiveSessionHostConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageCollection.cs index a8a7cee93187..2b0f3cccd3c6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -74,7 +74,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// 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. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definitions. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -125,7 +125,7 @@ public virtual async Task> CreateOrUpdate /// /// /// 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. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definitions. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -175,7 +175,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string ap /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -220,7 +220,7 @@ public virtual async Task> GetAsync(string ap /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -257,7 +257,7 @@ public virtual Response Get(string appAttachPackageNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual Response Get(string appAttachPackageNam /// /// /// - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) @@ -288,7 +288,7 @@ public virtual AsyncPageable GetAllAsync(string filter /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -296,7 +296,7 @@ public virtual AsyncPageable GetAllAsync(string filter /// /// /// - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) @@ -319,7 +319,7 @@ public virtual Pageable GetAll(string filter = null, C /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -327,7 +327,7 @@ public virtual Pageable GetAll(string filter = null, C /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string appAttachPackageNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -370,7 +370,7 @@ public virtual async Task> ExistsAsync(string appAttachPackageNam /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -405,7 +405,7 @@ public virtual Response Exists(string appAttachPackageName, CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -413,7 +413,7 @@ public virtual Response Exists(string appAttachPackageName, CancellationTo /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -450,7 +450,7 @@ public virtual async Task> GetIfExist /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -458,7 +458,7 @@ public virtual async Task> GetIfExist /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs index 61eb87ae10fa..14b5dd5d2b48 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Globalization; using System.Threading; using System.Threading.Tasks; @@ -102,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +143,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +183,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -191,15 +192,16 @@ public virtual Response Get(CancellationToken cancella /// /// /// 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. + /// Force flag to delete App Attach package. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? force = null, CancellationToken cancellationToken = default) { using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.Delete"); scope.Start(); try { - var response = await _appAttachPackageRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _appAttachPackageRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var response = await _appAttachPackageRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force, cancellationToken).ConfigureAwait(false); + var uri = _appAttachPackageRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -226,7 +228,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -235,15 +237,16 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// 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. + /// Force flag to delete App Attach package. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, CancellationToken cancellationToken = default) { using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.Delete"); scope.Start(); try { - var response = _appAttachPackageRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _appAttachPackageRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + var response = _appAttachPackageRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force, cancellationToken); + var uri = _appAttachPackageRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, force); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -270,7 +273,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +315,7 @@ public virtual async Task> UpdateAsync(AppAtt /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -340,5 +343,363 @@ public virtual Response Update(AppAttachPackagePatch p throw; } } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _appAttachPackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AppAttachPackagePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _appAttachPackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AppAttachPackagePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _appAttachPackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AppAttachPackagePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _appAttachPackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AppAttachPackagePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _appAttachPackageRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AppAttachPackagePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// + /// + /// Operation Id + /// AppAttachPackage_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _appAttachPackageClientDiagnostics.CreateScope("AppAttachPackageResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _appAttachPackageRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AppAttachPackageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AppAttachPackagePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs index 41d4d2aba32f..890103075ba8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs @@ -34,9 +34,9 @@ public static partial class ArmDesktopVirtualizationModelFactory /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// A new instance for mocking. public static VirtualWorkspaceData VirtualWorkspaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string objectId = null, string description = null, string friendlyName = null, IEnumerable applicationGroupReferences = null, bool? isCloudPCResource = null, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess = null, IEnumerable privateEndpointConnections = null, ResourceIdentifier managedBy = null, string kind = null, ETag? etag = null, ManagedServiceIdentity identity = null, DesktopVirtualizationSku sku = null, ArmPlan plan = null) { @@ -157,14 +157,14 @@ public static DesktopVirtualizationPrivateLinkResourceData DesktopVirtualization /// Timezone of the scaling plan. /// HostPool type for desktop. /// Exclusion tag for scaling plan. - /// List of ScalingPlanPooledSchedule definitions. + /// List of Pooled ScalingSchedule definitions. /// List of ScalingHostPoolReference definitions. /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// A new instance for mocking. public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string objectId = null, string description = null, string friendlyName = null, string timeZone = null, ScalingHostPoolType? scalingHostPoolType = null, string exclusionTag = null, IEnumerable schedules = null, IEnumerable hostPoolReferences = null, ResourceIdentifier managedBy = null, string kind = null, ETag? etag = null, ManagedServiceIdentity identity = null, DesktopVirtualizationSku sku = null, ArmPlan plan = null) { @@ -201,7 +201,10 @@ public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, stri /// The name. /// The resourceType. /// The systemData. + /// Name of the ScalingPlanPooledSchedule. /// Set of days of the week on which this schedule is active. + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. /// Starting time for ramp up period. /// Load balancing algorithm for ramp up period. /// Minimum host percentage for ramp up period. @@ -219,7 +222,7 @@ public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, stri /// Starting time for off-peak period. /// Load balancing algorithm for off-peak period. /// A new instance for mocking. - public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable daysOfWeek = null, ScalingActionTime rampUpStartTime = null, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = null, int? rampUpMinimumHostsPct = null, int? rampUpCapacityThresholdPct = null, ScalingActionTime peakStartTime = null, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = null, ScalingActionTime rampDownStartTime = null, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = null, int? rampDownMinimumHostsPct = null, int? rampDownCapacityThresholdPct = null, bool? rampDownForceLogoffUsers = null, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = null, int? rampDownWaitTimeMinutes = null, string rampDownNotificationMessage = null, ScalingActionTime offPeakStartTime = null, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = null) + public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string namePropertiesName = null, IEnumerable daysOfWeek = null, ScalingMethod? scalingMethod = null, CreateDeleteProperties createDelete = null, ScalingActionTime rampUpStartTime = null, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = null, int? rampUpMinimumHostsPct = null, int rampUpCapacityThresholdPct = default, ScalingActionTime peakStartTime = null, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = null, ScalingActionTime rampDownStartTime = null, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = null, int? rampDownMinimumHostsPct = null, int rampDownCapacityThresholdPct = default, bool? rampDownForceLogoffUsers = null, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = null, int? rampDownWaitTimeMinutes = null, string rampDownNotificationMessage = null, ScalingActionTime offPeakStartTime = null, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = null) { daysOfWeek ??= new List(); @@ -228,7 +231,10 @@ public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(Resour name, resourceType, systemData, + namePropertiesName, daysOfWeek?.ToList(), + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -253,7 +259,10 @@ public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(Resour /// The name. /// The resourceType. /// The systemData. + /// Name of the ScalingPlanPooledSchedule. /// Set of days of the week on which this schedule is active. + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. /// Starting time for ramp up period. /// Load balancing algorithm for ramp up period. /// Minimum host percentage for ramp up period. @@ -271,7 +280,7 @@ public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(Resour /// Starting time for off-peak period. /// Load balancing algorithm for off-peak period. /// A new instance for mocking. - public static ScalingPlanPooledSchedulePatch ScalingPlanPooledSchedulePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable daysOfWeek = null, ScalingActionTime rampUpStartTime = null, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = null, int? rampUpMinimumHostsPct = null, int? rampUpCapacityThresholdPct = null, ScalingActionTime peakStartTime = null, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = null, ScalingActionTime rampDownStartTime = null, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = null, int? rampDownMinimumHostsPct = null, int? rampDownCapacityThresholdPct = null, bool? rampDownForceLogoffUsers = null, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = null, int? rampDownWaitTimeMinutes = null, string rampDownNotificationMessage = null, ScalingActionTime offPeakStartTime = null, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = null) + public static ScalingPlanPooledSchedulePatch ScalingPlanPooledSchedulePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string namePropertiesName = null, IEnumerable daysOfWeek = null, ScalingMethod? scalingMethod = null, CreateDeleteProperties createDelete = null, ScalingActionTime rampUpStartTime = null, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = null, int? rampUpMinimumHostsPct = null, int? rampUpCapacityThresholdPct = null, ScalingActionTime peakStartTime = null, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = null, ScalingActionTime rampDownStartTime = null, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = null, int? rampDownMinimumHostsPct = null, int? rampDownCapacityThresholdPct = null, bool? rampDownForceLogoffUsers = null, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = null, int? rampDownWaitTimeMinutes = null, string rampDownNotificationMessage = null, ScalingActionTime offPeakStartTime = null, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = null) { daysOfWeek ??= new List(); @@ -280,7 +289,10 @@ public static ScalingPlanPooledSchedulePatch ScalingPlanPooledSchedulePatch(Reso name, resourceType, systemData, + namePropertiesName, daysOfWeek?.ToList(), + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -388,9 +400,9 @@ public static ScalingPlanPersonalScheduleData ScalingPlanPersonalScheduleData(Re /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// A new instance for mocking. public static VirtualApplicationGroupData VirtualApplicationGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string objectId = null, string description = null, string friendlyName = null, ResourceIdentifier hostPoolId = null, ResourceIdentifier workspaceId = null, VirtualApplicationGroupType applicationGroupType = default, bool? isCloudPCResource = null, bool? showInFeed = null, ResourceIdentifier managedBy = null, string kind = null, ETag? etag = null, ManagedServiceIdentity identity = null, DesktopVirtualizationSku sku = null, ArmPlan plan = null) { @@ -559,8 +571,9 @@ public static VirtualDesktopData VirtualDesktopData(ResourceIdentifier id = null /// The type of the load balancer. /// The ring number of HostPool. /// Is validation environment. - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. /// VM template for sessionhosts configuration within hostpool. + /// The type of management for this hostpool, Automated or Standard. The default value is Automated. /// List of applicationGroup links. /// List of App Attach Package links. /// URL to customer ADFS server for signing WVD SSO certificates. @@ -573,14 +586,18 @@ public static VirtualDesktopData VirtualDesktopData(ResourceIdentifier id = null /// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. /// The session host configuration for updating agent, monitoring agent, and stack component. /// List of private endpoint connection associated with the specified resource. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// A new instance for mocking. - public static HostPoolData HostPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string objectId = null, string friendlyName = null, string description = null, HostPoolType hostPoolType = default, PersonalDesktopAssignmentType? personalDesktopAssignmentType = null, string customRdpProperty = null, int? maxSessionLimit = null, HostPoolLoadBalancerType loadBalancerType = default, int? ring = null, bool? isValidationEnvironment = null, HostPoolRegistrationInfo registrationInfo = null, string vmTemplate = null, IEnumerable applicationGroupReferences = null, IEnumerable appAttachPackageReferences = null, string ssoAdfsAuthority = null, string ssoClientId = null, string ssoClientSecretKeyVaultPath = null, HostPoolSsoSecretType? ssoSecretType = null, PreferredAppGroupType preferredAppGroupType = default, bool? startVmOnConnect = null, bool? isCloudPCResource = null, HostPoolPublicNetworkAccess? publicNetworkAccess = null, SessionHostAgentUpdateProperties agentUpdate = null, IEnumerable privateEndpointConnections = null, ResourceIdentifier managedBy = null, string kind = null, ETag? etag = null, ManagedServiceIdentity identity = null, DesktopVirtualizationSku sku = null, ArmPlan plan = null) + public static HostPoolData HostPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string objectId = null, string friendlyName = null, string description = null, HostPoolType hostPoolType = default, PersonalDesktopAssignmentType? personalDesktopAssignmentType = null, string customRdpProperty = null, int? maxSessionLimit = null, HostPoolLoadBalancerType loadBalancerType = default, int? ring = null, bool? isValidationEnvironment = null, HostPoolRegistrationInfo registrationInfo = null, string vmTemplate = null, ManagementType? managementType = null, IEnumerable applicationGroupReferences = null, IEnumerable appAttachPackageReferences = null, string ssoAdfsAuthority = null, string ssoClientId = null, string ssoClientSecretKeyVaultPath = null, HostPoolSsoSecretType? ssoSecretType = null, PreferredAppGroupType preferredAppGroupType = default, bool? startVmOnConnect = null, bool? isCloudPCResource = null, HostPoolPublicNetworkAccess? publicNetworkAccess = null, SessionHostAgentUpdateProperties agentUpdate = null, IEnumerable privateEndpointConnections = null, ManagedPrivateUDP? managedPrivateUDP = null, DirectUDP? directUDP = null, PublicUDP? publicUDP = null, RelayUDP? relayUDP = null, ResourceIdentifier managedBy = null, string kind = null, ETag? etag = null, ManagedServiceIdentity identity = null, DesktopVirtualizationSku sku = null, ArmPlan plan = null) { tags ??= new Dictionary(); applicationGroupReferences ??= new List(); @@ -606,6 +623,7 @@ public static HostPoolData HostPoolData(ResourceIdentifier id = null, string nam isValidationEnvironment, registrationInfo, vmTemplate, + managementType, applicationGroupReferences?.ToList(), appAttachPackageReferences?.ToList(), ssoAdfsAuthority, @@ -618,6 +636,10 @@ public static HostPoolData HostPoolData(ResourceIdentifier id = null, string nam publicNetworkAccess, agentUpdate, privateEndpointConnections?.ToList(), + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, managedBy, kind, etag, @@ -641,7 +663,7 @@ public static HostPoolData HostPoolData(ResourceIdentifier id = null, string nam /// The type of the load balancer. /// The ring number of HostPool. /// Is validation environment. - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. /// VM template for sessionhosts configuration within hostpool. /// URL to customer ADFS server for signing WVD SSO certificates. /// ClientId for the registered Relying Party used to issue WVD SSO certificates. @@ -651,8 +673,12 @@ public static HostPoolData HostPoolData(ResourceIdentifier id = null, string nam /// The flag to turn on/off StartVMOnConnect feature. /// Enabled to allow this resource to be access from the public network. /// The session host configuration for updating agent, monitoring agent, and stack component. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. /// A new instance for mocking. - public static HostPoolPatch HostPoolPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, string friendlyName = null, string description = null, string customRdpProperty = null, int? maxSessionLimit = null, PersonalDesktopAssignmentType? personalDesktopAssignmentType = null, HostPoolLoadBalancerType? loadBalancerType = null, int? ring = null, bool? isValidationEnvironment = null, HostPoolRegistrationInfoPatch registrationInfo = null, string vmTemplate = null, string ssoAdfsAuthority = null, string ssoClientId = null, string ssoClientSecretKeyVaultPath = null, HostPoolSsoSecretType? ssoSecretType = null, PreferredAppGroupType? preferredAppGroupType = null, bool? startVmOnConnect = null, HostPoolPublicNetworkAccess? publicNetworkAccess = null, SessionHostAgentUpdatePatchProperties agentUpdate = null) + public static HostPoolPatch HostPoolPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, string friendlyName = null, string description = null, string customRdpProperty = null, int? maxSessionLimit = null, PersonalDesktopAssignmentType? personalDesktopAssignmentType = null, HostPoolLoadBalancerType? loadBalancerType = null, int? ring = null, bool? isValidationEnvironment = null, HostPoolRegistrationInfoPatch registrationInfo = null, string vmTemplate = null, string ssoAdfsAuthority = null, string ssoClientId = null, string ssoClientSecretKeyVaultPath = null, HostPoolSsoSecretType? ssoSecretType = null, PreferredAppGroupType? preferredAppGroupType = null, bool? startVmOnConnect = null, HostPoolPublicNetworkAccess? publicNetworkAccess = null, SessionHostAgentUpdatePatchProperties agentUpdate = null, ManagedPrivateUDP? managedPrivateUDP = null, DirectUDP? directUDP = null, PublicUDP? publicUDP = null, RelayUDP? relayUDP = null) { tags ??= new Dictionary(); @@ -680,9 +706,264 @@ public static HostPoolPatch HostPoolPatch(ResourceIdentifier id = null, string n startVmOnConnect, publicNetworkAccess, agentUpdate, + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + /// Parameters for a hostpool update. + /// Parameters that apply when session hosts are provisioned. + /// The policy that should be applied when the Session Host provisioning operation fails. + /// A new instance for mocking. + public static SessionHostManagementData SessionHostManagementData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string scheduledDateTimeZone = null, HostPoolUpdateConfigurationProperties update = null, SessionHostProvisioningConfigurationProperties provisioning = null, FailedSessionHostCleanupPolicySHC? failedSessionHostCleanupPolicy = null) + { + return new SessionHostManagementData( + id, + name, + resourceType, + systemData, + scheduledDateTimeZone, + update, + provisioning, + failedSessionHostCleanupPolicy, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Action types for controlling hostpool update. + /// The cancel message sent to the user on the session host. This is can only be specified if the action is 'Cancel'. + /// A new instance for mocking. + public static HostPoolUpdateControlParameter HostPoolUpdateControlParameter(HostPoolUpdateAction action = default, string cancelMessage = null) + { + return new HostPoolUpdateControlParameter(action, cancelMessage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Action types for controlling hostpool provisioning. + /// The cancel message sent to the user on the session host. + /// A new instance for mocking. + public static HostPoolProvisioningControlParameter HostPoolProvisioningControlParameter(HostPoolProvisioningAction action = default, string cancelMessage = null) + { + return new HostPoolProvisioningControlParameter(action, cancelMessage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// If present, details of the operation error. + /// The correlation Id for Log Analytics. + /// Progress information on the sessionHostManagement operation. + /// The timestamp that the update is scheduled for. + /// SessionHostManagement properties used for the operation. + /// A new instance for mocking. + public static SessionHostManagementUpdateStatus SessionHostManagementUpdateStatus(string id = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, ResponseError error = null, string correlationId = null, SessionHostManagementOperationProgress progress = null, DateTimeOffset? scheduledOn = null, SessionHostManagementData sessionHostManagement = null) + { + return new SessionHostManagementUpdateStatus( + id, + name, + status, + percentComplete, + startOn, + endOn, + error, + correlationId, + progress, + scheduledOn, + sessionHostManagement, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Time that the sessionHostManagement operation was created. + /// The number of sessionHosts to be started in the sessionHostManagement operation. + /// The number of sessionHosts in progress in the sessionHostManagement operation. + /// The number of sessionHosts completed in the sessionHostManagement operation. + /// The number of sessionHosts rollback failed in the sessionHostManagement operation. + /// A new instance for mocking. + public static SessionHostManagementOperationProgress SessionHostManagementOperationProgress(DateTimeOffset? executionStartOn = null, int? totalSessionHosts = null, int? sessionHostsInProgress = null, int? sessionHostsCompleted = null, int? sessionHostsRollbackFailed = null) + { + return new SessionHostManagementOperationProgress( + executionStartOn, + totalSessionHosts, + sessionHostsInProgress, + sessionHostsCompleted, + sessionHostsRollbackFailed, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. Current defined values are < Scheduled | ValidatingSessionHostProvisioning | Cancelling | ProvisioningSessionHosts > | Succeeded | Failed | Canceled. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// If present, details of the operation error. + /// The correlation Id for Log Analytics. + /// Progress information on the sessionHostManagement operation. + /// The timestamp that the update is scheduled for. + /// SessionHostManagement properties used for the operation. + /// A new instance for mocking. + public static SessionHostManagementProvisioningStatus SessionHostManagementProvisioningStatus(string id = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, ResponseError error = null, string correlationId = null, SessionHostManagementProvisioningOperationProgress progress = null, DateTimeOffset? scheduledOn = null, SessionHostManagementData sessionHostManagement = null) + { + return new SessionHostManagementProvisioningStatus( + id, + name, + status, + percentComplete, + startOn, + endOn, + error, + correlationId, + progress, + scheduledOn, + sessionHostManagement, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Time that the sessionHostManagement operation was created. + /// The number of sessionHosts in progress in the sessionHostManagement provisioning operation. + /// The number of sessionHosts completed in the sessionHostManagement provisioning operation. + /// The final instance count of the host pool for this provisioning operation. + /// The initial instance count of the host pool for this provisioning operation. + /// A new instance for mocking. + public static SessionHostManagementProvisioningOperationProgress SessionHostManagementProvisioningOperationProgress(DateTimeOffset? executionStartOn = null, int? sessionHostsInProgress = null, int? sessionHostsCompleted = null, int? finalSessionHostsCount = null, int? initialSessionHostsCount = null) + { + return new SessionHostManagementProvisioningOperationProgress( + executionStartOn, + sessionHostsInProgress, + sessionHostsCompleted, + finalSessionHostsCount, + initialSessionHostsCount, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The timestamp of the last update. + /// Friendly name to describe this version of the SessionHostConfiguration. + /// Provisioning state of the Session Host Configuration. + /// Hashtable that lists key/value pair tags to apply to the VMs. + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + /// The prefix that should be associated with session host names. + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Security information. + /// Local Admin credentials for session hosts. + /// Boot Diagnostics information. + /// A new instance for mocking. + public static SessionHostConfigurationData SessionHostConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? version = null, string friendlyName = null, ProvisioningStateSHC? provisioningState = null, IDictionary vmTags = null, string vmLocation = null, string vmResourceGroup = null, string vmNamePrefix = null, IEnumerable availabilityZones = null, NetworkInfoProperties networkInfo = null, string vmSizeId = null, DiskInfoProperties diskInfo = null, Uri customConfigurationScriptUri = null, ImageInfoProperties imageInfo = null, DomainInfoProperties domainInfo = null, SecurityInfoProperties securityInfo = null, KeyVaultCredentialsProperties vmAdminCredentials = null, BootDiagnosticsInfoProperties bootDiagnosticsInfo = null) + { + vmTags ??= new Dictionary(); + availabilityZones ??= new List(); + + return new SessionHostConfigurationData( + id, + name, + resourceType, + systemData, + version, + friendlyName, + provisioningState, + vmTags, + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones?.ToList(), + networkInfo, + vmSizeId, + diskInfo, + customConfigurationScriptUri, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The timestamp of the last update. + /// Friendly name to describe this version of the SessionHostConfiguration. + /// Hashtable that lists key/value pair tags to apply to the VMs. + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + /// The prefix that should be associated with session host names. + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Security information. + /// Local Admin credentials for session hosts. + /// Boot Diagnostics information. + /// A new instance for mocking. + public static ActiveSessionHostConfigurationData ActiveSessionHostConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? version = null, string friendlyName = null, IDictionary vmTags = null, string vmLocation = null, string vmResourceGroup = null, string vmNamePrefix = null, IEnumerable availabilityZones = null, NetworkInfoProperties networkInfo = null, string vmSizeId = null, DiskInfoProperties diskInfo = null, Uri customConfigurationScriptUri = null, ImageInfoProperties imageInfo = null, DomainInfoProperties domainInfo = null, SecurityInfoProperties securityInfo = null, KeyVaultCredentialsProperties vmAdminCredentials = null, BootDiagnosticsInfoProperties bootDiagnosticsInfo = null) + { + vmTags ??= new Dictionary(); + availabilityZones ??= new List(); + + return new ActiveSessionHostConfigurationData( + id, + name, + resourceType, + systemData, + version, + friendlyName, + vmTags, + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones?.ToList(), + networkInfo, + vmSizeId, + diskInfo, + customConfigurationScriptUri, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Expiration time of registration token. + /// The registration token base64 encoded string. + /// A new instance for mocking. + public static RegistrationTokenMinimal RegistrationTokenMinimal(DateTimeOffset? expireOn = null, string token = null) + { + return new RegistrationTokenMinimal(expireOn, token, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -716,6 +997,9 @@ public static UserSessionData UserSessionData(ResourceIdentifier id = null, stri /// The name. /// The resourceType. /// The systemData. + /// Number of active sessions on SessionHost. + /// Number of disconnected sessions on SessionHost. + /// Number of pending sessions on SessionHost. /// ObjectId of SessionHost. (internal use). /// Last heart beat from SessionHost. /// Number of sessions on SessionHost. @@ -732,9 +1016,11 @@ public static UserSessionData UserSessionData(ResourceIdentifier id = null, stri /// Update state of a SessionHost. /// The timestamp of the last update. /// The error message. + /// The last time update was completed. + /// SessionHostConfiguration version reference at the time the update is initiated, in the format of date time. Example: 2024-04-26T04:56:45Z. /// List of SessionHostHealthCheckReports. /// A new instance for mocking. - public static SessionHostData SessionHostData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string objectId = null, DateTimeOffset? lastHeartBeatOn = null, int? sessions = null, string agentVersion = null, bool? allowNewSession = null, string vmId = null, ResourceIdentifier resourceId = null, string assignedUser = null, string friendlyName = null, SessionHostStatus? status = null, DateTimeOffset? statusTimestamp = null, string osVersion = null, string sxsStackVersion = null, SessionHostUpdateState? updateState = null, DateTimeOffset? lastUpdatedOn = null, string updateErrorMessage = null, IEnumerable sessionHostHealthCheckResults = null) + public static SessionHostData SessionHostData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? activeSessions = null, int? disconnectedSessions = null, int? pendingSessions = null, string objectId = null, DateTimeOffset? lastHeartBeatOn = null, int? sessions = null, string agentVersion = null, bool? allowNewSession = null, string vmId = null, ResourceIdentifier resourceId = null, string assignedUser = null, string friendlyName = null, SessionHostStatus? status = null, DateTimeOffset? statusTimestamp = null, string osVersion = null, string sxsStackVersion = null, SessionHostUpdateState? updateState = null, DateTimeOffset? lastUpdatedOn = null, string updateErrorMessage = null, DateTimeOffset? lastSessionHostUpdateOn = null, string sessionHostConfiguration = null, IEnumerable sessionHostHealthCheckResults = null) { sessionHostHealthCheckResults ??= new List(); @@ -743,6 +1029,9 @@ public static SessionHostData SessionHostData(ResourceIdentifier id = null, stri name, resourceType, systemData, + activeSessions, + disconnectedSessions, + pendingSessions, objectId, lastHeartBeatOn, sessions, @@ -759,6 +1048,8 @@ public static SessionHostData SessionHostData(ResourceIdentifier id = null, stri updateState, lastUpdatedOn, updateErrorMessage, + lastSessionHostUpdateOn, + sessionHostConfiguration, sessionHostHealthCheckResults?.ToList(), serializedAdditionalRawData: null); } @@ -818,7 +1109,7 @@ public static SessionHostPatch SessionHostPatch(ResourceIdentifier id = null, st /// Specifies how to register Package in feed. /// Make this version of the package the active one across the hostpool. /// List of package dependencies. - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. /// Date Package was last updated, found in the appxmanifest.xml. /// List of package applications. /// A new instance for mocking. @@ -896,10 +1187,13 @@ public static AppAttachPackageData AppAttachPackageData(ResourceIdentifier id = /// The provisioning state of the App Attach Package. /// Detailed properties for App Attach Package. /// List of Hostpool resource Ids. - /// URL path to certificate name located in keyVault. + /// URL of keyvault location to store certificate. /// Parameter indicating how the health check should behave if this package fails staging. + /// Specific name of package owner, is "AppAttach" for native app attach packages. + /// Lookback url to third party control plane, is null for native app attach packages. + /// Field that can be populated with custom data and filtered on in list GET calls. /// A new instance for mocking. - public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState = null, AppAttachPackageInfoProperties image = null, IEnumerable hostPoolReferences = null, Uri keyVaultUri = null, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = null) + public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState = null, AppAttachPackageInfoProperties image = null, IEnumerable hostPoolReferences = null, Uri keyVaultUri = null, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = null, string packageOwnerName = null, Uri packageLookbackUri = null, string customData = null) { hostPoolReferences ??= new List(); @@ -909,6 +1203,9 @@ public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPac hostPoolReferences?.ToList(), keyVaultUri, failHealthCheckOnStagingFailure, + packageOwnerName, + packageLookbackUri, + customData, serializedAdditionalRawData: null); } @@ -927,7 +1224,7 @@ public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPac /// Specifies how to register Package in feed. /// Make this version of the package the active one across the hostpool. /// List of package dependencies. - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. /// Date Package was last updated, found in the appxmanifest.xml. /// List of package applications. /// Certificate name found in the appxmanifest.xml. @@ -966,19 +1263,211 @@ public static ExpandMsixImage ExpandMsixImage(ResourceIdentifier id = null, stri /// The name. /// The resourceType. /// The systemData. + /// tags to be updated. /// Detailed properties for App Attach Package. /// A new instance for mocking. - public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AppAttachPackagePatchProperties properties = null) + public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AppAttachPackagePatchProperties properties = null) { + tags ??= new Dictionary(); + return new AppAttachPackagePatch( id, name, resourceType, systemData, + tags, properties, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// Load balancing algorithm for ramp up period. + /// Minimum host percentage for ramp up period. + /// Capacity threshold for ramp up period. + /// Starting time for peak period. + /// Load balancing algorithm for peak period. + /// Starting time for ramp down period. + /// Load balancing algorithm for ramp down period. + /// Minimum host percentage for ramp down period. + /// Capacity threshold for ramp down period. + /// Should users be logged off forcefully from hosts. + /// Specifies when to stop hosts during ramp down period. + /// Number of minutes to wait to stop hosts during ramp down period. + /// Notification message for users during ramp down period. + /// Starting time for off-peak period. + /// Load balancing algorithm for off-peak period. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IEnumerable daysOfWeek, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm) + { + return ScalingPlanPooledScheduleData(id: id, name: name, resourceType: resourceType, systemData: systemData, namePropertiesName: default, daysOfWeek: daysOfWeek, scalingMethod: default, createDelete: default, rampUpStartTime: rampUpStartTime, rampUpLoadBalancingAlgorithm: rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct: rampUpMinimumHostsPct, rampUpCapacityThresholdPct: rampUpCapacityThresholdPct, peakStartTime: peakStartTime, peakLoadBalancingAlgorithm: peakLoadBalancingAlgorithm, rampDownStartTime: rampDownStartTime, rampDownLoadBalancingAlgorithm: rampDownLoadBalancingAlgorithm, rampDownMinimumHostsPct: rampDownMinimumHostsPct, rampDownCapacityThresholdPct: rampDownCapacityThresholdPct, rampDownForceLogoffUsers: rampDownForceLogoffUsers, rampDownStopHostsWhen: rampDownStopHostsWhen, rampDownWaitTimeMinutes: rampDownWaitTimeMinutes, rampDownNotificationMessage: rampDownNotificationMessage, offPeakStartTime: offPeakStartTime, offPeakLoadBalancingAlgorithm: offPeakLoadBalancingAlgorithm); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// Load balancing algorithm for ramp up period. + /// Minimum host percentage for ramp up period. + /// Capacity threshold for ramp up period. + /// Starting time for peak period. + /// Load balancing algorithm for peak period. + /// Starting time for ramp down period. + /// Load balancing algorithm for ramp down period. + /// Minimum host percentage for ramp down period. + /// Capacity threshold for ramp down period. + /// Should users be logged off forcefully from hosts. + /// Specifies when to stop hosts during ramp down period. + /// Number of minutes to wait to stop hosts during ramp down period. + /// Notification message for users during ramp down period. + /// Starting time for off-peak period. + /// Load balancing algorithm for off-peak period. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static ScalingPlanPooledSchedulePatch ScalingPlanPooledSchedulePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IEnumerable daysOfWeek, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm) + { + return ScalingPlanPooledSchedulePatch(id: id, name: name, resourceType: resourceType, systemData: systemData, namePropertiesName: default, daysOfWeek: daysOfWeek, scalingMethod: default, createDelete: default, rampUpStartTime: rampUpStartTime, rampUpLoadBalancingAlgorithm: rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct: rampUpMinimumHostsPct, rampUpCapacityThresholdPct: rampUpCapacityThresholdPct, peakStartTime: peakStartTime, peakLoadBalancingAlgorithm: peakLoadBalancingAlgorithm, rampDownStartTime: rampDownStartTime, rampDownLoadBalancingAlgorithm: rampDownLoadBalancingAlgorithm, rampDownMinimumHostsPct: rampDownMinimumHostsPct, rampDownCapacityThresholdPct: rampDownCapacityThresholdPct, rampDownForceLogoffUsers: rampDownForceLogoffUsers, rampDownStopHostsWhen: rampDownStopHostsWhen, rampDownWaitTimeMinutes: rampDownWaitTimeMinutes, rampDownNotificationMessage: rampDownNotificationMessage, offPeakStartTime: offPeakStartTime, offPeakLoadBalancingAlgorithm: offPeakLoadBalancingAlgorithm); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ObjectId of HostPool. (internal use). + /// Friendly name of HostPool. + /// Description of HostPool. + /// HostPool type for desktop. + /// PersonalDesktopAssignment type for HostPool. + /// Custom rdp property of HostPool. + /// The max session limit of HostPool. + /// The type of the load balancer. + /// The ring number of HostPool. + /// Is validation environment. + /// The registration info of HostPool. + /// VM template for sessionhosts configuration within hostpool. + /// List of applicationGroup links. + /// List of App Attach Package links. + /// URL to customer ADFS server for signing WVD SSO certificates. + /// ClientId for the registered Relying Party used to issue WVD SSO certificates. + /// Path to Azure KeyVault storing the secret used for communication to ADFS. + /// The type of single sign on Secret Type. + /// The type of preferred application group type, default to Desktop Application Group. + /// The flag to turn on/off StartVMOnConnect feature. + /// Is cloud pc resource. + /// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. + /// The session host configuration for updating agent, monitoring agent, and stack component. + /// List of private endpoint connection associated with the specified resource. + /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// The resource model definition representing SKU. + /// Gets or sets the plan. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static HostPoolData HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType? personalDesktopAssignmentType, string customRdpProperty, int? maxSessionLimit, HostPoolLoadBalancerType loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfo registrationInfo, string vmTemplate, IEnumerable applicationGroupReferences, IEnumerable appAttachPackageReferences, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool? startVmOnConnect, bool? isCloudPCResource, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdateProperties agentUpdate, IEnumerable privateEndpointConnections, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan) + { + return HostPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, friendlyName: friendlyName, description: description, hostPoolType: hostPoolType, personalDesktopAssignmentType: personalDesktopAssignmentType, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, managementType: default, applicationGroupReferences: applicationGroupReferences, appAttachPackageReferences: appAttachPackageReferences, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, isCloudPCResource: isCloudPCResource, publicNetworkAccess: publicNetworkAccess, agentUpdate: agentUpdate, privateEndpointConnections: privateEndpointConnections, managedPrivateUDP: default, directUDP: default, publicUDP: default, relayUDP: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// tags to be updated. + /// Friendly name of HostPool. + /// Description of HostPool. + /// Custom rdp property of HostPool. + /// The max session limit of HostPool. + /// PersonalDesktopAssignment type for HostPool. + /// The type of the load balancer. + /// The ring number of HostPool. + /// Is validation environment. + /// The registration info of HostPool. + /// VM template for sessionhosts configuration within hostpool. + /// URL to customer ADFS server for signing WVD SSO certificates. + /// ClientId for the registered Relying Party used to issue WVD SSO certificates. + /// Path to Azure KeyVault storing the secret used for communication to ADFS. + /// The type of single sign on Secret Type. + /// The type of preferred application group type, default to Desktop Application Group. + /// The flag to turn on/off StartVMOnConnect feature. + /// Enabled to allow this resource to be access from the public network. + /// The session host configuration for updating agent, monitoring agent, and stack component. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static HostPoolPatch HostPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string friendlyName, string description, string customRdpProperty, int? maxSessionLimit, PersonalDesktopAssignmentType? personalDesktopAssignmentType, HostPoolLoadBalancerType? loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfoPatch registrationInfo, string vmTemplate, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType? preferredAppGroupType, bool? startVmOnConnect, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdatePatchProperties agentUpdate) + { + return HostPoolPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, friendlyName: friendlyName, description: description, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, personalDesktopAssignmentType: personalDesktopAssignmentType, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, publicNetworkAccess: publicNetworkAccess, agentUpdate: agentUpdate, managedPrivateUDP: default, directUDP: default, publicUDP: default, relayUDP: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// ObjectId of SessionHost. (internal use). + /// Last heart beat from SessionHost. + /// Number of sessions on SessionHost. + /// Version of agent on SessionHost. + /// Allow a new session. + /// Virtual Machine Id of SessionHost's underlying virtual machine. + /// Resource Id of SessionHost's underlying virtual machine. + /// User assigned to SessionHost. + /// Friendly name of SessionHost. + /// Status for a SessionHost. + /// The timestamp of the status. + /// The version of the OS on the session host. + /// The version of the side by side stack on the session host. + /// Update state of a SessionHost. + /// The timestamp of the last update. + /// The error message. + /// List of SessionHostHealthCheckReports. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static SessionHostData SessionHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string objectId, DateTimeOffset? lastHeartBeatOn, int? sessions, string agentVersion, bool? allowNewSession, string vmId, ResourceIdentifier resourceId, string assignedUser, string friendlyName, SessionHostStatus? status, DateTimeOffset? statusTimestamp, string osVersion, string sxsStackVersion, SessionHostUpdateState? updateState, DateTimeOffset? lastUpdatedOn, string updateErrorMessage, IEnumerable sessionHostHealthCheckResults) + { + return SessionHostData(id: id, name: name, resourceType: resourceType, systemData: systemData, activeSessions: default, disconnectedSessions: default, pendingSessions: default, objectId: objectId, lastHeartBeatOn: lastHeartBeatOn, sessions: sessions, agentVersion: agentVersion, allowNewSession: allowNewSession, vmId: vmId, resourceId: resourceId, assignedUser: assignedUser, friendlyName: friendlyName, status: status, statusTimestamp: statusTimestamp, osVersion: osVersion, sxsStackVersion: sxsStackVersion, updateState: updateState, lastUpdatedOn: lastUpdatedOn, updateErrorMessage: updateErrorMessage, lastSessionHostUpdateOn: default, sessionHostConfiguration: default, sessionHostHealthCheckResults: sessionHostHealthCheckResults); + } + + /// Initializes a new instance of . + /// The provisioning state of the App Attach Package. + /// Detailed properties for App Attach Package. + /// List of Hostpool resource Ids. + /// URL path to certificate name located in keyVault. + /// Parameter indicating how the health check should behave if this package fails staging. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState, AppAttachPackageInfoProperties image, IEnumerable hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure) + { + return AppAttachPackageProperties(provisioningState: provisioningState, image: image, hostPoolReferences: hostPoolReferences, keyVaultUri: keyVaultUri, failHealthCheckOnStagingFailure: failHealthCheckOnStagingFailure, packageOwnerName: default, packageLookbackUri: default, customData: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Detailed properties for App Attach Package. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppAttachPackagePatchProperties properties) + { + return AppAttachPackagePatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: default, properties: properties); + } + /// The id. /// The name. /// The resourceType. @@ -1015,7 +1504,7 @@ public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id [EditorBrowsable(EditorBrowsableState.Never)] public static HostPoolData HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType? personalDesktopAssignmentType, string customRdpProperty, int? maxSessionLimit, HostPoolLoadBalancerType loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfo registrationInfo, string vmTemplate, IEnumerable applicationGroupReferences, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool? startVmOnConnect, bool? isCloudPCResource, SessionHostAgentUpdateProperties agentUpdate, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan) { - return HostPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, friendlyName: friendlyName, description: description, hostPoolType: hostPoolType, personalDesktopAssignmentType: personalDesktopAssignmentType, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, applicationGroupReferences: applicationGroupReferences, appAttachPackageReferences: default, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, isCloudPCResource: isCloudPCResource, publicNetworkAccess: default, agentUpdate: agentUpdate, privateEndpointConnections: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); + return HostPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, friendlyName: friendlyName, description: description, hostPoolType: hostPoolType, personalDesktopAssignmentType: personalDesktopAssignmentType, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, managementType: default, applicationGroupReferences: applicationGroupReferences, appAttachPackageReferences: default, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, isCloudPCResource: isCloudPCResource, publicNetworkAccess: default, agentUpdate: agentUpdate, privateEndpointConnections: default, managedPrivateUDP: default, directUDP: default, publicUDP: default, relayUDP: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); } /// Initializes a new instance of HostPoolPatch. @@ -1044,7 +1533,7 @@ public static HostPoolData HostPoolData(ResourceIdentifier id, string name, Reso [EditorBrowsable(EditorBrowsableState.Never)] public static HostPoolPatch HostPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string friendlyName, string description, string customRdpProperty, int? maxSessionLimit, PersonalDesktopAssignmentType? personalDesktopAssignmentType, HostPoolLoadBalancerType? loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfoPatch registrationInfo, string vmTemplate, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType? preferredAppGroupType, bool? startVmOnConnect, SessionHostAgentUpdatePatchProperties agentUpdate) { - return HostPoolPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, friendlyName: friendlyName, description: description, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, personalDesktopAssignmentType: personalDesktopAssignmentType, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, publicNetworkAccess: default, agentUpdate: agentUpdate); + return HostPoolPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, friendlyName: friendlyName, description: description, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, personalDesktopAssignmentType: personalDesktopAssignmentType, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, publicNetworkAccess: default, agentUpdate: agentUpdate, managedPrivateUDP: default, directUDP: default, publicUDP: default, relayUDP: default); } /// Initializes a new instance of VirtualApplicationGroupData. @@ -1181,7 +1670,7 @@ public static DesktopVirtualizationPrivateEndpointConnectionDataData DesktopVirt [EditorBrowsable(EditorBrowsableState.Never)] public static HostPoolData HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType? personalDesktopAssignmentType, string customRdpProperty, int? maxSessionLimit, HostPoolLoadBalancerType loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfo registrationInfo, string vmTemplate, IEnumerable applicationGroupReferences, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool? startVmOnConnect, bool? isCloudPCResource, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdateProperties agentUpdate, IEnumerable privateEndpointConnections, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan) { - return HostPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, friendlyName: friendlyName, description: description, hostPoolType: hostPoolType, personalDesktopAssignmentType: personalDesktopAssignmentType, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, applicationGroupReferences: applicationGroupReferences, appAttachPackageReferences: default, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, isCloudPCResource: isCloudPCResource, publicNetworkAccess: publicNetworkAccess, agentUpdate: agentUpdate, privateEndpointConnections: privateEndpointConnections, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); + return HostPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, friendlyName: friendlyName, description: description, hostPoolType: hostPoolType, personalDesktopAssignmentType: personalDesktopAssignmentType, customRdpProperty: customRdpProperty, maxSessionLimit: maxSessionLimit, loadBalancerType: loadBalancerType, ring: ring, isValidationEnvironment: isValidationEnvironment, registrationInfo: registrationInfo, vmTemplate: vmTemplate, managementType: default, applicationGroupReferences: applicationGroupReferences, appAttachPackageReferences: default, ssoAdfsAuthority: ssoAdfsAuthority, ssoClientId: ssoClientId, ssoClientSecretKeyVaultPath: ssoClientSecretKeyVaultPath, ssoSecretType: ssoSecretType, preferredAppGroupType: preferredAppGroupType, startVmOnConnect: startVmOnConnect, isCloudPCResource: isCloudPCResource, publicNetworkAccess: publicNetworkAccess, agentUpdate: agentUpdate, privateEndpointConnections: privateEndpointConnections, managedPrivateUDP: default, directUDP: default, publicUDP: default, relayUDP: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); } /// Initializes a new instance of ExpandMsixImage. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs index 641ebfdd02b5..8d06d5fce2f5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs @@ -222,6 +222,63 @@ public static HostPoolResource GetHostPoolResource(this ArmClient client, Resour return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SessionHostManagementResource GetSessionHostManagementResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDesktopVirtualizationArmClient(client).GetSessionHostManagementResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SessionHostConfigurationResource GetSessionHostConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDesktopVirtualizationArmClient(client).GetSessionHostConfigurationResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ActiveSessionHostConfigurationResource GetActiveSessionHostConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDesktopVirtualizationArmClient(client).GetActiveSessionHostConfigurationResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -328,7 +385,7 @@ public static VirtualWorkspaceCollection GetVirtualWorkspaces(this ResourceGroup /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -366,7 +423,7 @@ public static async Task> GetVirtualWorkspace /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -421,7 +478,7 @@ public static ScalingPlanCollection GetScalingPlans(this ResourceGroupResource r /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -459,7 +516,7 @@ public static async Task> GetScalingPlanAsync(this /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -514,7 +571,7 @@ public static VirtualApplicationGroupCollection GetVirtualApplicationGroups(this /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -552,7 +609,7 @@ public static async Task> GetVirtualAp /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -607,7 +664,7 @@ public static HostPoolCollection GetHostPools(this ResourceGroupResource resourc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -645,7 +702,7 @@ public static async Task> GetHostPoolAsync(this Resou /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -700,7 +757,7 @@ public static AppAttachPackageCollection GetAppAttachPackages(this ResourceGroup /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -713,7 +770,7 @@ public static AppAttachPackageCollection GetAppAttachPackages(this ResourceGroup /// /// /// The instance the method will execute against. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -738,7 +795,7 @@ public static async Task> GetAppAttachPackage /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -751,7 +808,7 @@ public static async Task> GetAppAttachPackage /// /// /// The instance the method will execute against. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -776,7 +833,7 @@ public static Response GetAppAttachPackage(this Resour /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -812,7 +869,7 @@ public static AsyncPageable GetVirtualWorkspacesAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -848,7 +905,7 @@ public static Pageable GetVirtualWorkspaces(this Subsc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -887,7 +944,7 @@ public static AsyncPageable GetScalingPlansAsync(this Subsc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -926,7 +983,7 @@ public static Pageable GetScalingPlans(this SubscriptionRes /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -963,7 +1020,7 @@ public static AsyncPageable GetVirtualApplicati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1000,7 +1057,7 @@ public static Pageable GetVirtualApplicationGro /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1039,7 +1096,7 @@ public static AsyncPageable GetHostPoolsAsync(this Subscriptio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1078,7 +1135,7 @@ public static Pageable GetHostPools(this SubscriptionResource /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1091,7 +1148,7 @@ public static Pageable GetHostPools(this SubscriptionResource /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// is null. /// An async collection of that may take multiple service requests to iterate over. @@ -1115,7 +1172,7 @@ public static AsyncPageable GetAppAttachPackagesAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1128,7 +1185,7 @@ public static AsyncPageable GetAppAttachPackagesAsync( /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs index 7efa6c0ac63f..f2cf29481962 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs @@ -154,6 +154,42 @@ public virtual HostPoolResource GetHostPoolResource(ResourceIdentifier id) return new HostPoolResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SessionHostManagementResource GetSessionHostManagementResource(ResourceIdentifier id) + { + SessionHostManagementResource.ValidateResourceId(id); + return new SessionHostManagementResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SessionHostConfigurationResource GetSessionHostConfigurationResource(ResourceIdentifier id) + { + SessionHostConfigurationResource.ValidateResourceId(id); + return new SessionHostConfigurationResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ActiveSessionHostConfigurationResource GetActiveSessionHostConfigurationResource(ResourceIdentifier id) + { + ActiveSessionHostConfigurationResource.ValidateResourceId(id); + return new ActiveSessionHostConfigurationResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs index 45290221f07e..dda8f86b7e97 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual VirtualWorkspaceCollection GetVirtualWorkspaces() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetVirtualWorkspac /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -122,7 +122,7 @@ public virtual ScalingPlanCollection GetScalingPlans() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> GetScalingPlanAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -191,7 +191,7 @@ public virtual VirtualApplicationGroupCollection GetVirtualApplicationGroups() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -222,7 +222,7 @@ public virtual async Task> GetVirtualA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -260,7 +260,7 @@ public virtual HostPoolCollection GetHostPools() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -291,7 +291,7 @@ public virtual async Task> GetHostPoolAsync(string ho /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -329,7 +329,7 @@ public virtual AppAttachPackageCollection GetAppAttachPackages() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -337,7 +337,7 @@ public virtual AppAttachPackageCollection GetAppAttachPackages() /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -360,7 +360,7 @@ public virtual async Task> GetAppAttachPackag /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -368,7 +368,7 @@ public virtual async Task> GetAppAttachPackag /// /// /// - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs index b29ed49e7ebc..c709ad23a129 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs @@ -68,7 +68,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -98,7 +98,7 @@ public virtual AsyncPageable GetVirtualWorkspacesAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -128,7 +128,7 @@ public virtual Pageable GetVirtualWorkspaces(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -161,7 +161,7 @@ public virtual AsyncPageable GetScalingPlansAsync(int? page /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -194,7 +194,7 @@ public virtual Pageable GetScalingPlans(int? pageSize = nul /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual AsyncPageable GetVirtualApplicat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Pageable GetVirtualApplicationGr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetHostPools(int? pageSize = null, boo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -330,7 +330,7 @@ public virtual Pageable GetHostPools(int? pageSize = null, boo /// /// /// - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAppAttachPackagesAsync(string filter = null, CancellationToken cancellationToken = default) @@ -353,7 +353,7 @@ public virtual AsyncPageable GetAppAttachPackagesAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -361,7 +361,7 @@ public virtual AsyncPageable GetAppAttachPackagesAsync /// /// /// - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAppAttachPackages(string filter = null, CancellationToken cancellationToken = default) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs index 76c4a8cdf508..e3dd387c05f2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAsync(Wa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string hostPoolNa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string hostPoolName, CancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = null, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? isD /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string hostPoolName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string hostPoolName, CancellationToken canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExistsAsync(s /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs index c013de241bc8..ead289c37902 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs @@ -57,7 +57,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (Optional.IsDefined(Sku)) { @@ -160,6 +161,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("vmTemplate"u8); writer.WriteStringValue(VmTemplate); } + if (Optional.IsDefined(ManagementType)) + { + writer.WritePropertyName("managementType"u8); + writer.WriteStringValue(ManagementType.Value.ToString()); + } if (options.Format != "W" && Optional.IsCollectionDefined(ApplicationGroupReferences)) { if (ApplicationGroupReferences != null) @@ -266,20 +272,33 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) { - if (PrivateEndpointConnections != null) - { - writer.WritePropertyName("privateEndpointConnections"u8); - writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) { - writer.WriteNull("privateEndpointConnections"); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ManagedPrivateUDP)) + { + writer.WritePropertyName("managedPrivateUDP"u8); + writer.WriteStringValue(ManagedPrivateUDP.Value.ToString()); + } + if (Optional.IsDefined(DirectUDP)) + { + writer.WritePropertyName("directUDP"u8); + writer.WriteStringValue(DirectUDP.Value.ToString()); + } + if (Optional.IsDefined(PublicUDP)) + { + writer.WritePropertyName("publicUDP"u8); + writer.WriteStringValue(PublicUDP.Value.ToString()); + } + if (Optional.IsDefined(RelayUDP)) + { + writer.WritePropertyName("relayUDP"u8); + writer.WriteStringValue(RelayUDP.Value.ToString()); } writer.WriteEndObject(); } @@ -328,6 +347,7 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR bool? validationEnvironment = default; HostPoolRegistrationInfo registrationInfo = default; string vmTemplate = default; + ManagementType? managementType = default; IReadOnlyList applicationGroupReferences = default; IReadOnlyList appAttachPackageReferences = default; string ssoadfsAuthority = default; @@ -340,6 +360,10 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR HostPoolPublicNetworkAccess? publicNetworkAccess = default; SessionHostAgentUpdateProperties agentUpdate = default; IReadOnlyList privateEndpointConnections = default; + ManagedPrivateUDP? managedPrivateUDP = default; + DirectUDP? directUDP = default; + PublicUDP? publicUDP = default; + RelayUDP? relayUDP = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -373,7 +397,8 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { continue; } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("sku"u8)) @@ -531,6 +556,15 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR vmTemplate = property0.Value.GetString(); continue; } + if (property0.NameEquals("managementType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managementType = new ManagementType(property0.Value.GetString()); + continue; + } if (property0.NameEquals("applicationGroupReferences"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -634,7 +668,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - privateEndpointConnections = null; continue; } List array = new List(); @@ -645,6 +678,42 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR privateEndpointConnections = array; continue; } + if (property0.NameEquals("managedPrivateUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedPrivateUDP = new ManagedPrivateUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("directUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + directUDP = new DirectUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("publicUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicUDP = new PublicUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("relayUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relayUDP = new RelayUDP(property0.Value.GetString()); + continue; + } } continue; } @@ -673,6 +742,7 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR validationEnvironment, registrationInfo, vmTemplate, + managementType, applicationGroupReferences ?? new ChangeTrackingList(), appAttachPackageReferences ?? new ChangeTrackingList(), ssoadfsAuthority, @@ -685,6 +755,10 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR publicNetworkAccess, agentUpdate, privateEndpointConnections ?? new ChangeTrackingList(), + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, managedBy, kind, etag, @@ -1122,6 +1196,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagementType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managementType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagementType)) + { + builder.Append(" managementType: "); + builder.AppendLine($"'{ManagementType.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApplicationGroupReferences), out propertyOverride); if (hasPropertyOverride) { @@ -1375,6 +1464,66 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedPrivateUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedPrivateUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagedPrivateUDP)) + { + builder.Append(" managedPrivateUDP: "); + builder.AppendLine($"'{ManagedPrivateUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DirectUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" directUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DirectUDP)) + { + builder.Append(" directUDP: "); + builder.AppendLine($"'{DirectUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publicUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PublicUDP)) + { + builder.Append(" publicUDP: "); + builder.AppendLine($"'{PublicUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RelayUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" relayUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RelayUDP)) + { + builder.Append(" relayUDP: "); + builder.AppendLine($"'{RelayUDP.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs index 5a870d8b5a30..691f11754a80 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs @@ -83,8 +83,9 @@ public HostPoolData(AzureLocation location, HostPoolType hostPoolType, HostPoolL /// The type of the load balancer. /// The ring number of HostPool. /// Is validation environment. - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. /// VM template for sessionhosts configuration within hostpool. + /// The type of management for this hostpool, Automated or Standard. The default value is Automated. /// List of applicationGroup links. /// List of App Attach Package links. /// URL to customer ADFS server for signing WVD SSO certificates. @@ -97,14 +98,18 @@ public HostPoolData(AzureLocation location, HostPoolType hostPoolType, HostPoolL /// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. /// The session host configuration for updating agent, monitoring agent, and stack component. /// List of private endpoint connection associated with the specified resource. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// Keeps track of any properties unknown to the library. - internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType? personalDesktopAssignmentType, string customRdpProperty, int? maxSessionLimit, HostPoolLoadBalancerType loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfo registrationInfo, string vmTemplate, IReadOnlyList applicationGroupReferences, IReadOnlyList appAttachPackageReferences, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool? startVmOnConnect, bool? isCloudPCResource, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdateProperties agentUpdate, IReadOnlyList privateEndpointConnections, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string friendlyName, string description, HostPoolType hostPoolType, PersonalDesktopAssignmentType? personalDesktopAssignmentType, string customRdpProperty, int? maxSessionLimit, HostPoolLoadBalancerType loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfo registrationInfo, string vmTemplate, ManagementType? managementType, IReadOnlyList applicationGroupReferences, IReadOnlyList appAttachPackageReferences, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType preferredAppGroupType, bool? startVmOnConnect, bool? isCloudPCResource, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdateProperties agentUpdate, IReadOnlyList privateEndpointConnections, ManagedPrivateUDP? managedPrivateUDP, DirectUDP? directUDP, PublicUDP? publicUDP, RelayUDP? relayUDP, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ObjectId = objectId; FriendlyName = friendlyName; @@ -118,6 +123,7 @@ internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceT IsValidationEnvironment = isValidationEnvironment; RegistrationInfo = registrationInfo; VmTemplate = vmTemplate; + ManagementType = managementType; ApplicationGroupReferences = applicationGroupReferences; AppAttachPackageReferences = appAttachPackageReferences; SsoAdfsAuthority = ssoAdfsAuthority; @@ -130,6 +136,10 @@ internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceT PublicNetworkAccess = publicNetworkAccess; AgentUpdate = agentUpdate; PrivateEndpointConnections = privateEndpointConnections; + ManagedPrivateUDP = managedPrivateUDP; + DirectUDP = directUDP; + PublicUDP = publicUDP; + RelayUDP = relayUDP; ManagedBy = managedBy; Kind = kind; ETag = etag; @@ -174,12 +184,15 @@ internal HostPoolData() /// Is validation environment. [WirePath("properties.validationEnvironment")] public bool? IsValidationEnvironment { get; set; } - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. [WirePath("properties.registrationInfo")] public HostPoolRegistrationInfo RegistrationInfo { get; set; } /// VM template for sessionhosts configuration within hostpool. [WirePath("properties.vmTemplate")] public string VmTemplate { get; set; } + /// The type of management for this hostpool, Automated or Standard. The default value is Automated. + [WirePath("properties.managementType")] + public ManagementType? ManagementType { get; set; } /// List of applicationGroup links. [WirePath("properties.applicationGroupReferences")] public IReadOnlyList ApplicationGroupReferences { get; } @@ -216,6 +229,18 @@ internal HostPoolData() /// List of private endpoint connection associated with the specified resource. [WirePath("properties.privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.managedPrivateUDP")] + public ManagedPrivateUDP? ManagedPrivateUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.directUDP")] + public DirectUDP? DirectUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.publicUDP")] + public PublicUDP? PublicUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.relayUDP")] + public RelayUDP? RelayUDP { get; set; } /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. [WirePath("managedBy")] public ResourceIdentifier ManagedBy { get; set; } @@ -225,13 +250,13 @@ internal HostPoolData() /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. [WirePath("etag")] public ETag? ETag { get; } - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } /// The resource model definition representing SKU. [WirePath("sku")] public DesktopVirtualizationSku Sku { get; set; } - /// Gets or sets the plan. + /// Plan for the resource. [WirePath("plan")] public ArmPlan Plan { get; set; } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs index 33ffc142b577..b037f5f309f6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrU /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string pr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAs /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs index 306816ca5eaf..be01a4e3591f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -318,7 +318,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs index 97f440be1dc0..ab8efacf5d35 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs @@ -133,7 +133,7 @@ public virtual HostPoolPrivateEndpointConnectionCollection GetHostPoolPrivateEnd /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -164,7 +164,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,6 +182,27 @@ public virtual Response GetHostPoolPr return GetHostPoolPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } + /// Gets an object representing a SessionHostManagementResource along with the instance operations that can be performed on it in the HostPool. + /// Returns a object. + public virtual SessionHostManagementResource GetSessionHostManagement() + { + return new SessionHostManagementResource(Client, Id.AppendChildResource("sessionHostManagements", "default")); + } + + /// Gets an object representing a SessionHostConfigurationResource along with the instance operations that can be performed on it in the HostPool. + /// Returns a object. + public virtual SessionHostConfigurationResource GetSessionHostConfiguration() + { + return new SessionHostConfigurationResource(Client, Id.AppendChildResource("sessionHostConfigurations", "default")); + } + + /// Gets an object representing a ActiveSessionHostConfigurationResource along with the instance operations that can be performed on it in the HostPool. + /// Returns a object. + public virtual ActiveSessionHostConfigurationResource GetActiveSessionHostConfiguration() + { + return new ActiveSessionHostConfigurationResource(Client, Id.AppendChildResource("activeSessionHostConfigurations", "default")); + } + /// Gets a collection of SessionHostResources in the HostPool. /// An object representing collection of SessionHostResources and their operations over a SessionHostResource. public virtual SessionHostCollection GetSessionHosts() @@ -202,7 +223,7 @@ public virtual SessionHostCollection GetSessionHosts() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -233,7 +254,7 @@ public virtual async Task> GetSessionHostAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -271,7 +292,7 @@ public virtual MsixPackageCollection GetMsixPackages() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -302,7 +323,7 @@ public virtual async Task> GetMsixPackageAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -333,7 +354,7 @@ public virtual Response GetMsixPackage(string msixPackageFu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -373,7 +394,7 @@ public virtual async Task> GetAsync(CancellationToken /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -413,7 +434,7 @@ public virtual Response Get(CancellationToken cancellationToke /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -458,7 +479,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -503,7 +524,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -545,7 +566,7 @@ public virtual async Task> UpdateAsync(HostPoolPatch /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -587,7 +608,7 @@ public virtual Response Update(HostPoolPatch patch, Cancellati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -616,7 +637,7 @@ public virtual AsyncPageable GetPr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -645,7 +666,7 @@ public virtual Pageable GetPrivate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -678,7 +699,7 @@ public virtual AsyncPageable GetScalingPlansAsync(int? page /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -711,7 +732,7 @@ public virtual Pageable GetScalingPlans(int? pageSize = nul /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -749,7 +770,7 @@ public virtual async Task> RetrieveRegistrati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -774,6 +795,64 @@ public virtual Response RetrieveRegistrationToken(Canc } } + /// + /// Operation to list the RegistrationTokens associated with the HostPool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/listRegistrationTokens + /// + /// + /// Operation Id + /// HostPools_ListRegistrationTokens + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegistrationTokensAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _hostPoolRestClient.CreateListRegistrationTokensRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => RegistrationTokenMinimal.DeserializeRegistrationTokenMinimal(e), _hostPoolClientDiagnostics, Pipeline, "HostPoolResource.GetRegistrationTokens", "value", null, cancellationToken); + } + + /// + /// Operation to list the RegistrationTokens associated with the HostPool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/listRegistrationTokens + /// + /// + /// Operation Id + /// HostPools_ListRegistrationTokens + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegistrationTokens(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _hostPoolRestClient.CreateListRegistrationTokensRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => RegistrationTokenMinimal.DeserializeRegistrationTokenMinimal(e), _hostPoolClientDiagnostics, Pipeline, "HostPoolResource.GetRegistrationTokens", "value", null, cancellationToken); + } + /// /// List userSessions. /// @@ -787,7 +866,7 @@ public virtual Response RetrieveRegistrationToken(Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -821,7 +900,7 @@ public virtual AsyncPageable GetUserSessionsAsync(string fi /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -855,7 +934,7 @@ public virtual Pageable GetUserSessions(string filter = nul /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -885,7 +964,7 @@ public virtual AsyncPageable ImportAppAttachPackageInf /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -915,7 +994,7 @@ public virtual Pageable ImportAppAttachPackageInfos(Im /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -945,7 +1024,7 @@ public virtual AsyncPageable ExpandMsixImagesAsync(MsixImageUri /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -975,7 +1054,7 @@ public virtual Pageable ExpandMsixImages(MsixImageUri msixImage /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1037,7 +1116,7 @@ public virtual async Task> AddTagAsync(string key, st /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1099,7 +1178,7 @@ public virtual Response AddTag(string key, string value, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1156,7 +1235,7 @@ public virtual async Task> SetTagsAsync(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1213,7 +1292,7 @@ public virtual Response SetTags(IDictionary ta /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -1273,7 +1352,7 @@ public virtual async Task> RemoveTagAsync(string key, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/LongRunningOperation/SessionHostConfigurationOperationSource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/LongRunningOperation/SessionHostConfigurationOperationSource.cs new file mode 100644 index 000000000000..e477583fcc81 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/LongRunningOperation/SessionHostConfigurationOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal class SessionHostConfigurationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SessionHostConfigurationOperationSource(ArmClient client) + { + _client = client; + } + + SessionHostConfigurationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDesktopVirtualizationContext.Default); + return new SessionHostConfigurationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDesktopVirtualizationContext.Default); + return await Task.FromResult(new SessionHostConfigurationResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..f7b9933a1ff7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.Serialization.cs @@ -0,0 +1,133 @@ +// 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.DesktopVirtualization.Models +{ + internal partial class ActiveDirectoryInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DomainCredentials)) + { + writer.WritePropertyName("domainCredentials"u8); + writer.WriteObjectValue(DomainCredentials, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ActiveDirectoryInfoPatchProperties 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(ActiveDirectoryInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryInfoPatchProperties(document.RootElement, options); + } + + internal static ActiveDirectoryInfoPatchProperties DeserializeActiveDirectoryInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyVaultCredentialsPatchProperties domainCredentials = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("domainCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainCredentials = KeyVaultCredentialsPatchProperties.DeserializeKeyVaultCredentialsPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActiveDirectoryInfoPatchProperties(domainCredentials, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ActiveDirectoryInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeActiveDirectoryInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.cs new file mode 100644 index 000000000000..619f0aabc0ca --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoPatchProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Active directory info. Only one should be populated based on the join type. + internal partial class ActiveDirectoryInfoPatchProperties + { + /// + /// 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 ActiveDirectoryInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// Credentials needed to create the virtual machine. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryInfoPatchProperties(KeyVaultCredentialsPatchProperties domainCredentials, IDictionary serializedAdditionalRawData) + { + DomainCredentials = domainCredentials; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Credentials needed to create the virtual machine. + [WirePath("domainCredentials")] + public KeyVaultCredentialsPatchProperties DomainCredentials { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.Serialization.cs new file mode 100644 index 000000000000..b17c3ee69e06 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.Serialization.cs @@ -0,0 +1,224 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class ActiveDirectoryInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("domainCredentials"u8); + writer.WriteObjectValue(DomainCredentials, options); + writer.WritePropertyName("ouPath"u8); + writer.WriteStringValue(OuPath); + if (Optional.IsDefined(DomainName)) + { + writer.WritePropertyName("domainName"u8); + writer.WriteStringValue(DomainName); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ActiveDirectoryInfoProperties 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(ActiveDirectoryInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryInfoProperties(document.RootElement, options); + } + + internal static ActiveDirectoryInfoProperties DeserializeActiveDirectoryInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyVaultCredentialsProperties domainCredentials = default; + string ouPath = default; + string domainName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("domainCredentials"u8)) + { + domainCredentials = KeyVaultCredentialsProperties.DeserializeKeyVaultCredentialsProperties(property.Value, options); + continue; + } + if (property.NameEquals("ouPath"u8)) + { + ouPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("domainName"u8)) + { + domainName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActiveDirectoryInfoProperties(domainCredentials, ouPath, domainName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DomainCredentials), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" domainCredentials: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DomainCredentials)) + { + builder.Append(" domainCredentials: "); + BicepSerializationHelpers.AppendChildObject(builder, DomainCredentials, options, 2, false, " domainCredentials: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OuPath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ouPath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OuPath)) + { + builder.Append(" ouPath: "); + if (OuPath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{OuPath}'''"); + } + else + { + builder.AppendLine($"'{OuPath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DomainName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" domainName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DomainName)) + { + builder.Append(" domainName: "); + if (DomainName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DomainName}'''"); + } + else + { + builder.AppendLine($"'{DomainName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + ActiveDirectoryInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeActiveDirectoryInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.cs new file mode 100644 index 000000000000..baf61fefeccc --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveDirectoryInfoProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Active directory info. Only one should be populated based on the join type. + public partial class ActiveDirectoryInfoProperties + { + /// + /// 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 . + /// Credentials needed to create the virtual machine. + /// The organizational unit(OU) path. + /// or is null. + public ActiveDirectoryInfoProperties(KeyVaultCredentialsProperties domainCredentials, string ouPath) + { + Argument.AssertNotNull(domainCredentials, nameof(domainCredentials)); + Argument.AssertNotNull(ouPath, nameof(ouPath)); + + DomainCredentials = domainCredentials; + OuPath = ouPath; + } + + /// Initializes a new instance of . + /// Credentials needed to create the virtual machine. + /// The organizational unit(OU) path. + /// The domain a virtual machine connected to a hostpool will join. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryInfoProperties(KeyVaultCredentialsProperties domainCredentials, string ouPath, string domainName, IDictionary serializedAdditionalRawData) + { + DomainCredentials = domainCredentials; + OuPath = ouPath; + DomainName = domainName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ActiveDirectoryInfoProperties() + { + } + + /// Credentials needed to create the virtual machine. + [WirePath("domainCredentials")] + public KeyVaultCredentialsProperties DomainCredentials { get; set; } + /// The organizational unit(OU) path. + [WirePath("ouPath")] + public string OuPath { get; set; } + /// The domain a virtual machine connected to a hostpool will join. + [WirePath("domainName")] + public string DomainName { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.Serialization.cs new file mode 100644 index 000000000000..11b60d1e9f5a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.Serialization.cs @@ -0,0 +1,219 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class ActiveSessionHostConfigurationList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ActiveSessionHostConfigurationList 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(ActiveSessionHostConfigurationList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveSessionHostConfigurationList(document.RootElement, options); + } + + internal static ActiveSessionHostConfigurationList DeserializeActiveSessionHostConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ActiveSessionHostConfigurationData.DeserializeActiveSessionHostConfigurationData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActiveSessionHostConfigurationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationList)} does not support writing '{options.Format}' format."); + } + } + + ActiveSessionHostConfigurationList 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeActiveSessionHostConfigurationList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveSessionHostConfigurationList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.cs new file mode 100644 index 000000000000..64f67c5b5257 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// List of ActiveSessionHostConfiguration definitions. + internal partial class ActiveSessionHostConfigurationList + { + /// + /// 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 . + internal ActiveSessionHostConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of ActiveSessionHostConfiguration definitions. + /// Link to the next page of results. + /// Keeps track of any properties unknown to the library. + internal ActiveSessionHostConfigurationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of ActiveSessionHostConfiguration definitions. + public IReadOnlyList Value { get; } + /// Link to the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs index 150139b210a3..75f9f111631b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs @@ -54,17 +54,17 @@ public AppAttachPackageInfoProperties() /// Initializes a new instance of . /// Alias of App Attach Package. Assigned at import time. - /// VHD/CIM image path on Network Share. + /// VHD/CIM/APP-V image path on Network Share. /// Package Name from appxmanifest.xml. - /// Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - /// Package Full Name from appxmanifest.xml. + /// Identifier not including the package version, for Msix packages it is the family name from the appxmanifest.xml. + /// Identifier including the package version, for Msix packages it is the full name from the appxmanifest.xml. /// User friendly Name to be displayed in the portal. /// Relative Path to the package inside the image. /// Specifies how to register Package in feed. /// Make this version of the package the active one across the hostpool. /// List of package dependencies. - /// Package version found in the appxmanifest.xml. - /// Date Package was last updated, found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. + /// Date the package source was last updated, for Msix packages this is found in the appxmanifest.xml. /// List of package applications. /// Certificate name found in the appxmanifest.xml. /// Date certificate expires, found in the appxmanifest.xml. @@ -94,16 +94,16 @@ internal AppAttachPackageInfoProperties(string packageAlias, string imagePath, s /// Alias of App Attach Package. Assigned at import time. [WirePath("packageAlias")] public string PackageAlias { get; set; } - /// VHD/CIM image path on Network Share. + /// VHD/CIM/APP-V image path on Network Share. [WirePath("imagePath")] public string ImagePath { get; set; } /// Package Name from appxmanifest.xml. [WirePath("packageName")] public string PackageName { get; set; } - /// Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. + /// Identifier not including the package version, for Msix packages it is the family name from the appxmanifest.xml. [WirePath("packageFamilyName")] public string PackageFamilyName { get; set; } - /// Package Full Name from appxmanifest.xml. + /// Identifier including the package version, for Msix packages it is the full name from the appxmanifest.xml. [WirePath("packageFullName")] public string PackageFullName { get; set; } /// User friendly Name to be displayed in the portal. @@ -121,10 +121,10 @@ internal AppAttachPackageInfoProperties(string packageAlias, string imagePath, s /// List of package dependencies. [WirePath("packageDependencies")] public IList PackageDependencies { get; set; } - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. [WirePath("version")] public string Version { get; set; } - /// Date Package was last updated, found in the appxmanifest.xml. + /// Date the package source was last updated, for Msix packages this is found in the appxmanifest.xml. [WirePath("lastUpdated")] public DateTimeOffset? LastUpdatedOn { get; set; } /// List of package applications. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.Serialization.cs index d779bd4a93b2..1d7a1ca50f15 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -37,6 +38,17 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); @@ -64,6 +76,7 @@ internal static AppAttachPackagePatch DeserializeAppAttachPackagePatch(JsonEleme { return null; } + IDictionary tags = default; AppAttachPackagePatchProperties properties = default; ResourceIdentifier id = default; string name = default; @@ -73,6 +86,20 @@ internal static AppAttachPackagePatch DeserializeAppAttachPackagePatch(JsonEleme Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -117,6 +144,7 @@ internal static AppAttachPackagePatch DeserializeAppAttachPackagePatch(JsonEleme name, type, systemData, + tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } @@ -155,6 +183,43 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs index 7db935c8b41a..8a687095d165 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Schema for updatable App Attach Package properties. + /// Schema for patchable App Attach Package properties. public partial class AppAttachPackagePatch : ResourceData { /// @@ -50,6 +50,7 @@ public partial class AppAttachPackagePatch : ResourceData /// Initializes a new instance of . public AppAttachPackagePatch() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -57,14 +58,19 @@ public AppAttachPackagePatch() /// The name. /// The resourceType. /// The systemData. + /// tags to be updated. /// Detailed properties for App Attach Package. /// Keeps track of any properties unknown to the library. - internal AppAttachPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppAttachPackagePatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AppAttachPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AppAttachPackagePatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + Tags = tags; Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// tags to be updated. + [WirePath("tags")] + public IDictionary Tags { get; } /// Detailed properties for App Attach Package. [WirePath("properties")] public AppAttachPackagePatchProperties Properties { get; set; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.Serialization.cs index d6af88f9c7a9..df76de579a66 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.Serialization.cs @@ -66,6 +66,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("failHealthCheckOnStagingFailure"u8); writer.WriteStringValue(FailHealthCheckOnStagingFailure.Value.ToString()); } + if (Optional.IsDefined(PackageLookbackUri)) + { + writer.WritePropertyName("packageLookbackUrl"u8); + writer.WriteStringValue(PackageLookbackUri.AbsoluteUri); + } + if (Optional.IsDefined(CustomData)) + { + writer.WritePropertyName("customData"u8); + writer.WriteStringValue(CustomData); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -107,6 +117,8 @@ internal static AppAttachPackagePatchProperties DeserializeAppAttachPackagePatch IList hostPoolReferences = default; Uri keyVaultURL = default; FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = default; + Uri packageLookbackUrl = default; + string customData = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -159,13 +171,34 @@ internal static AppAttachPackagePatchProperties DeserializeAppAttachPackagePatch failHealthCheckOnStagingFailure = new FailHealthCheckOnStagingFailure(property.Value.GetString()); continue; } + if (property.NameEquals("packageLookbackUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + packageLookbackUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("customData"u8)) + { + customData = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AppAttachPackagePatchProperties(image, hostPoolReferences ?? new ChangeTrackingList(), keyVaultURL, failHealthCheckOnStagingFailure, serializedAdditionalRawData); + return new AppAttachPackagePatchProperties( + image, + hostPoolReferences ?? new ChangeTrackingList(), + keyVaultURL, + failHealthCheckOnStagingFailure, + packageLookbackUrl, + customData, + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -252,6 +285,44 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageLookbackUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageLookbackUrl: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageLookbackUri)) + { + builder.Append(" packageLookbackUrl: "); + builder.AppendLine($"'{PackageLookbackUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomData)) + { + builder.Append(" customData: "); + if (CustomData.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CustomData}'''"); + } + else + { + builder.AppendLine($"'{CustomData}'"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs index 9cab5040c943..0d16d0957677 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs @@ -55,15 +55,19 @@ public AppAttachPackagePatchProperties() /// Initializes a new instance of . /// Detailed properties for App Attach Package. /// List of Hostpool resource Ids. - /// URL path to certificate name located in keyVault. + /// URL of keyvault location to store certificate. /// Parameter indicating how the health check should behave if this package fails staging. + /// Lookback url to third party control plane, should be null for first party packages. + /// Field that can be populated with custom data and filtered on in list GET calls. /// Keeps track of any properties unknown to the library. - internal AppAttachPackagePatchProperties(AppAttachPackageInfoProperties image, IList hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, IDictionary serializedAdditionalRawData) + internal AppAttachPackagePatchProperties(AppAttachPackageInfoProperties image, IList hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, Uri packageLookbackUri, string customData, IDictionary serializedAdditionalRawData) { Image = image; HostPoolReferences = hostPoolReferences; KeyVaultUri = keyVaultUri; FailHealthCheckOnStagingFailure = failHealthCheckOnStagingFailure; + PackageLookbackUri = packageLookbackUri; + CustomData = customData; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -73,11 +77,17 @@ internal AppAttachPackagePatchProperties(AppAttachPackageInfoProperties image, I /// List of Hostpool resource Ids. [WirePath("hostPoolReferences")] public IList HostPoolReferences { get; } - /// URL path to certificate name located in keyVault. + /// URL of keyvault location to store certificate. [WirePath("keyVaultURL")] public Uri KeyVaultUri { get; set; } /// Parameter indicating how the health check should behave if this package fails staging. [WirePath("failHealthCheckOnStagingFailure")] public FailHealthCheckOnStagingFailure? FailHealthCheckOnStagingFailure { get; set; } + /// Lookback url to third party control plane, should be null for first party packages. + [WirePath("packageLookbackUrl")] + public Uri PackageLookbackUri { get; set; } + /// Field that can be populated with custom data and filtered on in list GET calls. + [WirePath("customData")] + public string CustomData { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs index 02057f13c54a..0d6a3ceebcaf 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs @@ -66,6 +66,28 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("failHealthCheckOnStagingFailure"u8); writer.WriteStringValue(FailHealthCheckOnStagingFailure.Value.ToString()); } + if (Optional.IsDefined(PackageOwnerName)) + { + writer.WritePropertyName("packageOwnerName"u8); + writer.WriteStringValue(PackageOwnerName); + } + if (Optional.IsDefined(PackageLookbackUri)) + { + if (PackageLookbackUri != null) + { + writer.WritePropertyName("packageLookbackUrl"u8); + writer.WriteStringValue(PackageLookbackUri.AbsoluteUri); + } + else + { + writer.WriteNull("packageLookbackUrl"); + } + } + if (Optional.IsDefined(CustomData)) + { + writer.WritePropertyName("customData"u8); + writer.WriteStringValue(CustomData); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -108,6 +130,9 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties IList hostPoolReferences = default; Uri keyVaultURL = default; FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = default; + string packageOwnerName = default; + Uri packageLookbackUrl = default; + string customData = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -162,6 +187,26 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties failHealthCheckOnStagingFailure = new FailHealthCheckOnStagingFailure(property.Value.GetString()); continue; } + if (property.NameEquals("packageOwnerName"u8)) + { + packageOwnerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("packageLookbackUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + packageLookbackUrl = null; + continue; + } + packageLookbackUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("customData"u8)) + { + customData = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -174,6 +219,9 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties hostPoolReferences ?? new ChangeTrackingList(), keyVaultURL, failHealthCheckOnStagingFailure, + packageOwnerName, + packageLookbackUrl, + customData, serializedAdditionalRawData); } @@ -284,6 +332,67 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageOwnerName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageOwnerName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageOwnerName)) + { + builder.Append(" packageOwnerName: "); + if (PackageOwnerName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageOwnerName}'''"); + } + else + { + builder.AppendLine($"'{PackageOwnerName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageLookbackUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageLookbackUrl: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageLookbackUri)) + { + builder.Append(" packageLookbackUrl: "); + builder.AppendLine($"'{PackageLookbackUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomData)) + { + builder.Append(" customData: "); + if (CustomData.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CustomData}'''"); + } + else + { + builder.AppendLine($"'{CustomData}'"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs index 5ed2b98f68d7..68011a27f3ec 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs @@ -55,16 +55,22 @@ public AppAttachPackageProperties() /// The provisioning state of the App Attach Package. /// Detailed properties for App Attach Package. /// List of Hostpool resource Ids. - /// URL path to certificate name located in keyVault. + /// URL of keyvault location to store certificate. /// Parameter indicating how the health check should behave if this package fails staging. + /// Specific name of package owner, is "AppAttach" for native app attach packages. + /// Lookback url to third party control plane, is null for native app attach packages. + /// Field that can be populated with custom data and filtered on in list GET calls. /// Keeps track of any properties unknown to the library. - internal AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState, AppAttachPackageInfoProperties image, IList hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, IDictionary serializedAdditionalRawData) + internal AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState, AppAttachPackageInfoProperties image, IList hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, string packageOwnerName, Uri packageLookbackUri, string customData, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Image = image; HostPoolReferences = hostPoolReferences; KeyVaultUri = keyVaultUri; FailHealthCheckOnStagingFailure = failHealthCheckOnStagingFailure; + PackageOwnerName = packageOwnerName; + PackageLookbackUri = packageLookbackUri; + CustomData = customData; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -77,11 +83,20 @@ internal AppAttachPackageProperties(AppAttachPackageProvisioningState? provision /// List of Hostpool resource Ids. [WirePath("hostPoolReferences")] public IList HostPoolReferences { get; } - /// URL path to certificate name located in keyVault. + /// URL of keyvault location to store certificate. [WirePath("keyVaultURL")] public Uri KeyVaultUri { get; set; } /// Parameter indicating how the health check should behave if this package fails staging. [WirePath("failHealthCheckOnStagingFailure")] public FailHealthCheckOnStagingFailure? FailHealthCheckOnStagingFailure { get; set; } + /// Specific name of package owner, is "AppAttach" for native app attach packages. + [WirePath("packageOwnerName")] + public string PackageOwnerName { get; set; } + /// Lookback url to third party control plane, is null for native app attach packages. + [WirePath("packageLookbackUrl")] + public Uri PackageLookbackUri { get; set; } + /// Field that can be populated with custom data and filtered on in list GET calls. + [WirePath("customData")] + public string CustomData { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.Serialization.cs new file mode 100644 index 000000000000..1eb966c5cc87 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.Serialization.cs @@ -0,0 +1,167 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class AzureActiveDirectoryInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureActiveDirectoryInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("mdmProviderGuid"u8); + writer.WriteStringValue(MdmProviderGuid); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureActiveDirectoryInfoProperties 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(AzureActiveDirectoryInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureActiveDirectoryInfoProperties(document.RootElement, options); + } + + internal static AzureActiveDirectoryInfoProperties DeserializeAzureActiveDirectoryInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mdmProviderGuid = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mdmProviderGuid"u8)) + { + mdmProviderGuid = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureActiveDirectoryInfoProperties(mdmProviderGuid, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MdmProviderGuid), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mdmProviderGuid: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MdmProviderGuid)) + { + builder.Append(" mdmProviderGuid: "); + if (MdmProviderGuid.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MdmProviderGuid}'''"); + } + else + { + builder.AppendLine($"'{MdmProviderGuid}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AzureActiveDirectoryInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + AzureActiveDirectoryInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAzureActiveDirectoryInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureActiveDirectoryInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.cs new file mode 100644 index 000000000000..53c6097fe555 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AzureActiveDirectoryInfoProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Azure Active directory info. Only one should be populated based on the join type. + internal partial class AzureActiveDirectoryInfoProperties + { + /// + /// 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 . + /// The Mobile Device Management(MDM) guid. + /// is null. + public AzureActiveDirectoryInfoProperties(string mdmProviderGuid) + { + Argument.AssertNotNull(mdmProviderGuid, nameof(mdmProviderGuid)); + + MdmProviderGuid = mdmProviderGuid; + } + + /// Initializes a new instance of . + /// The Mobile Device Management(MDM) guid. + /// Keeps track of any properties unknown to the library. + internal AzureActiveDirectoryInfoProperties(string mdmProviderGuid, IDictionary serializedAdditionalRawData) + { + MdmProviderGuid = mdmProviderGuid; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureActiveDirectoryInfoProperties() + { + } + + /// The Mobile Device Management(MDM) guid. + [WirePath("mdmProviderGuid")] + public string MdmProviderGuid { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..344deab8e05f --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.Serialization.cs @@ -0,0 +1,148 @@ +// 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.DesktopVirtualization.Models +{ + public partial class BootDiagnosticsInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BootDiagnosticsInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(StorageUri)) + { + writer.WritePropertyName("storageUri"u8); + writer.WriteStringValue(StorageUri.AbsoluteUri); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BootDiagnosticsInfoPatchProperties 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(BootDiagnosticsInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBootDiagnosticsInfoPatchProperties(document.RootElement, options); + } + + internal static BootDiagnosticsInfoPatchProperties DeserializeBootDiagnosticsInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + Uri storageUri = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("storageUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageUri = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BootDiagnosticsInfoPatchProperties(enabled, storageUri, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(BootDiagnosticsInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + BootDiagnosticsInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBootDiagnosticsInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BootDiagnosticsInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.cs new file mode 100644 index 000000000000..bfe54f4305d7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoPatchProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + public partial class BootDiagnosticsInfoPatchProperties + { + /// + /// 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 BootDiagnosticsInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// Whether boot diagnostics should be enabled on the Virtual Machine. + /// Uri of the storage account to use for placing the console output and screenshot. <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + /// Keeps track of any properties unknown to the library. + internal BootDiagnosticsInfoPatchProperties(bool? enabled, Uri storageUri, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + StorageUri = storageUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether boot diagnostics should be enabled on the Virtual Machine. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Uri of the storage account to use for placing the console output and screenshot. <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + [WirePath("storageUri")] + public Uri StorageUri { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.Serialization.cs new file mode 100644 index 000000000000..c07152048e61 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.Serialization.cs @@ -0,0 +1,205 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class BootDiagnosticsInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BootDiagnosticsInfoProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(StorageUri)) + { + if (StorageUri != null) + { + writer.WritePropertyName("storageUri"u8); + writer.WriteStringValue(StorageUri.AbsoluteUri); + } + else + { + writer.WriteNull("storageUri"); + } + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BootDiagnosticsInfoProperties 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(BootDiagnosticsInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBootDiagnosticsInfoProperties(document.RootElement, options); + } + + internal static BootDiagnosticsInfoProperties DeserializeBootDiagnosticsInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + Uri storageUri = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("storageUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + storageUri = null; + continue; + } + storageUri = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BootDiagnosticsInfoProperties(enabled, storageUri, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storageUri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageUri)) + { + builder.Append(" storageUri: "); + builder.AppendLine($"'{StorageUri.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(BootDiagnosticsInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + BootDiagnosticsInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBootDiagnosticsInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BootDiagnosticsInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.cs new file mode 100644 index 000000000000..52c5e66bdf7b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + public partial class BootDiagnosticsInfoProperties + { + /// + /// 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 BootDiagnosticsInfoProperties() + { + } + + /// Initializes a new instance of . + /// Whether boot diagnostics should be enabled on the Virtual Machine. + /// Uri of the storage account to use for placing the console output and screenshot. <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + /// Keeps track of any properties unknown to the library. + internal BootDiagnosticsInfoProperties(bool? enabled, Uri storageUri, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + StorageUri = storageUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether boot diagnostics should be enabled on the Virtual Machine. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Uri of the storage account to use for placing the console output and screenshot. <br><br>If storageUri is not specified while enabling boot diagnostics, managed storage will be used. + [WirePath("storageUri")] + public Uri StorageUri { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CanaryPolicy.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CanaryPolicy.cs new file mode 100644 index 000000000000..68ebd662b13e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CanaryPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Policy on whether a Canary VM should be provisioned during a session host provisioning operation. + public readonly partial struct CanaryPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CanaryPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "Auto"; + private const string NeverValue = "Never"; + private const string AlwaysValue = "Always"; + + /// Auto. + public static CanaryPolicy Auto { get; } = new CanaryPolicy(AutoValue); + /// Never. + public static CanaryPolicy Never { get; } = new CanaryPolicy(NeverValue); + /// Always. + public static CanaryPolicy Always { get; } = new CanaryPolicy(AlwaysValue); + /// Determines if two values are the same. + public static bool operator ==(CanaryPolicy left, CanaryPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CanaryPolicy left, CanaryPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CanaryPolicy(string value) => new CanaryPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CanaryPolicy other && Equals(other); + /// + public bool Equals(CanaryPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.Serialization.cs new file mode 100644 index 000000000000..616eec1dc039 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.Serialization.cs @@ -0,0 +1,288 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class CreateDeleteProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateDeleteProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RampUpMaximumHostPoolSize)) + { + if (RampUpMaximumHostPoolSize != null) + { + writer.WritePropertyName("rampUpMaximumHostPoolSize"u8); + writer.WriteNumberValue(RampUpMaximumHostPoolSize.Value); + } + else + { + writer.WriteNull("rampUpMaximumHostPoolSize"); + } + } + if (Optional.IsDefined(RampUpMinimumHostPoolSize)) + { + if (RampUpMinimumHostPoolSize != null) + { + writer.WritePropertyName("rampUpMinimumHostPoolSize"u8); + writer.WriteNumberValue(RampUpMinimumHostPoolSize.Value); + } + else + { + writer.WriteNull("rampUpMinimumHostPoolSize"); + } + } + if (Optional.IsDefined(RampDownMaximumHostPoolSize)) + { + if (RampDownMaximumHostPoolSize != null) + { + writer.WritePropertyName("rampDownMaximumHostPoolSize"u8); + writer.WriteNumberValue(RampDownMaximumHostPoolSize.Value); + } + else + { + writer.WriteNull("rampDownMaximumHostPoolSize"); + } + } + if (Optional.IsDefined(RampDownMinimumHostPoolSize)) + { + if (RampDownMinimumHostPoolSize != null) + { + writer.WritePropertyName("rampDownMinimumHostPoolSize"u8); + writer.WriteNumberValue(RampDownMinimumHostPoolSize.Value); + } + else + { + writer.WriteNull("rampDownMinimumHostPoolSize"); + } + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateDeleteProperties 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(CreateDeleteProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateDeleteProperties(document.RootElement, options); + } + + internal static CreateDeleteProperties DeserializeCreateDeleteProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? rampUpMaximumHostPoolSize = default; + int? rampUpMinimumHostPoolSize = default; + int? rampDownMaximumHostPoolSize = default; + int? rampDownMinimumHostPoolSize = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rampUpMaximumHostPoolSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rampUpMaximumHostPoolSize = null; + continue; + } + rampUpMaximumHostPoolSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampUpMinimumHostPoolSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rampUpMinimumHostPoolSize = null; + continue; + } + rampUpMinimumHostPoolSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownMaximumHostPoolSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rampDownMaximumHostPoolSize = null; + continue; + } + rampDownMaximumHostPoolSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownMinimumHostPoolSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + rampDownMinimumHostPoolSize = null; + continue; + } + rampDownMinimumHostPoolSize = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateDeleteProperties(rampUpMaximumHostPoolSize, rampUpMinimumHostPoolSize, rampDownMaximumHostPoolSize, rampDownMinimumHostPoolSize, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpMaximumHostPoolSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampUpMaximumHostPoolSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpMaximumHostPoolSize)) + { + builder.Append(" rampUpMaximumHostPoolSize: "); + builder.AppendLine($"{RampUpMaximumHostPoolSize.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpMinimumHostPoolSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampUpMinimumHostPoolSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpMinimumHostPoolSize)) + { + builder.Append(" rampUpMinimumHostPoolSize: "); + builder.AppendLine($"{RampUpMinimumHostPoolSize.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownMaximumHostPoolSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownMaximumHostPoolSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownMaximumHostPoolSize)) + { + builder.Append(" rampDownMaximumHostPoolSize: "); + builder.AppendLine($"{RampDownMaximumHostPoolSize.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownMinimumHostPoolSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownMinimumHostPoolSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownMinimumHostPoolSize)) + { + builder.Append(" rampDownMinimumHostPoolSize: "); + builder.AppendLine($"{RampDownMinimumHostPoolSize.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CreateDeleteProperties)} does not support writing '{options.Format}' format."); + } + } + + CreateDeleteProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateDeleteProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateDeleteProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.cs new file mode 100644 index 000000000000..607ed3b1ca89 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. + public partial class CreateDeleteProperties + { + /// + /// 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 CreateDeleteProperties() + { + } + + /// Initializes a new instance of . + /// Maximum number of session hosts that may be created by the Scaling Service. This requires the assigned hostpool to have a session host config property. + /// Minimum number of session hosts that will be be created by the Scaling Service. Scaling will not delete any hosts when this limit is met. This requires the assigned hostpool to have a session host config property. + /// Maximum number of session hosts that may be created by the Scaling Service. This requires the assigned hostpool to have a session host config property. + /// Minimum number of session hosts that will be be created by the Scaling Service. Scaling will not delete any hosts when this limit is met. This requires the assigned hostpool to have a session host config property. + /// Keeps track of any properties unknown to the library. + internal CreateDeleteProperties(int? rampUpMaximumHostPoolSize, int? rampUpMinimumHostPoolSize, int? rampDownMaximumHostPoolSize, int? rampDownMinimumHostPoolSize, IDictionary serializedAdditionalRawData) + { + RampUpMaximumHostPoolSize = rampUpMaximumHostPoolSize; + RampUpMinimumHostPoolSize = rampUpMinimumHostPoolSize; + RampDownMaximumHostPoolSize = rampDownMaximumHostPoolSize; + RampDownMinimumHostPoolSize = rampDownMinimumHostPoolSize; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Maximum number of session hosts that may be created by the Scaling Service. This requires the assigned hostpool to have a session host config property. + [WirePath("rampUpMaximumHostPoolSize")] + public int? RampUpMaximumHostPoolSize { get; set; } + /// Minimum number of session hosts that will be be created by the Scaling Service. Scaling will not delete any hosts when this limit is met. This requires the assigned hostpool to have a session host config property. + [WirePath("rampUpMinimumHostPoolSize")] + public int? RampUpMinimumHostPoolSize { get; set; } + /// Maximum number of session hosts that may be created by the Scaling Service. This requires the assigned hostpool to have a session host config property. + [WirePath("rampDownMaximumHostPoolSize")] + public int? RampDownMaximumHostPoolSize { get; set; } + /// Minimum number of session hosts that will be be created by the Scaling Service. Scaling will not delete any hosts when this limit is met. This requires the assigned hostpool to have a session host config property. + [WirePath("rampDownMinimumHostPoolSize")] + public int? RampDownMinimumHostPoolSize { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..05333a107006 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.Serialization.cs @@ -0,0 +1,133 @@ +// 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.DesktopVirtualization.Models +{ + internal partial class CustomInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomInfoPatchProperties 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(CustomInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomInfoPatchProperties(document.RootElement, options); + } + + internal static CustomInfoPatchProperties DeserializeCustomInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomInfoPatchProperties(resourceId, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(CustomInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + CustomInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.cs new file mode 100644 index 000000000000..dc841215a87f --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoPatchProperties.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Custom image information. + internal partial class CustomInfoPatchProperties + { + /// + /// 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 CustomInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// The resource id of the custom image. + /// Keeps track of any properties unknown to the library. + internal CustomInfoPatchProperties(ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id of the custom image. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.Serialization.cs new file mode 100644 index 000000000000..578fae1697d8 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.Serialization.cs @@ -0,0 +1,159 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class CustomInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomInfoProperties 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(CustomInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomInfoProperties(document.RootElement, options); + } + + internal static CustomInfoProperties DeserializeCustomInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomInfoProperties(resourceId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + builder.AppendLine($"'{ResourceId.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + CustomInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.cs new file mode 100644 index 000000000000..70468866dcf2 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CustomInfoProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Custom image information. + internal partial class CustomInfoProperties + { + /// + /// 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 . + /// The resource id of the custom image. + /// is null. + public CustomInfoProperties(ResourceIdentifier resourceId) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ResourceId = resourceId; + } + + /// Initializes a new instance of . + /// The resource id of the custom image. + /// Keeps track of any properties unknown to the library. + internal CustomInfoProperties(ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomInfoProperties() + { + } + + /// The resource id of the custom image. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskOption.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskOption.cs new file mode 100644 index 000000000000..0ed96e17ab6d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskOption.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Specifies the ephemeral disk settings for operating system disk. + public readonly partial struct DiffDiskOption : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DiffDiskOption(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LocalValue = "Local"; + + /// Operating system disk local setting. + public static DiffDiskOption Local { get; } = new DiffDiskOption(LocalValue); + /// Determines if two values are the same. + public static bool operator ==(DiffDiskOption left, DiffDiskOption right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DiffDiskOption left, DiffDiskOption right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DiffDiskOption(string value) => new DiffDiskOption(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DiffDiskOption other && Equals(other); + /// + public bool Equals(DiffDiskOption other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskPlacement.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskPlacement.cs new file mode 100644 index 000000000000..d16b3211b9e9 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskPlacement.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Gets or sets specifies the ephemeral disk placement for operating system disk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible values include: 'CacheDisk', 'ResourceDisk'. + public readonly partial struct DiffDiskPlacement : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DiffDiskPlacement(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CacheDiskValue = "CacheDisk"; + private const string ResourceDiskValue = "ResourceDisk"; + + /// Cache disk placement. + public static DiffDiskPlacement CacheDisk { get; } = new DiffDiskPlacement(CacheDiskValue); + /// Resource disk placement. + public static DiffDiskPlacement ResourceDisk { get; } = new DiffDiskPlacement(ResourceDiskValue); + /// Determines if two values are the same. + public static bool operator ==(DiffDiskPlacement left, DiffDiskPlacement right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DiffDiskPlacement left, DiffDiskPlacement right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DiffDiskPlacement(string value) => new DiffDiskPlacement(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DiffDiskPlacement other && Equals(other); + /// + public bool Equals(DiffDiskPlacement other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.Serialization.cs new file mode 100644 index 000000000000..0efe96d41a06 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.Serialization.cs @@ -0,0 +1,196 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class DiffDiskProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiffDiskProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Option)) + { + writer.WritePropertyName("option"u8); + writer.WriteStringValue(Option.Value.ToString()); + } + if (Optional.IsDefined(Placement)) + { + writer.WritePropertyName("placement"u8); + writer.WriteStringValue(Placement.Value.ToString()); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiffDiskProperties 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(DiffDiskProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiffDiskProperties(document.RootElement, options); + } + + internal static DiffDiskProperties DeserializeDiffDiskProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DiffDiskOption? option = default; + DiffDiskPlacement? placement = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("option"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + option = new DiffDiskOption(property.Value.GetString()); + continue; + } + if (property.NameEquals("placement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + placement = new DiffDiskPlacement(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiffDiskProperties(option, placement, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Option), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" option: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Option)) + { + builder.Append(" option: "); + builder.AppendLine($"'{Option.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Placement), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" placement: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Placement)) + { + builder.Append(" placement: "); + builder.AppendLine($"'{Placement.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DiffDiskProperties)} does not support writing '{options.Format}' format."); + } + } + + DiffDiskProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDiffDiskProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiffDiskProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.cs new file mode 100644 index 000000000000..0e3b3eb5dc89 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiffDiskProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + public partial class DiffDiskProperties + { + /// + /// 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 DiffDiskProperties() + { + } + + /// Initializes a new instance of . + /// Specifies the ephemeral disk settings for operating system disk. + /// Gets or sets specifies the ephemeral disk placement for operating system disk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible values include: 'CacheDisk', 'ResourceDisk'. + /// Keeps track of any properties unknown to the library. + internal DiffDiskProperties(DiffDiskOption? option, DiffDiskPlacement? placement, IDictionary serializedAdditionalRawData) + { + Option = option; + Placement = placement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Specifies the ephemeral disk settings for operating system disk. + [WirePath("option")] + public DiffDiskOption? Option { get; set; } + /// Gets or sets specifies the ephemeral disk placement for operating system disk. The defaulting behavior is: CacheDisk if one is configured for the VM size otherwise ResourceDisk is used. Refer to the VM size documentation for Windows VM at https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible values include: 'CacheDisk', 'ResourceDisk'. + [WirePath("placement")] + public DiffDiskPlacement? Placement { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DirectUDP.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DirectUDP.cs new file mode 100644 index 000000000000..85ae7021d9ad --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DirectUDP.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + public readonly partial struct DirectUDP : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DirectUDP(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Default. + public static DirectUDP Default { get; } = new DirectUDP(DefaultValue); + /// Enabled. + public static DirectUDP Enabled { get; } = new DirectUDP(EnabledValue); + /// Disabled. + public static DirectUDP Disabled { get; } = new DirectUDP(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(DirectUDP left, DirectUDP right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DirectUDP left, DirectUDP right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DirectUDP(string value) => new DirectUDP(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DirectUDP other && Equals(other); + /// + public bool Equals(DirectUDP other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.Serialization.cs new file mode 100644 index 000000000000..3300ea5e7fbf --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.Serialization.cs @@ -0,0 +1,199 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class DiskInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiskInfoProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ManagedDisk)) + { + writer.WritePropertyName("managedDisk"u8); + writer.WriteObjectValue(ManagedDisk, options); + } + if (Optional.IsDefined(DiffDiskSettings)) + { + writer.WritePropertyName("diffDiskSettings"u8); + writer.WriteObjectValue(DiffDiskSettings, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiskInfoProperties 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(DiskInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiskInfoProperties(document.RootElement, options); + } + + internal static DiskInfoProperties DeserializeDiskInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedDiskProperties managedDisk = default; + DiffDiskProperties diffDiskSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("managedDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedDisk = ManagedDiskProperties.DeserializeManagedDiskProperties(property.Value, options); + continue; + } + if (property.NameEquals("diffDiskSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diffDiskSettings = DiffDiskProperties.DeserializeDiffDiskProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiskInfoProperties(managedDisk, diffDiskSettings, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("VirtualMachineDiskType", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedDisk: "); + builder.AppendLine("{"); + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(ManagedDisk)) + { + builder.Append(" managedDisk: "); + BicepSerializationHelpers.AppendChildObject(builder, ManagedDisk, options, 2, false, " managedDisk: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiffDiskSettings), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diffDiskSettings: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DiffDiskSettings)) + { + builder.Append(" diffDiskSettings: "); + BicepSerializationHelpers.AppendChildObject(builder, DiffDiskSettings, options, 2, false, " diffDiskSettings: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DiskInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + DiskInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDiskInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiskInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.cs new file mode 100644 index 000000000000..700ef371c9eb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Disk information. + public partial class DiskInfoProperties + { + /// + /// 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 DiskInfoProperties() + { + } + + /// Initializes a new instance of . + /// The managed disk parameters. + /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + /// Keeps track of any properties unknown to the library. + internal DiskInfoProperties(ManagedDiskProperties managedDisk, DiffDiskProperties diffDiskSettings, IDictionary serializedAdditionalRawData) + { + ManagedDisk = managedDisk; + DiffDiskSettings = diffDiskSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed disk parameters. + internal ManagedDiskProperties ManagedDisk { get; set; } + /// The disk type used by virtual machine in hostpool session host. + [WirePath("managedDisk.type")] + public VirtualMachineDiskType? VirtualMachineDiskType + { + get => ManagedDisk is null ? default : ManagedDisk.VirtualMachineDiskType; + set + { + if (ManagedDisk is null) + ManagedDisk = new ManagedDiskProperties(); + ManagedDisk.VirtualMachineDiskType = value; + } + } + + /// Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. + [WirePath("diffDiskSettings")] + public DiffDiskProperties DiffDiskSettings { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..2dcf3332608a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.Serialization.cs @@ -0,0 +1,133 @@ +// 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.DesktopVirtualization.Models +{ + internal partial class DomainInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DomainInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ActiveDirectoryInfo)) + { + writer.WritePropertyName("activeDirectoryInfo"u8); + writer.WriteObjectValue(ActiveDirectoryInfo, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DomainInfoPatchProperties 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(DomainInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDomainInfoPatchProperties(document.RootElement, options); + } + + internal static DomainInfoPatchProperties DeserializeDomainInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ActiveDirectoryInfoPatchProperties activeDirectoryInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("activeDirectoryInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeDirectoryInfo = ActiveDirectoryInfoPatchProperties.DeserializeActiveDirectoryInfoPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DomainInfoPatchProperties(activeDirectoryInfo, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(DomainInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + DomainInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDomainInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DomainInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.cs new file mode 100644 index 000000000000..d7d6fe7b6f36 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Domain configurations of session hosts. + internal partial class DomainInfoPatchProperties + { + /// + /// 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 DomainInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// Active directory info. Only one should be populated based on the join type. + /// Keeps track of any properties unknown to the library. + internal DomainInfoPatchProperties(ActiveDirectoryInfoPatchProperties activeDirectoryInfo, IDictionary serializedAdditionalRawData) + { + ActiveDirectoryInfo = activeDirectoryInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Active directory info. Only one should be populated based on the join type. + internal ActiveDirectoryInfoPatchProperties ActiveDirectoryInfo { get; set; } + /// Credentials needed to create the virtual machine. + [WirePath("activeDirectoryInfo.domainCredentials")] + public KeyVaultCredentialsPatchProperties ActiveDirectoryInfoDomainCredentials + { + get => ActiveDirectoryInfo is null ? default : ActiveDirectoryInfo.DomainCredentials; + set + { + if (ActiveDirectoryInfo is null) + ActiveDirectoryInfo = new ActiveDirectoryInfoPatchProperties(); + ActiveDirectoryInfo.DomainCredentials = value; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.Serialization.cs new file mode 100644 index 000000000000..42cfa97b3f34 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.Serialization.cs @@ -0,0 +1,219 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class DomainInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DomainInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("joinType"u8); + writer.WriteStringValue(JoinType.ToString()); + if (Optional.IsDefined(ActiveDirectoryInfo)) + { + writer.WritePropertyName("activeDirectoryInfo"u8); + writer.WriteObjectValue(ActiveDirectoryInfo, options); + } + if (Optional.IsDefined(AzureActiveDirectoryInfo)) + { + writer.WritePropertyName("azureActiveDirectoryInfo"u8); + writer.WriteObjectValue(AzureActiveDirectoryInfo, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DomainInfoProperties 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(DomainInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDomainInfoProperties(document.RootElement, options); + } + + internal static DomainInfoProperties DeserializeDomainInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DomainJoinType joinType = default; + ActiveDirectoryInfoProperties activeDirectoryInfo = default; + AzureActiveDirectoryInfoProperties azureActiveDirectoryInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("joinType"u8)) + { + joinType = new DomainJoinType(property.Value.GetString()); + continue; + } + if (property.NameEquals("activeDirectoryInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeDirectoryInfo = ActiveDirectoryInfoProperties.DeserializeActiveDirectoryInfoProperties(property.Value, options); + continue; + } + if (property.NameEquals("azureActiveDirectoryInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureActiveDirectoryInfo = AzureActiveDirectoryInfoProperties.DeserializeAzureActiveDirectoryInfoProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DomainInfoProperties(joinType, activeDirectoryInfo, azureActiveDirectoryInfo, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(JoinType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" joinType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" joinType: "); + builder.AppendLine($"'{JoinType.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActiveDirectoryInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" activeDirectoryInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActiveDirectoryInfo)) + { + builder.Append(" activeDirectoryInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, ActiveDirectoryInfo, options, 2, false, " activeDirectoryInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AzureActiveDirectoryInfoMdmProviderGuid", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" azureActiveDirectoryInfo: "); + builder.AppendLine("{"); + builder.Append(" mdmProviderGuid: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(AzureActiveDirectoryInfo)) + { + builder.Append(" azureActiveDirectoryInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, AzureActiveDirectoryInfo, options, 2, false, " azureActiveDirectoryInfo: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DomainInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + DomainInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDomainInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DomainInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.cs new file mode 100644 index 000000000000..1f3d319e07ee --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Domain configurations of session hosts. + public partial class DomainInfoProperties + { + /// + /// 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 . + /// The type of domain join done by the virtual machine. + public DomainInfoProperties(DomainJoinType joinType) + { + JoinType = joinType; + } + + /// Initializes a new instance of . + /// The type of domain join done by the virtual machine. + /// Active directory info. Only one should be populated based on the join type. + /// Azure active directory info. Only one should be populated based on the join type. + /// Keeps track of any properties unknown to the library. + internal DomainInfoProperties(DomainJoinType joinType, ActiveDirectoryInfoProperties activeDirectoryInfo, AzureActiveDirectoryInfoProperties azureActiveDirectoryInfo, IDictionary serializedAdditionalRawData) + { + JoinType = joinType; + ActiveDirectoryInfo = activeDirectoryInfo; + AzureActiveDirectoryInfo = azureActiveDirectoryInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DomainInfoProperties() + { + } + + /// The type of domain join done by the virtual machine. + [WirePath("joinType")] + public DomainJoinType JoinType { get; set; } + /// Active directory info. Only one should be populated based on the join type. + [WirePath("activeDirectoryInfo")] + public ActiveDirectoryInfoProperties ActiveDirectoryInfo { get; set; } + /// Azure active directory info. Only one should be populated based on the join type. + internal AzureActiveDirectoryInfoProperties AzureActiveDirectoryInfo { get; set; } + /// The Mobile Device Management(MDM) guid. + [WirePath("azureActiveDirectoryInfo.mdmProviderGuid")] + public string AzureActiveDirectoryInfoMdmProviderGuid + { + get => AzureActiveDirectoryInfo is null ? default : AzureActiveDirectoryInfo.MdmProviderGuid; + set => AzureActiveDirectoryInfo = new AzureActiveDirectoryInfoProperties(value); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainJoinType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainJoinType.cs new file mode 100644 index 000000000000..3a2654ab8f99 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainJoinType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The type of domain join done by the virtual machine. + public readonly partial struct DomainJoinType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DomainJoinType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveDirectoryValue = "ActiveDirectory"; + private const string AzureActiveDirectoryValue = "AzureActiveDirectory"; + + /// Using microsoft active directory. + public static DomainJoinType ActiveDirectory { get; } = new DomainJoinType(ActiveDirectoryValue); + /// Using microsoft azure active directory. + public static DomainJoinType AzureActiveDirectory { get; } = new DomainJoinType(AzureActiveDirectoryValue); + /// Determines if two values are the same. + public static bool operator ==(DomainJoinType left, DomainJoinType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DomainJoinType left, DomainJoinType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DomainJoinType(string value) => new DomainJoinType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DomainJoinType other && Equals(other); + /// + public bool Equals(DomainJoinType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs index a98a0a7c4bd2..8d55903b49bf 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs @@ -69,7 +69,7 @@ public ExpandMsixImage() /// Specifies how to register Package in feed. /// Make this version of the package the active one across the hostpool. /// List of package dependencies. - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. /// Date Package was last updated, found in the appxmanifest.xml. /// List of package applications. /// Certificate name found in the appxmanifest.xml. @@ -125,7 +125,7 @@ internal ExpandMsixImage(ResourceIdentifier id, string name, ResourceType resour /// List of package dependencies. [WirePath("properties.packageDependencies")] public IList PackageDependencies { get; set; } - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. [WirePath("properties.version")] public string Version { get; set; } /// Date Package was last updated, found in the appxmanifest.xml. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailedSessionHostCleanupPolicySHC.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailedSessionHostCleanupPolicySHC.cs new file mode 100644 index 000000000000..c429e57ca82a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailedSessionHostCleanupPolicySHC.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The policy that should be applied when the Session Host provisioning operation fails. + public readonly partial struct FailedSessionHostCleanupPolicySHC : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FailedSessionHostCleanupPolicySHC(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeepAllValue = "KeepAll"; + private const string KeepOneValue = "KeepOne"; + private const string KeepNoneValue = "KeepNone"; + + /// KeepAll. + public static FailedSessionHostCleanupPolicySHC KeepAll { get; } = new FailedSessionHostCleanupPolicySHC(KeepAllValue); + /// KeepOne. + public static FailedSessionHostCleanupPolicySHC KeepOne { get; } = new FailedSessionHostCleanupPolicySHC(KeepOneValue); + /// KeepNone. + public static FailedSessionHostCleanupPolicySHC KeepNone { get; } = new FailedSessionHostCleanupPolicySHC(KeepNoneValue); + /// Determines if two values are the same. + public static bool operator ==(FailedSessionHostCleanupPolicySHC left, FailedSessionHostCleanupPolicySHC right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FailedSessionHostCleanupPolicySHC left, FailedSessionHostCleanupPolicySHC right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FailedSessionHostCleanupPolicySHC(string value) => new FailedSessionHostCleanupPolicySHC(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FailedSessionHostCleanupPolicySHC other && Equals(other); + /// + public bool Equals(FailedSessionHostCleanupPolicySHC other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs index a8d49eeaf110..aadc129c8ecf 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs @@ -25,6 +25,7 @@ public HostPoolLoadBalancerType(string value) private const string BreadthFirstValue = "BreadthFirst"; private const string DepthFirstValue = "DepthFirst"; private const string PersistentValue = "Persistent"; + private const string MultiplePersistentValue = "MultiplePersistent"; /// BreadthFirst. public static HostPoolLoadBalancerType BreadthFirst { get; } = new HostPoolLoadBalancerType(BreadthFirstValue); @@ -32,6 +33,8 @@ public HostPoolLoadBalancerType(string value) public static HostPoolLoadBalancerType DepthFirst { get; } = new HostPoolLoadBalancerType(DepthFirstValue); /// Persistent. public static HostPoolLoadBalancerType Persistent { get; } = new HostPoolLoadBalancerType(PersistentValue); + /// MultiplePersistent. + public static HostPoolLoadBalancerType MultiplePersistent { get; } = new HostPoolLoadBalancerType(MultiplePersistentValue); /// Determines if two values are the same. public static bool operator ==(HostPoolLoadBalancerType left, HostPoolLoadBalancerType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.Serialization.cs index bb1aaaee6d8d..490bb110bc81 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.Serialization.cs @@ -201,15 +201,28 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsDefined(AgentUpdate)) { - if (AgentUpdate != null) - { - writer.WritePropertyName("agentUpdate"u8); - writer.WriteObjectValue(AgentUpdate, options); - } - else - { - writer.WriteNull("agentUpdate"); - } + writer.WritePropertyName("agentUpdate"u8); + writer.WriteObjectValue(AgentUpdate, options); + } + if (Optional.IsDefined(ManagedPrivateUDP)) + { + writer.WritePropertyName("managedPrivateUDP"u8); + writer.WriteStringValue(ManagedPrivateUDP.Value.ToString()); + } + if (Optional.IsDefined(DirectUDP)) + { + writer.WritePropertyName("directUDP"u8); + writer.WriteStringValue(DirectUDP.Value.ToString()); + } + if (Optional.IsDefined(PublicUDP)) + { + writer.WritePropertyName("publicUDP"u8); + writer.WriteStringValue(PublicUDP.Value.ToString()); + } + if (Optional.IsDefined(RelayUDP)) + { + writer.WritePropertyName("relayUDP"u8); + writer.WriteStringValue(RelayUDP.Value.ToString()); } writer.WriteEndObject(); } @@ -257,6 +270,10 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode bool? startVmOnConnect = default; HostPoolPublicNetworkAccess? publicNetworkAccess = default; SessionHostAgentUpdatePatchProperties agentUpdate = default; + ManagedPrivateUDP? managedPrivateUDP = default; + DirectUDP? directUDP = default; + PublicUDP? publicUDP = default; + RelayUDP? relayUDP = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -446,12 +463,47 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode { if (property0.Value.ValueKind == JsonValueKind.Null) { - agentUpdate = null; continue; } agentUpdate = SessionHostAgentUpdatePatchProperties.DeserializeSessionHostAgentUpdatePatchProperties(property0.Value, options); continue; } + if (property0.NameEquals("managedPrivateUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedPrivateUDP = new ManagedPrivateUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("directUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + directUDP = new DirectUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("publicUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicUDP = new PublicUDP(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("relayUDP"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relayUDP = new RelayUDP(property0.Value.GetString()); + continue; + } } continue; } @@ -485,6 +537,10 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode startVmOnConnect, publicNetworkAccess, agentUpdate, + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, serializedAdditionalRawData); } @@ -919,6 +975,66 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedPrivateUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedPrivateUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagedPrivateUDP)) + { + builder.Append(" managedPrivateUDP: "); + builder.AppendLine($"'{ManagedPrivateUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DirectUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" directUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DirectUDP)) + { + builder.Append(" directUDP: "); + builder.AppendLine($"'{DirectUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publicUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PublicUDP)) + { + builder.Append(" publicUDP: "); + builder.AppendLine($"'{PublicUDP.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RelayUDP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" relayUDP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RelayUDP)) + { + builder.Append(" relayUDP: "); + builder.AppendLine($"'{RelayUDP.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs index 06ea79401754..4a29c789cf74 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs @@ -67,7 +67,7 @@ public HostPoolPatch() /// The type of the load balancer. /// The ring number of HostPool. /// Is validation environment. - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. /// VM template for sessionhosts configuration within hostpool. /// URL to customer ADFS server for signing WVD SSO certificates. /// ClientId for the registered Relying Party used to issue WVD SSO certificates. @@ -77,8 +77,12 @@ public HostPoolPatch() /// The flag to turn on/off StartVMOnConnect feature. /// Enabled to allow this resource to be access from the public network. /// The session host configuration for updating agent, monitoring agent, and stack component. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. /// Keeps track of any properties unknown to the library. - internal HostPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string friendlyName, string description, string customRdpProperty, int? maxSessionLimit, PersonalDesktopAssignmentType? personalDesktopAssignmentType, HostPoolLoadBalancerType? loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfoPatch registrationInfo, string vmTemplate, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType? preferredAppGroupType, bool? startVmOnConnect, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdatePatchProperties agentUpdate, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal HostPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string friendlyName, string description, string customRdpProperty, int? maxSessionLimit, PersonalDesktopAssignmentType? personalDesktopAssignmentType, HostPoolLoadBalancerType? loadBalancerType, int? ring, bool? isValidationEnvironment, HostPoolRegistrationInfoPatch registrationInfo, string vmTemplate, string ssoAdfsAuthority, string ssoClientId, string ssoClientSecretKeyVaultPath, HostPoolSsoSecretType? ssoSecretType, PreferredAppGroupType? preferredAppGroupType, bool? startVmOnConnect, HostPoolPublicNetworkAccess? publicNetworkAccess, SessionHostAgentUpdatePatchProperties agentUpdate, ManagedPrivateUDP? managedPrivateUDP, DirectUDP? directUDP, PublicUDP? publicUDP, RelayUDP? relayUDP, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Tags = tags; FriendlyName = friendlyName; @@ -99,6 +103,10 @@ internal HostPoolPatch(ResourceIdentifier id, string name, ResourceType resource StartVmOnConnect = startVmOnConnect; PublicNetworkAccess = publicNetworkAccess; AgentUpdate = agentUpdate; + ManagedPrivateUDP = managedPrivateUDP; + DirectUDP = directUDP; + PublicUDP = publicUDP; + RelayUDP = relayUDP; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -129,7 +137,7 @@ internal HostPoolPatch(ResourceIdentifier id, string name, ResourceType resource /// Is validation environment. [WirePath("properties.validationEnvironment")] public bool? IsValidationEnvironment { get; set; } - /// The registration info of HostPool. + /// The registration info of HostPool. This is not returned on GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. [WirePath("properties.registrationInfo")] public HostPoolRegistrationInfoPatch RegistrationInfo { get; set; } /// VM template for sessionhosts configuration within hostpool. @@ -159,5 +167,17 @@ internal HostPoolPatch(ResourceIdentifier id, string name, ResourceType resource /// The session host configuration for updating agent, monitoring agent, and stack component. [WirePath("properties.agentUpdate")] public SessionHostAgentUpdatePatchProperties AgentUpdate { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.managedPrivateUDP")] + public ManagedPrivateUDP? ManagedPrivateUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.directUDP")] + public DirectUDP? DirectUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.publicUDP")] + public PublicUDP? PublicUDP { get; set; } + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + [WirePath("properties.relayUDP")] + public RelayUDP? RelayUDP { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningAction.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningAction.cs new file mode 100644 index 000000000000..8a6715e5b84e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningAction.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Action types for controlling hostpool provisioning. + public readonly partial struct HostPoolProvisioningAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostPoolProvisioningAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CancelValue = "Cancel"; + + /// Cancel the hostpool provisioning. + public static HostPoolProvisioningAction Cancel { get; } = new HostPoolProvisioningAction(CancelValue); + /// Determines if two values are the same. + public static bool operator ==(HostPoolProvisioningAction left, HostPoolProvisioningAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostPoolProvisioningAction left, HostPoolProvisioningAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostPoolProvisioningAction(string value) => new HostPoolProvisioningAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostPoolProvisioningAction other && Equals(other); + /// + public bool Equals(HostPoolProvisioningAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.Serialization.cs new file mode 100644 index 000000000000..ca13abbf8212 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.Serialization.cs @@ -0,0 +1,137 @@ +// 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.DesktopVirtualization.Models +{ + public partial class HostPoolProvisioningControlParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HostPoolProvisioningControlParameter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.ToString()); + if (Optional.IsDefined(CancelMessage)) + { + writer.WritePropertyName("cancelMessage"u8); + writer.WriteStringValue(CancelMessage); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HostPoolProvisioningControlParameter 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(HostPoolProvisioningControlParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostPoolProvisioningControlParameter(document.RootElement, options); + } + + internal static HostPoolProvisioningControlParameter DeserializeHostPoolProvisioningControlParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostPoolProvisioningAction action = default; + string cancelMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("action"u8)) + { + action = new HostPoolProvisioningAction(property.Value.GetString()); + continue; + } + if (property.NameEquals("cancelMessage"u8)) + { + cancelMessage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostPoolProvisioningControlParameter(action, cancelMessage, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(HostPoolProvisioningControlParameter)} does not support writing '{options.Format}' format."); + } + } + + HostPoolProvisioningControlParameter 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeHostPoolProvisioningControlParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostPoolProvisioningControlParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.cs new file mode 100644 index 000000000000..ef9a4ea9008d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolProvisioningControlParameter.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Represents properties for a hostpool provisioning control request. + public partial class HostPoolProvisioningControlParameter + { + /// + /// 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 . + /// Action types for controlling hostpool provisioning. + public HostPoolProvisioningControlParameter(HostPoolProvisioningAction action) + { + Action = action; + } + + /// Initializes a new instance of . + /// Action types for controlling hostpool provisioning. + /// The cancel message sent to the user on the session host. + /// Keeps track of any properties unknown to the library. + internal HostPoolProvisioningControlParameter(HostPoolProvisioningAction action, string cancelMessage, IDictionary serializedAdditionalRawData) + { + Action = action; + CancelMessage = cancelMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostPoolProvisioningControlParameter() + { + } + + /// Action types for controlling hostpool provisioning. + [WirePath("action")] + public HostPoolProvisioningAction Action { get; } + /// The cancel message sent to the user on the session host. + [WirePath("cancelMessage")] + public string CancelMessage { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.cs index a8e0b92a25e6..3813827ef833 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Represents a RegistrationInfo definition. + /// Represents a RegistrationInfo definition. This is not returned on HostPool GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. public partial class HostPoolRegistrationInfo { /// diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.cs index fb710aee8187..7cca966fda6f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Represents a RegistrationInfo definition. + /// Represents a RegistrationInfo definition. This is not returned on HostPool GET. In order to get the registration token use the retrieveRegistrationToken or listRegistrationTokens POST calls. public partial class HostPoolRegistrationInfoPatch { /// diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateAction.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateAction.cs new file mode 100644 index 000000000000..921aaf071c64 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateAction.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Action types for controlling hostpool update. + public readonly partial struct HostPoolUpdateAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HostPoolUpdateAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StartValue = "Start"; + private const string PauseValue = "Pause"; + private const string CancelValue = "Cancel"; + private const string RetryValue = "Retry"; + private const string ResumeValue = "Resume"; + + /// Start the hostpool update. + public static HostPoolUpdateAction Start { get; } = new HostPoolUpdateAction(StartValue); + /// Pause the hostpool update. + public static HostPoolUpdateAction Pause { get; } = new HostPoolUpdateAction(PauseValue); + /// Cancel the hostpool update. + public static HostPoolUpdateAction Cancel { get; } = new HostPoolUpdateAction(CancelValue); + /// Retry the hostpool update. + public static HostPoolUpdateAction Retry { get; } = new HostPoolUpdateAction(RetryValue); + /// Resume the hostpool update. + public static HostPoolUpdateAction Resume { get; } = new HostPoolUpdateAction(ResumeValue); + /// Determines if two values are the same. + public static bool operator ==(HostPoolUpdateAction left, HostPoolUpdateAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HostPoolUpdateAction left, HostPoolUpdateAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HostPoolUpdateAction(string value) => new HostPoolUpdateAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HostPoolUpdateAction other && Equals(other); + /// + public bool Equals(HostPoolUpdateAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.Serialization.cs new file mode 100644 index 000000000000..76d119d7b16b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.Serialization.cs @@ -0,0 +1,174 @@ +// 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.DesktopVirtualization.Models +{ + public partial class HostPoolUpdateConfigurationPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DeleteOriginalVm)) + { + writer.WritePropertyName("deleteOriginalVm"u8); + writer.WriteBooleanValue(DeleteOriginalVm.Value); + } + if (Optional.IsDefined(MaxVmsRemoved)) + { + writer.WritePropertyName("maxVmsRemoved"u8); + writer.WriteNumberValue(MaxVmsRemoved.Value); + } + if (Optional.IsDefined(LogOffDelayMinutes)) + { + writer.WritePropertyName("logOffDelayMinutes"u8); + writer.WriteNumberValue(LogOffDelayMinutes.Value); + } + if (Optional.IsDefined(LogOffMessage)) + { + writer.WritePropertyName("logOffMessage"u8); + writer.WriteStringValue(LogOffMessage); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HostPoolUpdateConfigurationPatchProperties 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(HostPoolUpdateConfigurationPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostPoolUpdateConfigurationPatchProperties(document.RootElement, options); + } + + internal static HostPoolUpdateConfigurationPatchProperties DeserializeHostPoolUpdateConfigurationPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? deleteOriginalVm = default; + int? maxVmsRemoved = default; + int? logOffDelayMinutes = default; + string logOffMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOriginalVm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOriginalVm = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("maxVmsRemoved"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxVmsRemoved = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("logOffDelayMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logOffDelayMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("logOffMessage"u8)) + { + logOffMessage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostPoolUpdateConfigurationPatchProperties(deleteOriginalVm, maxVmsRemoved, logOffDelayMinutes, logOffMessage, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + HostPoolUpdateConfigurationPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeHostPoolUpdateConfigurationPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.cs new file mode 100644 index 000000000000..e4ff4f7277cb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationPatchProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The configurations of a hostpool update. + public partial class HostPoolUpdateConfigurationPatchProperties + { + /// + /// 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 HostPoolUpdateConfigurationPatchProperties() + { + } + + /// Initializes a new instance of . + /// Whether not to save original disk. False by default. + /// The maximum number of virtual machines to be removed during hostpool update. + /// Grace period before logging off users in minutes. + /// Log off message sent to user for logoff. + /// Keeps track of any properties unknown to the library. + internal HostPoolUpdateConfigurationPatchProperties(bool? deleteOriginalVm, int? maxVmsRemoved, int? logOffDelayMinutes, string logOffMessage, IDictionary serializedAdditionalRawData) + { + DeleteOriginalVm = deleteOriginalVm; + MaxVmsRemoved = maxVmsRemoved; + LogOffDelayMinutes = logOffDelayMinutes; + LogOffMessage = logOffMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether not to save original disk. False by default. + [WirePath("deleteOriginalVm")] + public bool? DeleteOriginalVm { get; set; } + /// The maximum number of virtual machines to be removed during hostpool update. + [WirePath("maxVmsRemoved")] + public int? MaxVmsRemoved { get; set; } + /// Grace period before logging off users in minutes. + [WirePath("logOffDelayMinutes")] + public int? LogOffDelayMinutes { get; set; } + /// Log off message sent to user for logoff. + [WirePath("logOffMessage")] + public string LogOffMessage { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.Serialization.cs new file mode 100644 index 000000000000..e127b02d29a8 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.Serialization.cs @@ -0,0 +1,241 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class HostPoolUpdateConfigurationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DeleteOriginalVm)) + { + writer.WritePropertyName("deleteOriginalVm"u8); + writer.WriteBooleanValue(DeleteOriginalVm.Value); + } + writer.WritePropertyName("maxVmsRemoved"u8); + writer.WriteNumberValue(MaxVmsRemoved); + writer.WritePropertyName("logOffDelayMinutes"u8); + writer.WriteNumberValue(LogOffDelayMinutes); + if (Optional.IsDefined(LogOffMessage)) + { + writer.WritePropertyName("logOffMessage"u8); + writer.WriteStringValue(LogOffMessage); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HostPoolUpdateConfigurationProperties 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(HostPoolUpdateConfigurationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostPoolUpdateConfigurationProperties(document.RootElement, options); + } + + internal static HostPoolUpdateConfigurationProperties DeserializeHostPoolUpdateConfigurationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? deleteOriginalVm = default; + int maxVmsRemoved = default; + int logOffDelayMinutes = default; + string logOffMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOriginalVm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOriginalVm = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("maxVmsRemoved"u8)) + { + maxVmsRemoved = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("logOffDelayMinutes"u8)) + { + logOffDelayMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("logOffMessage"u8)) + { + logOffMessage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostPoolUpdateConfigurationProperties(deleteOriginalVm, maxVmsRemoved, logOffDelayMinutes, logOffMessage, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeleteOriginalVm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deleteOriginalVm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeleteOriginalVm)) + { + builder.Append(" deleteOriginalVm: "); + var boolValue = DeleteOriginalVm.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxVmsRemoved), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxVmsRemoved: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" maxVmsRemoved: "); + builder.AppendLine($"{MaxVmsRemoved}"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LogOffDelayMinutes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" logOffDelayMinutes: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" logOffDelayMinutes: "); + builder.AppendLine($"{LogOffDelayMinutes}"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LogOffMessage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" logOffMessage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LogOffMessage)) + { + builder.Append(" logOffMessage: "); + if (LogOffMessage.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LogOffMessage}'''"); + } + else + { + builder.AppendLine($"'{LogOffMessage}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationProperties)} does not support writing '{options.Format}' format."); + } + } + + HostPoolUpdateConfigurationProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeHostPoolUpdateConfigurationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostPoolUpdateConfigurationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.cs new file mode 100644 index 000000000000..8dcab828eefd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateConfigurationProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The configurations of a hostpool update. + public partial class HostPoolUpdateConfigurationProperties + { + /// + /// 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 . + /// The maximum number of virtual machines to be removed during hostpool update. + /// Grace period before logging off users in minutes. + public HostPoolUpdateConfigurationProperties(int maxVmsRemoved, int logOffDelayMinutes) + { + MaxVmsRemoved = maxVmsRemoved; + LogOffDelayMinutes = logOffDelayMinutes; + } + + /// Initializes a new instance of . + /// Whether not to save original disk. False by default. + /// The maximum number of virtual machines to be removed during hostpool update. + /// Grace period before logging off users in minutes. + /// Log off message sent to user for logoff. Default value is an empty string. + /// Keeps track of any properties unknown to the library. + internal HostPoolUpdateConfigurationProperties(bool? deleteOriginalVm, int maxVmsRemoved, int logOffDelayMinutes, string logOffMessage, IDictionary serializedAdditionalRawData) + { + DeleteOriginalVm = deleteOriginalVm; + MaxVmsRemoved = maxVmsRemoved; + LogOffDelayMinutes = logOffDelayMinutes; + LogOffMessage = logOffMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostPoolUpdateConfigurationProperties() + { + } + + /// Whether not to save original disk. False by default. + [WirePath("deleteOriginalVm")] + public bool? DeleteOriginalVm { get; set; } + /// The maximum number of virtual machines to be removed during hostpool update. + [WirePath("maxVmsRemoved")] + public int MaxVmsRemoved { get; set; } + /// Grace period before logging off users in minutes. + [WirePath("logOffDelayMinutes")] + public int LogOffDelayMinutes { get; set; } + /// Log off message sent to user for logoff. Default value is an empty string. + [WirePath("logOffMessage")] + public string LogOffMessage { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.Serialization.cs new file mode 100644 index 000000000000..5121561a19f2 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.Serialization.cs @@ -0,0 +1,137 @@ +// 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.DesktopVirtualization.Models +{ + public partial class HostPoolUpdateControlParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HostPoolUpdateControlParameter)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.ToString()); + if (Optional.IsDefined(CancelMessage)) + { + writer.WritePropertyName("cancelMessage"u8); + writer.WriteStringValue(CancelMessage); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HostPoolUpdateControlParameter 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(HostPoolUpdateControlParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostPoolUpdateControlParameter(document.RootElement, options); + } + + internal static HostPoolUpdateControlParameter DeserializeHostPoolUpdateControlParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostPoolUpdateAction action = default; + string cancelMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("action"u8)) + { + action = new HostPoolUpdateAction(property.Value.GetString()); + continue; + } + if (property.NameEquals("cancelMessage"u8)) + { + cancelMessage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostPoolUpdateControlParameter(action, cancelMessage, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(HostPoolUpdateControlParameter)} does not support writing '{options.Format}' format."); + } + } + + HostPoolUpdateControlParameter 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeHostPoolUpdateControlParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostPoolUpdateControlParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.cs new file mode 100644 index 000000000000..8a685f2dbb32 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolUpdateControlParameter.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Represents properties for a hostpool update control request. + public partial class HostPoolUpdateControlParameter + { + /// + /// 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 . + /// Action types for controlling hostpool update. + public HostPoolUpdateControlParameter(HostPoolUpdateAction action) + { + Action = action; + } + + /// Initializes a new instance of . + /// Action types for controlling hostpool update. + /// The cancel message sent to the user on the session host. This is can only be specified if the action is 'Cancel'. + /// Keeps track of any properties unknown to the library. + internal HostPoolUpdateControlParameter(HostPoolUpdateAction action, string cancelMessage, IDictionary serializedAdditionalRawData) + { + Action = action; + CancelMessage = cancelMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HostPoolUpdateControlParameter() + { + } + + /// Action types for controlling hostpool update. + [WirePath("action")] + public HostPoolUpdateAction Action { get; } + /// The cancel message sent to the user on the session host. This is can only be specified if the action is 'Cancel'. + [WirePath("cancelMessage")] + public string CancelMessage { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..2439a65e832d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.Serialization.cs @@ -0,0 +1,163 @@ +// 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.DesktopVirtualization.Models +{ + public partial class ImageInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImageInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ImageType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ImageType.Value.ToString()); + } + if (Optional.IsDefined(MarketplaceInfo)) + { + writer.WritePropertyName("marketplaceInfo"u8); + writer.WriteObjectValue(MarketplaceInfo, options); + } + if (Optional.IsDefined(CustomInfo)) + { + writer.WritePropertyName("customInfo"u8); + writer.WriteObjectValue(CustomInfo, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImageInfoPatchProperties 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(ImageInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImageInfoPatchProperties(document.RootElement, options); + } + + internal static ImageInfoPatchProperties DeserializeImageInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Type? type = default; + MarketplaceInfoPatchProperties marketplaceInfo = default; + CustomInfoPatchProperties customInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("marketplaceInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + marketplaceInfo = MarketplaceInfoPatchProperties.DeserializeMarketplaceInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("customInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customInfo = CustomInfoPatchProperties.DeserializeCustomInfoPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImageInfoPatchProperties(type, marketplaceInfo, customInfo, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(ImageInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ImageInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeImageInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImageInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.cs new file mode 100644 index 000000000000..59718dfc366c --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoPatchProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Image configurations of session host in a HostPool. + public partial class ImageInfoPatchProperties + { + /// + /// 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 ImageInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// The type of image session hosts use in the hostpool. + /// The values to uniquely identify a marketplace image. Only one should be populated based on the image type. + /// The values to uniquely identify a custom image. Only one should be populated based on the image type. + /// Keeps track of any properties unknown to the library. + internal ImageInfoPatchProperties(Type? imageType, MarketplaceInfoPatchProperties marketplaceInfo, CustomInfoPatchProperties customInfo, IDictionary serializedAdditionalRawData) + { + ImageType = imageType; + MarketplaceInfo = marketplaceInfo; + CustomInfo = customInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of image session hosts use in the hostpool. + [WirePath("type")] + public Type? ImageType { get; set; } + /// The values to uniquely identify a marketplace image. Only one should be populated based on the image type. + [WirePath("marketplaceInfo")] + public MarketplaceInfoPatchProperties MarketplaceInfo { get; set; } + /// The values to uniquely identify a custom image. Only one should be populated based on the image type. + internal CustomInfoPatchProperties CustomInfo { get; set; } + /// The resource id of the custom image. + [WirePath("customInfo.resourceId")] + public ResourceIdentifier CustomInfoResourceId + { + get => CustomInfo is null ? default : CustomInfo.ResourceId; + set + { + if (CustomInfo is null) + CustomInfo = new CustomInfoPatchProperties(); + CustomInfo.ResourceId = value; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.Serialization.cs new file mode 100644 index 000000000000..210a27b43537 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.Serialization.cs @@ -0,0 +1,219 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class ImageInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImageInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ImageType.ToString()); + if (Optional.IsDefined(MarketplaceInfo)) + { + writer.WritePropertyName("marketplaceInfo"u8); + writer.WriteObjectValue(MarketplaceInfo, options); + } + if (Optional.IsDefined(CustomInfo)) + { + writer.WritePropertyName("customInfo"u8); + writer.WriteObjectValue(CustomInfo, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImageInfoProperties 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(ImageInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImageInfoProperties(document.RootElement, options); + } + + internal static ImageInfoProperties DeserializeImageInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Type type = default; + MarketplaceInfoProperties marketplaceInfo = default; + CustomInfoProperties customInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new Type(property.Value.GetString()); + continue; + } + if (property.NameEquals("marketplaceInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + marketplaceInfo = MarketplaceInfoProperties.DeserializeMarketplaceInfoProperties(property.Value, options); + continue; + } + if (property.NameEquals("customInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customInfo = CustomInfoProperties.DeserializeCustomInfoProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImageInfoProperties(type, marketplaceInfo, customInfo, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" type: "); + builder.AppendLine($"'{ImageType.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MarketplaceInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" marketplaceInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MarketplaceInfo)) + { + builder.Append(" marketplaceInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, MarketplaceInfo, options, 2, false, " marketplaceInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CustomInfoResourceId", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customInfo: "); + builder.AppendLine("{"); + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(CustomInfo)) + { + builder.Append(" customInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, CustomInfo, options, 2, false, " customInfo: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ImageInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + ImageInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeImageInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImageInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.cs new file mode 100644 index 000000000000..f8bdfc9bc206 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImageInfoProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Image configurations of session host in a HostPool. + public partial class ImageInfoProperties + { + /// + /// 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 . + /// The type of image session hosts use in the hostpool. + public ImageInfoProperties(Type imageType) + { + ImageType = imageType; + } + + /// Initializes a new instance of . + /// The type of image session hosts use in the hostpool. + /// The values to uniquely identify a marketplace image. Only one should be populated based on the image type. + /// The values to uniquely identify a custom image. Only one should be populated based on the image type. + /// Keeps track of any properties unknown to the library. + internal ImageInfoProperties(Type imageType, MarketplaceInfoProperties marketplaceInfo, CustomInfoProperties customInfo, IDictionary serializedAdditionalRawData) + { + ImageType = imageType; + MarketplaceInfo = marketplaceInfo; + CustomInfo = customInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImageInfoProperties() + { + } + + /// The type of image session hosts use in the hostpool. + [WirePath("type")] + public Type ImageType { get; set; } + /// The values to uniquely identify a marketplace image. Only one should be populated based on the image type. + [WirePath("marketplaceInfo")] + public MarketplaceInfoProperties MarketplaceInfo { get; set; } + /// The values to uniquely identify a custom image. Only one should be populated based on the image type. + internal CustomInfoProperties CustomInfo { get; set; } + /// The resource id of the custom image. + [WirePath("customInfo.resourceId")] + public ResourceIdentifier CustomInfoResourceId + { + get => CustomInfo is null ? default : CustomInfo.ResourceId; + set => CustomInfo = new CustomInfoProperties(value); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.Serialization.cs new file mode 100644 index 000000000000..f0cb8d9ae2c7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.Serialization.cs @@ -0,0 +1,148 @@ +// 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.DesktopVirtualization.Models +{ + public partial class KeyVaultCredentialsPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultCredentialsPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(UsernameKeyVaultSecretUri)) + { + writer.WritePropertyName("usernameKeyVaultSecretUri"u8); + writer.WriteStringValue(UsernameKeyVaultSecretUri.AbsoluteUri); + } + if (Optional.IsDefined(PasswordKeyVaultSecretUri)) + { + writer.WritePropertyName("passwordKeyVaultSecretUri"u8); + writer.WriteStringValue(PasswordKeyVaultSecretUri.AbsoluteUri); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyVaultCredentialsPatchProperties 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(KeyVaultCredentialsPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultCredentialsPatchProperties(document.RootElement, options); + } + + internal static KeyVaultCredentialsPatchProperties DeserializeKeyVaultCredentialsPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri usernameKeyVaultSecretUri = default; + Uri passwordKeyVaultSecretUri = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usernameKeyVaultSecretUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usernameKeyVaultSecretUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("passwordKeyVaultSecretUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + passwordKeyVaultSecretUri = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyVaultCredentialsPatchProperties(usernameKeyVaultSecretUri, passwordKeyVaultSecretUri, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(KeyVaultCredentialsPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultCredentialsPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeKeyVaultCredentialsPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultCredentialsPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.cs new file mode 100644 index 000000000000..080e123f02dd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsPatchProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Credentials kept in the keyvault. + public partial class KeyVaultCredentialsPatchProperties + { + /// + /// 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 KeyVaultCredentialsPatchProperties() + { + } + + /// Initializes a new instance of . + /// The uri to access the secret that the username is stored in. + /// The uri to access the secret that the password is stored in. + /// Keeps track of any properties unknown to the library. + internal KeyVaultCredentialsPatchProperties(Uri usernameKeyVaultSecretUri, Uri passwordKeyVaultSecretUri, IDictionary serializedAdditionalRawData) + { + UsernameKeyVaultSecretUri = usernameKeyVaultSecretUri; + PasswordKeyVaultSecretUri = passwordKeyVaultSecretUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The uri to access the secret that the username is stored in. + [WirePath("usernameKeyVaultSecretUri")] + public Uri UsernameKeyVaultSecretUri { get; set; } + /// The uri to access the secret that the password is stored in. + [WirePath("passwordKeyVaultSecretUri")] + public Uri PasswordKeyVaultSecretUri { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.Serialization.cs new file mode 100644 index 000000000000..ef28324e1ef1 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.Serialization.cs @@ -0,0 +1,182 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class KeyVaultCredentialsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultCredentialsProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("usernameKeyVaultSecretUri"u8); + writer.WriteStringValue(UsernameKeyVaultSecretUri.AbsoluteUri); + writer.WritePropertyName("passwordKeyVaultSecretUri"u8); + writer.WriteStringValue(PasswordKeyVaultSecretUri.AbsoluteUri); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyVaultCredentialsProperties 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(KeyVaultCredentialsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultCredentialsProperties(document.RootElement, options); + } + + internal static KeyVaultCredentialsProperties DeserializeKeyVaultCredentialsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri usernameKeyVaultSecretUri = default; + Uri passwordKeyVaultSecretUri = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usernameKeyVaultSecretUri"u8)) + { + usernameKeyVaultSecretUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("passwordKeyVaultSecretUri"u8)) + { + passwordKeyVaultSecretUri = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyVaultCredentialsProperties(usernameKeyVaultSecretUri, passwordKeyVaultSecretUri, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UsernameKeyVaultSecretUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" usernameKeyVaultSecretUri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UsernameKeyVaultSecretUri)) + { + builder.Append(" usernameKeyVaultSecretUri: "); + builder.AppendLine($"'{UsernameKeyVaultSecretUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PasswordKeyVaultSecretUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" passwordKeyVaultSecretUri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PasswordKeyVaultSecretUri)) + { + builder.Append(" passwordKeyVaultSecretUri: "); + builder.AppendLine($"'{PasswordKeyVaultSecretUri.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(KeyVaultCredentialsProperties)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultCredentialsProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeKeyVaultCredentialsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultCredentialsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.cs new file mode 100644 index 000000000000..5d3948bfd0d9 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/KeyVaultCredentialsProperties.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Credentials kept in the keyvault. + public partial class KeyVaultCredentialsProperties + { + /// + /// 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 . + /// The uri to access the secret that the username is stored in. + /// The uri to access the secret that the password is stored in. + /// or is null. + public KeyVaultCredentialsProperties(Uri usernameKeyVaultSecretUri, Uri passwordKeyVaultSecretUri) + { + Argument.AssertNotNull(usernameKeyVaultSecretUri, nameof(usernameKeyVaultSecretUri)); + Argument.AssertNotNull(passwordKeyVaultSecretUri, nameof(passwordKeyVaultSecretUri)); + + UsernameKeyVaultSecretUri = usernameKeyVaultSecretUri; + PasswordKeyVaultSecretUri = passwordKeyVaultSecretUri; + } + + /// Initializes a new instance of . + /// The uri to access the secret that the username is stored in. + /// The uri to access the secret that the password is stored in. + /// Keeps track of any properties unknown to the library. + internal KeyVaultCredentialsProperties(Uri usernameKeyVaultSecretUri, Uri passwordKeyVaultSecretUri, IDictionary serializedAdditionalRawData) + { + UsernameKeyVaultSecretUri = usernameKeyVaultSecretUri; + PasswordKeyVaultSecretUri = passwordKeyVaultSecretUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultCredentialsProperties() + { + } + + /// The uri to access the secret that the username is stored in. + [WirePath("usernameKeyVaultSecretUri")] + public Uri UsernameKeyVaultSecretUri { get; set; } + /// The uri to access the secret that the password is stored in. + [WirePath("passwordKeyVaultSecretUri")] + public Uri PasswordKeyVaultSecretUri { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.Serialization.cs new file mode 100644 index 000000000000..96ba710e63d7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.Serialization.cs @@ -0,0 +1,166 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class ManagedDiskProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedDiskProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(VirtualMachineDiskType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(VirtualMachineDiskType.Value.ToString()); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedDiskProperties 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(ManagedDiskProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedDiskProperties(document.RootElement, options); + } + + internal static ManagedDiskProperties DeserializeManagedDiskProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualMachineDiskType? type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new VirtualMachineDiskType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedDiskProperties(type, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualMachineDiskType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VirtualMachineDiskType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{VirtualMachineDiskType.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ManagedDiskProperties)} does not support writing '{options.Format}' format."); + } + } + + ManagedDiskProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeManagedDiskProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedDiskProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.cs new file mode 100644 index 000000000000..fc1e9c1815d0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedDiskProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Managed Disk information. + internal partial class ManagedDiskProperties + { + /// + /// 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 ManagedDiskProperties() + { + } + + /// Initializes a new instance of . + /// The disk type used by virtual machine in hostpool session host. + /// Keeps track of any properties unknown to the library. + internal ManagedDiskProperties(VirtualMachineDiskType? virtualMachineDiskType, IDictionary serializedAdditionalRawData) + { + VirtualMachineDiskType = virtualMachineDiskType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The disk type used by virtual machine in hostpool session host. + [WirePath("type")] + public VirtualMachineDiskType? VirtualMachineDiskType { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedPrivateUDP.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedPrivateUDP.cs new file mode 100644 index 000000000000..0393cae391b0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedPrivateUDP.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + public readonly partial struct ManagedPrivateUDP : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedPrivateUDP(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Default. + public static ManagedPrivateUDP Default { get; } = new ManagedPrivateUDP(DefaultValue); + /// Enabled. + public static ManagedPrivateUDP Enabled { get; } = new ManagedPrivateUDP(EnabledValue); + /// Disabled. + public static ManagedPrivateUDP Disabled { get; } = new ManagedPrivateUDP(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedPrivateUDP left, ManagedPrivateUDP right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedPrivateUDP left, ManagedPrivateUDP right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagedPrivateUDP(string value) => new ManagedPrivateUDP(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedPrivateUDP other && Equals(other); + /// + public bool Equals(ManagedPrivateUDP other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagementType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagementType.cs new file mode 100644 index 000000000000..f9c558b9f90b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagementType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The type of management for this hostpool, Automated or Standard. The default value is Automated. + public readonly partial struct ManagementType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagementType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutomatedValue = "Automated"; + private const string StandardValue = "Standard"; + + /// Automated. + public static ManagementType Automated { get; } = new ManagementType(AutomatedValue); + /// Standard. + public static ManagementType Standard { get; } = new ManagementType(StandardValue); + /// Determines if two values are the same. + public static bool operator ==(ManagementType left, ManagementType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagementType left, ManagementType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagementType(string value) => new ManagementType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagementType other && Equals(other); + /// + public bool Equals(ManagementType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..dc6943b9a172 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.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.DesktopVirtualization.Models +{ + public partial class MarketplaceInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MarketplaceInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Offer)) + { + writer.WritePropertyName("offer"u8); + writer.WriteStringValue(Offer); + } + if (Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + } + if (Optional.IsDefined(ExactVersion)) + { + writer.WritePropertyName("exactVersion"u8); + writer.WriteStringValue(ExactVersion); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MarketplaceInfoPatchProperties 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(MarketplaceInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketplaceInfoPatchProperties(document.RootElement, options); + } + + internal static MarketplaceInfoPatchProperties DeserializeMarketplaceInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string offer = default; + string publisher = default; + string sku = default; + string exactVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offer"u8)) + { + offer = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisher"u8)) + { + publisher = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("exactVersion"u8)) + { + exactVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketplaceInfoPatchProperties(offer, publisher, sku, exactVersion, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(MarketplaceInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + MarketplaceInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMarketplaceInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketplaceInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.cs new file mode 100644 index 000000000000..7fad83d45e50 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoPatchProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Marketplace image information. + public partial class MarketplaceInfoPatchProperties + { + /// + /// 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 MarketplaceInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// The offer of the image. + /// The publisher of the image. + /// The sku of the image. + /// The exact version of the image. + /// Keeps track of any properties unknown to the library. + internal MarketplaceInfoPatchProperties(string offer, string publisher, string sku, string exactVersion, IDictionary serializedAdditionalRawData) + { + Offer = offer; + Publisher = publisher; + Sku = sku; + ExactVersion = exactVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The offer of the image. + [WirePath("offer")] + public string Offer { get; set; } + /// The publisher of the image. + [WirePath("publisher")] + public string Publisher { get; set; } + /// The sku of the image. + [WirePath("sku")] + public string Sku { get; set; } + /// The exact version of the image. + [WirePath("exactVersion")] + public string ExactVersion { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.Serialization.cs new file mode 100644 index 000000000000..3c0de8ba94d1 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.Serialization.cs @@ -0,0 +1,260 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class MarketplaceInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MarketplaceInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("offer"u8); + writer.WriteStringValue(Offer); + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + writer.WritePropertyName("sku"u8); + writer.WriteStringValue(Sku); + writer.WritePropertyName("exactVersion"u8); + writer.WriteStringValue(ExactVersion); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MarketplaceInfoProperties 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(MarketplaceInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketplaceInfoProperties(document.RootElement, options); + } + + internal static MarketplaceInfoProperties DeserializeMarketplaceInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string offer = default; + string publisher = default; + string sku = default; + string exactVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offer"u8)) + { + offer = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisher"u8)) + { + publisher = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = property.Value.GetString(); + continue; + } + if (property.NameEquals("exactVersion"u8)) + { + exactVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketplaceInfoProperties(offer, publisher, sku, exactVersion, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Offer), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" offer: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Offer)) + { + builder.Append(" offer: "); + if (Offer.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Offer}'''"); + } + else + { + builder.AppendLine($"'{Offer}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Publisher), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publisher: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Publisher)) + { + builder.Append(" publisher: "); + if (Publisher.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Publisher}'''"); + } + else + { + builder.AppendLine($"'{Publisher}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Sku)) + { + builder.Append(" sku: "); + if (Sku.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Sku}'''"); + } + else + { + builder.AppendLine($"'{Sku}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExactVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" exactVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExactVersion)) + { + builder.Append(" exactVersion: "); + if (ExactVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ExactVersion}'''"); + } + else + { + builder.AppendLine($"'{ExactVersion}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MarketplaceInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + MarketplaceInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMarketplaceInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketplaceInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.cs new file mode 100644 index 000000000000..b234d87b2f14 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MarketplaceInfoProperties.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Marketplace image information. + public partial class MarketplaceInfoProperties + { + /// + /// 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 . + /// The offer of the image. + /// The publisher of the image. + /// The sku of the image. + /// The exact version of the image. + /// , , or is null. + public MarketplaceInfoProperties(string offer, string publisher, string sku, string exactVersion) + { + Argument.AssertNotNull(offer, nameof(offer)); + Argument.AssertNotNull(publisher, nameof(publisher)); + Argument.AssertNotNull(sku, nameof(sku)); + Argument.AssertNotNull(exactVersion, nameof(exactVersion)); + + Offer = offer; + Publisher = publisher; + Sku = sku; + ExactVersion = exactVersion; + } + + /// Initializes a new instance of . + /// The offer of the image. + /// The publisher of the image. + /// The sku of the image. + /// The exact version of the image. + /// Keeps track of any properties unknown to the library. + internal MarketplaceInfoProperties(string offer, string publisher, string sku, string exactVersion, IDictionary serializedAdditionalRawData) + { + Offer = offer; + Publisher = publisher; + Sku = sku; + ExactVersion = exactVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MarketplaceInfoProperties() + { + } + + /// The offer of the image. + [WirePath("offer")] + public string Offer { get; set; } + /// The publisher of the image. + [WirePath("publisher")] + public string Publisher { get; set; } + /// The sku of the image. + [WirePath("sku")] + public string Sku { get; set; } + /// The exact version of the image. + [WirePath("exactVersion")] + public string ExactVersion { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageDependencies.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageDependencies.cs index d78459760927..dd81d98dae42 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageDependencies.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageDependencies.cs @@ -51,7 +51,7 @@ public MsixPackageDependencies() } /// Initializes a new instance of . - /// Name of package dependency. + /// Name of the package dependency. For Msix packages, this is the other packages this package depends upon, for APP-V packages this is the locations of the user and deployment config files. /// Name of dependency publisher. /// Dependency version required. /// Keeps track of any properties unknown to the library. @@ -63,7 +63,7 @@ internal MsixPackageDependencies(string dependencyName, string publisher, string _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Name of package dependency. + /// Name of the package dependency. For Msix packages, this is the other packages this package depends upon, for APP-V packages this is the locations of the user and deployment config files. [WirePath("dependencyName")] public string DependencyName { get; set; } /// Name of dependency publisher. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..cb920d298edd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.Serialization.cs @@ -0,0 +1,144 @@ +// 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.DesktopVirtualization.Models +{ + public partial class NetworkInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (Optional.IsDefined(SecurityGroupId)) + { + writer.WritePropertyName("securityGroupId"u8); + writer.WriteStringValue(SecurityGroupId); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkInfoPatchProperties 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(NetworkInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInfoPatchProperties(document.RootElement, options); + } + + internal static NetworkInfoPatchProperties DeserializeNetworkInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier subnetId = default; + string securityGroupId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subnetId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("securityGroupId"u8)) + { + securityGroupId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkInfoPatchProperties(subnetId, securityGroupId, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(NetworkInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + NetworkInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNetworkInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.cs new file mode 100644 index 000000000000..aa059281ed78 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoPatchProperties.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Network information. + public partial class NetworkInfoPatchProperties + { + /// + /// 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 NetworkInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// The resource ID of the subnet. + /// The resource ID of the security group. Any allowable/open ports should be specified in the Network Security Group(NSG). + /// Keeps track of any properties unknown to the library. + internal NetworkInfoPatchProperties(ResourceIdentifier subnetId, string securityGroupId, IDictionary serializedAdditionalRawData) + { + SubnetId = subnetId; + SecurityGroupId = securityGroupId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource ID of the subnet. + [WirePath("subnetId")] + public ResourceIdentifier SubnetId { get; set; } + /// The resource ID of the security group. Any allowable/open ports should be specified in the Network Security Group(NSG). + [WirePath("securityGroupId")] + public string SecurityGroupId { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.Serialization.cs new file mode 100644 index 000000000000..11f84e62d5f2 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.Serialization.cs @@ -0,0 +1,193 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class NetworkInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkInfoProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + if (Optional.IsDefined(SecurityGroupId)) + { + writer.WritePropertyName("securityGroupId"u8); + writer.WriteStringValue(SecurityGroupId); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkInfoProperties 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(NetworkInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkInfoProperties(document.RootElement, options); + } + + internal static NetworkInfoProperties DeserializeNetworkInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier subnetId = default; + string securityGroupId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subnetId"u8)) + { + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("securityGroupId"u8)) + { + securityGroupId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkInfoProperties(subnetId, securityGroupId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubnetId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subnetId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SubnetId)) + { + builder.Append(" subnetId: "); + builder.AppendLine($"'{SubnetId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityGroupId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityGroupId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityGroupId)) + { + builder.Append(" securityGroupId: "); + if (SecurityGroupId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecurityGroupId}'''"); + } + else + { + builder.AppendLine($"'{SecurityGroupId}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + NetworkInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNetworkInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.cs new file mode 100644 index 000000000000..cb541753ee79 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/NetworkInfoProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Network information. + public partial class NetworkInfoProperties + { + /// + /// 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 . + /// The resource ID of the subnet. + /// is null. + public NetworkInfoProperties(ResourceIdentifier subnetId) + { + Argument.AssertNotNull(subnetId, nameof(subnetId)); + + SubnetId = subnetId; + } + + /// Initializes a new instance of . + /// The resource ID of the subnet. + /// The resource ID of the security group. Any allowable/open ports should be specified in the Network Security Group(NSG). + /// Keeps track of any properties unknown to the library. + internal NetworkInfoProperties(ResourceIdentifier subnetId, string securityGroupId, IDictionary serializedAdditionalRawData) + { + SubnetId = subnetId; + SecurityGroupId = securityGroupId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NetworkInfoProperties() + { + } + + /// The resource ID of the subnet. + [WirePath("subnetId")] + public ResourceIdentifier SubnetId { get; set; } + /// The resource ID of the security group. Any allowable/open ports should be specified in the Network Security Group(NSG). + [WirePath("securityGroupId")] + public string SecurityGroupId { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PreferredAppGroupType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PreferredAppGroupType.cs index 2d620a763a20..a0bd450881d0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PreferredAppGroupType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PreferredAppGroupType.cs @@ -26,11 +26,11 @@ public PreferredAppGroupType(string value) private const string DesktopValue = "Desktop"; private const string RailApplicationsValue = "RailApplications"; - /// None. + /// This value is read only, it is not accepted on input. public static PreferredAppGroupType None { get; } = new PreferredAppGroupType(NoneValue); - /// Desktop. + /// Users access the full Windows desktop from a session host. Available with pooled or personal host pools. public static PreferredAppGroupType Desktop { get; } = new PreferredAppGroupType(DesktopValue); - /// RailApplications. + /// Users access individual applications you select and publish to the application group. Available with pooled host pools only. public static PreferredAppGroupType RailApplications { get; } = new PreferredAppGroupType(RailApplicationsValue); /// Determines if two values are the same. public static bool operator ==(PreferredAppGroupType left, PreferredAppGroupType right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ProvisioningStateSHC.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ProvisioningStateSHC.cs new file mode 100644 index 000000000000..2bfab0357853 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ProvisioningStateSHC.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Provisioning state of the Session Host Configuration. + public readonly partial struct ProvisioningStateSHC : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningStateSHC(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + + /// Succeeded. + public static ProvisioningStateSHC Succeeded { get; } = new ProvisioningStateSHC(SucceededValue); + /// Failed. + public static ProvisioningStateSHC Failed { get; } = new ProvisioningStateSHC(FailedValue); + /// Canceled. + public static ProvisioningStateSHC Canceled { get; } = new ProvisioningStateSHC(CanceledValue); + /// Provisioning. + public static ProvisioningStateSHC Provisioning { get; } = new ProvisioningStateSHC(ProvisioningValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningStateSHC left, ProvisioningStateSHC right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningStateSHC left, ProvisioningStateSHC right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningStateSHC(string value) => new ProvisioningStateSHC(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningStateSHC other && Equals(other); + /// + public bool Equals(ProvisioningStateSHC other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PublicUDP.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PublicUDP.cs new file mode 100644 index 000000000000..539637147747 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PublicUDP.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + public readonly partial struct PublicUDP : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublicUDP(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Default. + public static PublicUDP Default { get; } = new PublicUDP(DefaultValue); + /// Enabled. + public static PublicUDP Enabled { get; } = new PublicUDP(EnabledValue); + /// Disabled. + public static PublicUDP Disabled { get; } = new PublicUDP(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicUDP left, PublicUDP right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicUDP left, PublicUDP right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PublicUDP(string value) => new PublicUDP(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicUDP other && Equals(other); + /// + public bool Equals(PublicUDP other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.Serialization.cs new file mode 100644 index 000000000000..d290598962d7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.Serialization.cs @@ -0,0 +1,219 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class RegistrationTokenList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistrationTokenList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RegistrationTokenList 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(RegistrationTokenList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegistrationTokenList(document.RootElement, options); + } + + internal static RegistrationTokenList DeserializeRegistrationTokenList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RegistrationTokenMinimal.DeserializeRegistrationTokenMinimal(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RegistrationTokenList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RegistrationTokenList)} does not support writing '{options.Format}' format."); + } + } + + RegistrationTokenList 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRegistrationTokenList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegistrationTokenList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.cs new file mode 100644 index 000000000000..063b3f9a8225 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenList.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// List of RegistrationToken definitions. + internal partial class RegistrationTokenList + { + /// + /// 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 . + internal RegistrationTokenList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of RegistrationToken definitions. + /// Link to the next page of results. + /// Keeps track of any properties unknown to the library. + internal RegistrationTokenList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of RegistrationToken definitions. + [WirePath("value")] + public IReadOnlyList Value { get; } + /// Link to the next page of results. + [WirePath("nextLink")] + public string NextLink { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.Serialization.cs new file mode 100644 index 000000000000..5fda722b2b5d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.Serialization.cs @@ -0,0 +1,209 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class RegistrationTokenMinimal : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistrationTokenMinimal)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ExpireOn)) + { + if (ExpireOn != null) + { + writer.WritePropertyName("expirationTime"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); + } + else + { + writer.WriteNull("expirationTime"); + } + } + if (Optional.IsDefined(Token)) + { + writer.WritePropertyName("token"u8); + writer.WriteStringValue(Token); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RegistrationTokenMinimal 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(RegistrationTokenMinimal)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegistrationTokenMinimal(document.RootElement, options); + } + + internal static RegistrationTokenMinimal DeserializeRegistrationTokenMinimal(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? expirationTime = default; + string token = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("expirationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + expirationTime = null; + continue; + } + expirationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("token"u8)) + { + token = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RegistrationTokenMinimal(expirationTime, token, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExpireOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" expirationTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExpireOn)) + { + builder.Append(" expirationTime: "); + var formattedDateTimeString = TypeFormatters.ToString(ExpireOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Token), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" token: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Token)) + { + builder.Append(" token: "); + if (Token.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Token}'''"); + } + else + { + builder.AppendLine($"'{Token}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RegistrationTokenMinimal)} does not support writing '{options.Format}' format."); + } + } + + RegistrationTokenMinimal 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRegistrationTokenMinimal(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegistrationTokenMinimal)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.cs new file mode 100644 index 000000000000..21b2be9ed9d3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Represents a Minimal set of properties for RegistrationToken definition. + public partial class RegistrationTokenMinimal + { + /// + /// 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 . + internal RegistrationTokenMinimal() + { + } + + /// Initializes a new instance of . + /// Expiration time of registration token. + /// The registration token base64 encoded string. + /// Keeps track of any properties unknown to the library. + internal RegistrationTokenMinimal(DateTimeOffset? expireOn, string token, IDictionary serializedAdditionalRawData) + { + ExpireOn = expireOn; + Token = token; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Expiration time of registration token. + [WirePath("expirationTime")] + public DateTimeOffset? ExpireOn { get; } + /// The registration token base64 encoded string. + [WirePath("token")] + public string Token { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RelayUDP.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RelayUDP.cs new file mode 100644 index 000000000000..45f797ca2deb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RelayUDP.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will attempt this connection type when making connections. This means that this connection is possible, but is not guaranteed, as there are other factors that may prevent this connection type, Disabled: UDP will not attempt this connection type when making connections. + public readonly partial struct RelayUDP : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelayUDP(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Default. + public static RelayUDP Default { get; } = new RelayUDP(DefaultValue); + /// Enabled. + public static RelayUDP Enabled { get; } = new RelayUDP(EnabledValue); + /// Disabled. + public static RelayUDP Disabled { get; } = new RelayUDP(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(RelayUDP left, RelayUDP right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelayUDP left, RelayUDP right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RelayUDP(string value) => new RelayUDP(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelayUDP other && Equals(other); + /// + public bool Equals(RelayUDP other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingHostPoolType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingHostPoolType.cs index 97a53ace5092..9453899c6a27 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingHostPoolType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingHostPoolType.cs @@ -23,9 +23,12 @@ public ScalingHostPoolType(string value) } private const string PooledValue = "Pooled"; + private const string PersonalValue = "Personal"; /// Users get a new (random) SessionHost every time it connects to the HostPool. public static ScalingHostPoolType Pooled { get; } = new ScalingHostPoolType(PooledValue); + /// Users will be assigned a SessionHost either by administrators (PersonalDesktopAssignmentType = Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will always be redirected to their assigned SessionHost. + public static ScalingHostPoolType Personal { get; } = new ScalingHostPoolType(PersonalValue); /// Determines if two values are the same. public static bool operator ==(ScalingHostPoolType left, ScalingHostPoolType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingMethod.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingMethod.cs new file mode 100644 index 000000000000..4d6f0888ac58 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingMethod.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + public readonly partial struct ScalingMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScalingMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PowerManageValue = "PowerManage"; + private const string CreateDeletePowerManageValue = "CreateDeletePowerManage"; + + /// Scaling will manage hosts in the host pool by power managing the hosts, but will not change the host pool size. + public static ScalingMethod PowerManage { get; } = new ScalingMethod(PowerManageValue); + /// Scaling will manage the hosts in the host pool by power managing the hosts, as well as creating and deleting hosts to modify the host pool size. This requires the create delete object to be set, and the assigned hostpool to have a session host config property. + public static ScalingMethod CreateDeletePowerManage { get; } = new ScalingMethod(CreateDeletePowerManageValue); + /// Determines if two values are the same. + public static bool operator ==(ScalingMethod left, ScalingMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScalingMethod left, ScalingMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScalingMethod(string value) => new ScalingMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScalingMethod other && Equals(other); + /// + public bool Equals(ScalingMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs index 030ab78c233a..4021e05a30ed 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs @@ -59,7 +59,7 @@ public ScalingPlanPatch() /// User friendly name of scaling plan. /// Timezone of the scaling plan. /// Exclusion tag for scaling plan. - /// List of ScalingSchedule definitions. + /// List Pooled ScalingSchedule definitions. /// List of ScalingHostPoolReference definitions. /// Keeps track of any properties unknown to the library. internal ScalingPlanPatch(IDictionary tags, string description, string friendlyName, string timeZone, string exclusionTag, IList schedules, IList hostPoolReferences, IDictionary serializedAdditionalRawData) @@ -89,7 +89,7 @@ internal ScalingPlanPatch(IDictionary tags, string description, /// Exclusion tag for scaling plan. [WirePath("properties.exclusionTag")] public string ExclusionTag { get; set; } - /// List of ScalingSchedule definitions. + /// List Pooled ScalingSchedule definitions. [WirePath("properties.schedules")] public IList Schedules { get; } /// List of ScalingHostPoolReference definitions. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.Serialization.cs index acd47571222b..bf0daa6e5725 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.Serialization.cs @@ -40,6 +40,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(NamePropertiesName)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(NamePropertiesName); + } if (Optional.IsCollectionDefined(DaysOfWeek)) { writer.WritePropertyName("daysOfWeek"u8); @@ -50,6 +55,23 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } writer.WriteEndArray(); } + if (Optional.IsDefined(ScalingMethod)) + { + writer.WritePropertyName("scalingMethod"u8); + writer.WriteStringValue(ScalingMethod.Value.ToString()); + } + if (Optional.IsDefined(CreateDelete)) + { + if (CreateDelete != null) + { + writer.WritePropertyName("createDelete"u8); + writer.WriteObjectValue(CreateDelete, options); + } + else + { + writer.WriteNull("createDelete"); + } + } if (Optional.IsDefined(RampUpStartTime)) { writer.WritePropertyName("rampUpStartTime"u8); @@ -157,7 +179,10 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched string name = default; ResourceType type = default; SystemData systemData = default; + string name0 = default; IList daysOfWeek = default; + ScalingMethod? scalingMethod = default; + CreateDeleteProperties createDelete = default; ScalingActionTime rampUpStartTime = default; SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; int? rampUpMinimumHostsPct = default; @@ -211,6 +236,11 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("name"u8)) + { + name0 = property0.Value.GetString(); + continue; + } if (property0.NameEquals("daysOfWeek"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -225,6 +255,25 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched daysOfWeek = array; continue; } + if (property0.NameEquals("scalingMethod"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMethod = new ScalingMethod(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("createDelete"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + createDelete = null; + continue; + } + createDelete = CreateDeleteProperties.DeserializeCreateDeleteProperties(property0.Value, options); + continue; + } if (property0.NameEquals("rampUpStartTime"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -379,7 +428,10 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched name, type, systemData, + name0, daysOfWeek ?? new ChangeTrackingList(), + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -465,6 +517,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NamePropertiesName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NamePropertiesName)) + { + builder.Append(" name: "); + if (NamePropertiesName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NamePropertiesName}'''"); + } + else + { + builder.AppendLine($"'{NamePropertiesName}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaysOfWeek), out propertyOverride); if (hasPropertyOverride) { @@ -488,6 +563,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScalingMethod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scalingMethod: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScalingMethod)) + { + builder.Append(" scalingMethod: "); + builder.AppendLine($"'{ScalingMethod.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateDelete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" createDelete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CreateDelete)) + { + builder.Append(" createDelete: "); + BicepSerializationHelpers.AppendChildObject(builder, CreateDelete, options, 4, false, " createDelete: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpStartTime), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs index 34477736b445..4db88374000a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs @@ -58,7 +58,10 @@ public ScalingPlanPooledSchedulePatch() /// The name. /// The resourceType. /// The systemData. + /// Name of the ScalingPlanPooledSchedule. /// Set of days of the week on which this schedule is active. + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. /// Starting time for ramp up period. /// Load balancing algorithm for ramp up period. /// Minimum host percentage for ramp up period. @@ -76,9 +79,12 @@ public ScalingPlanPooledSchedulePatch() /// Starting time for off-peak period. /// Load balancing algorithm for off-peak period. /// Keeps track of any properties unknown to the library. - internal ScalingPlanPooledSchedulePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList daysOfWeek, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScalingPlanPooledSchedulePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string namePropertiesName, IList daysOfWeek, ScalingMethod? scalingMethod, CreateDeleteProperties createDelete, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + NamePropertiesName = namePropertiesName; DaysOfWeek = daysOfWeek; + ScalingMethod = scalingMethod; + CreateDelete = createDelete; RampUpStartTime = rampUpStartTime; RampUpLoadBalancingAlgorithm = rampUpLoadBalancingAlgorithm; RampUpMinimumHostsPct = rampUpMinimumHostsPct; @@ -98,9 +104,18 @@ internal ScalingPlanPooledSchedulePatch(ResourceIdentifier id, string name, Reso _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Name of the ScalingPlanPooledSchedule. + [WirePath("properties.name")] + public string NamePropertiesName { get; } /// Set of days of the week on which this schedule is active. [WirePath("properties.daysOfWeek")] public IList DaysOfWeek { get; } + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + [WirePath("properties.scalingMethod")] + public ScalingMethod? ScalingMethod { get; set; } + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. + [WirePath("properties.createDelete")] + public CreateDeleteProperties CreateDelete { get; set; } /// Starting time for ramp up period. [WirePath("properties.rampUpStartTime")] public ScalingActionTime RampUpStartTime { get; set; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.Serialization.cs index b49b5a2bbf3b..444b20ef6c51 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.Serialization.cs @@ -47,10 +47,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteStartArray(); foreach (var item in DaysOfWeek) { - writer.WriteStringValue(item.ToString()); + writer.WriteStringValue(item.ToSerialString()); } writer.WriteEndArray(); } + if (Optional.IsDefined(ScalingMethod)) + { + writer.WritePropertyName("scalingMethod"u8); + writer.WriteStringValue(ScalingMethod.Value.ToString()); + } + if (Optional.IsDefined(CreateDelete)) + { + if (CreateDelete != null) + { + writer.WritePropertyName("createDelete"u8); + writer.WriteObjectValue(CreateDelete, options); + } + else + { + writer.WriteNull("createDelete"); + } + } if (Optional.IsDefined(RampUpStartTime)) { writer.WritePropertyName("rampUpStartTime"u8); @@ -169,7 +186,9 @@ internal static ScalingSchedule DeserializeScalingSchedule(JsonElement element, return null; } string name = default; - IList daysOfWeek = default; + IList daysOfWeek = default; + ScalingMethod? scalingMethod = default; + CreateDeleteProperties createDelete = default; ScalingActionTime rampUpStartTime = default; SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; int? rampUpMinimumHostsPct = default; @@ -201,14 +220,33 @@ internal static ScalingSchedule DeserializeScalingSchedule(JsonElement element, { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(new ScalingScheduleDaysOfWeekItem(item.GetString())); + array.Add(item.GetString().ToDesktopVirtualizationDayOfWeek()); } daysOfWeek = array; continue; } + if (property.NameEquals("scalingMethod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMethod = new ScalingMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("createDelete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + createDelete = null; + continue; + } + createDelete = CreateDeleteProperties.DeserializeCreateDeleteProperties(property.Value, options); + continue; + } if (property.NameEquals("rampUpStartTime"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -357,7 +395,9 @@ internal static ScalingSchedule DeserializeScalingSchedule(JsonElement element, serializedAdditionalRawData = rawDataDictionary; return new ScalingSchedule( name, - daysOfWeek ?? new ChangeTrackingList(), + daysOfWeek ?? new ChangeTrackingList(), + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -427,13 +467,43 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("["); foreach (var item in DaysOfWeek) { - builder.AppendLine($" '{item.ToString()}'"); + builder.AppendLine($" '{item.ToSerialString()}'"); } builder.AppendLine(" ]"); } } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScalingMethod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scalingMethod: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScalingMethod)) + { + builder.Append(" scalingMethod: "); + builder.AppendLine($"'{ScalingMethod.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateDelete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" createDelete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CreateDelete)) + { + builder.Append(" createDelete: "); + BicepSerializationHelpers.AppendChildObject(builder, CreateDelete, options, 2, false, " createDelete: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpStartTime), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.cs index 99dd96781f1b..184795af9c57 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingSchedule.cs @@ -48,12 +48,14 @@ public partial class ScalingSchedule /// Initializes a new instance of . public ScalingSchedule() { - DaysOfWeek = new ChangeTrackingList(); + DaysOfWeek = new ChangeTrackingList(); } /// Initializes a new instance of . /// Name of the ScalingPlanPooledSchedule. /// Set of days of the week on which this schedule is active. + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. /// Starting time for ramp up period. /// Load balancing algorithm for ramp up period. /// Minimum host percentage for ramp up period. @@ -71,10 +73,12 @@ public ScalingSchedule() /// Starting time for off-peak period. /// Load balancing algorithm for off-peak period. /// Keeps track of any properties unknown to the library. - internal ScalingSchedule(string name, IList daysOfWeek, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) + internal ScalingSchedule(string name, IList daysOfWeek, ScalingMethod? scalingMethod, CreateDeleteProperties createDelete, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) { Name = name; DaysOfWeek = daysOfWeek; + ScalingMethod = scalingMethod; + CreateDelete = createDelete; RampUpStartTime = rampUpStartTime; RampUpLoadBalancingAlgorithm = rampUpLoadBalancingAlgorithm; RampUpMinimumHostsPct = rampUpMinimumHostsPct; @@ -99,7 +103,13 @@ internal ScalingSchedule(string name, IList daysO public string Name { get; set; } /// Set of days of the week on which this schedule is active. [WirePath("daysOfWeek")] - public IList DaysOfWeek { get; } + public IList DaysOfWeek { get; } + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + [WirePath("scalingMethod")] + public ScalingMethod? ScalingMethod { get; set; } + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. + [WirePath("createDelete")] + public CreateDeleteProperties CreateDelete { get; set; } /// Starting time for ramp up period. [WirePath("rampUpStartTime")] public ScalingActionTime RampUpStartTime { get; set; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingScheduleDaysOfWeekItem.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingScheduleDaysOfWeekItem.cs deleted file mode 100644 index e4af1086d56a..000000000000 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingScheduleDaysOfWeekItem.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.DesktopVirtualization.Models -{ - /// The ScalingScheduleDaysOfWeekItem. - public readonly partial struct ScalingScheduleDaysOfWeekItem : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ScalingScheduleDaysOfWeekItem(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SundayValue = "Sunday"; - private const string MondayValue = "Monday"; - private const string TuesdayValue = "Tuesday"; - private const string WednesdayValue = "Wednesday"; - private const string ThursdayValue = "Thursday"; - private const string FridayValue = "Friday"; - private const string SaturdayValue = "Saturday"; - - /// Sunday. - public static ScalingScheduleDaysOfWeekItem Sunday { get; } = new ScalingScheduleDaysOfWeekItem(SundayValue); - /// Monday. - public static ScalingScheduleDaysOfWeekItem Monday { get; } = new ScalingScheduleDaysOfWeekItem(MondayValue); - /// Tuesday. - public static ScalingScheduleDaysOfWeekItem Tuesday { get; } = new ScalingScheduleDaysOfWeekItem(TuesdayValue); - /// Wednesday. - public static ScalingScheduleDaysOfWeekItem Wednesday { get; } = new ScalingScheduleDaysOfWeekItem(WednesdayValue); - /// Thursday. - public static ScalingScheduleDaysOfWeekItem Thursday { get; } = new ScalingScheduleDaysOfWeekItem(ThursdayValue); - /// Friday. - public static ScalingScheduleDaysOfWeekItem Friday { get; } = new ScalingScheduleDaysOfWeekItem(FridayValue); - /// Saturday. - public static ScalingScheduleDaysOfWeekItem Saturday { get; } = new ScalingScheduleDaysOfWeekItem(SaturdayValue); - /// Determines if two values are the same. - public static bool operator ==(ScalingScheduleDaysOfWeekItem left, ScalingScheduleDaysOfWeekItem right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ScalingScheduleDaysOfWeekItem left, ScalingScheduleDaysOfWeekItem right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ScalingScheduleDaysOfWeekItem(string value) => new ScalingScheduleDaysOfWeekItem(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ScalingScheduleDaysOfWeekItem other && Equals(other); - /// - public bool Equals(ScalingScheduleDaysOfWeekItem other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..96c639b8ba04 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.Serialization.cs @@ -0,0 +1,163 @@ +// 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.DesktopVirtualization.Models +{ + public partial class SecurityInfoPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityInfoPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(VirtualMachineSecurityType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(VirtualMachineSecurityType.Value.ToString()); + } + if (Optional.IsDefined(SecureBootEnabled)) + { + writer.WritePropertyName("secureBootEnabled"u8); + writer.WriteBooleanValue(SecureBootEnabled.Value); + } + if (Optional.IsDefined(VTpmEnabled)) + { + writer.WritePropertyName("vTpmEnabled"u8); + writer.WriteBooleanValue(VTpmEnabled.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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecurityInfoPatchProperties 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(SecurityInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityInfoPatchProperties(document.RootElement, options); + } + + internal static SecurityInfoPatchProperties DeserializeSecurityInfoPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualMachineSecurityType? type = default; + bool? secureBootEnabled = default; + bool? vTpmEnabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new VirtualMachineSecurityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("secureBootEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secureBootEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("vTpmEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vTpmEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecurityInfoPatchProperties(type, secureBootEnabled, vTpmEnabled, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(SecurityInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + SecurityInfoPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSecurityInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecurityInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.cs new file mode 100644 index 000000000000..606607c79873 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoPatchProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Security information. + public partial class SecurityInfoPatchProperties + { + /// + /// 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 SecurityInfoPatchProperties() + { + } + + /// Initializes a new instance of . + /// The security type used by virtual machine in hostpool session host. + /// Whether to use secureBoot on the virtual machine. + /// Whether to use vTPM on the virtual machine. + /// Keeps track of any properties unknown to the library. + internal SecurityInfoPatchProperties(VirtualMachineSecurityType? virtualMachineSecurityType, bool? secureBootEnabled, bool? vTpmEnabled, IDictionary serializedAdditionalRawData) + { + VirtualMachineSecurityType = virtualMachineSecurityType; + SecureBootEnabled = secureBootEnabled; + VTpmEnabled = vTpmEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The security type used by virtual machine in hostpool session host. + [WirePath("type")] + public VirtualMachineSecurityType? VirtualMachineSecurityType { get; set; } + /// Whether to use secureBoot on the virtual machine. + [WirePath("secureBootEnabled")] + public bool? SecureBootEnabled { get; set; } + /// Whether to use vTPM on the virtual machine. + [WirePath("vTpmEnabled")] + public bool? VTpmEnabled { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.Serialization.cs new file mode 100644 index 000000000000..4b47c3339a46 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.Serialization.cs @@ -0,0 +1,228 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SecurityInfoProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityInfoProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(VirtualMachineSecurityType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(VirtualMachineSecurityType.Value.ToString()); + } + if (Optional.IsDefined(SecureBootEnabled)) + { + writer.WritePropertyName("secureBootEnabled"u8); + writer.WriteBooleanValue(SecureBootEnabled.Value); + } + if (Optional.IsDefined(VTpmEnabled)) + { + writer.WritePropertyName("vTpmEnabled"u8); + writer.WriteBooleanValue(VTpmEnabled.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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecurityInfoProperties 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(SecurityInfoProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityInfoProperties(document.RootElement, options); + } + + internal static SecurityInfoProperties DeserializeSecurityInfoProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VirtualMachineSecurityType? type = default; + bool? secureBootEnabled = default; + bool? vTpmEnabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new VirtualMachineSecurityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("secureBootEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secureBootEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("vTpmEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vTpmEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecurityInfoProperties(type, secureBootEnabled, vTpmEnabled, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualMachineSecurityType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VirtualMachineSecurityType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{VirtualMachineSecurityType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecureBootEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secureBootEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecureBootEnabled)) + { + builder.Append(" secureBootEnabled: "); + var boolValue = SecureBootEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VTpmEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vTpmEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VTpmEnabled)) + { + builder.Append(" vTpmEnabled: "); + var boolValue = VTpmEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SecurityInfoProperties)} does not support writing '{options.Format}' format."); + } + } + + SecurityInfoProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSecurityInfoProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecurityInfoProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.cs new file mode 100644 index 000000000000..27ff088ee265 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Security information. + public partial class SecurityInfoProperties + { + /// + /// 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 SecurityInfoProperties() + { + } + + /// Initializes a new instance of . + /// The security type used by virtual machine in hostpool session host. Default is Standard. + /// Whether to use secureBoot on the virtual machine. + /// Whether to use vTPM on the virtual machine. + /// Keeps track of any properties unknown to the library. + internal SecurityInfoProperties(VirtualMachineSecurityType? virtualMachineSecurityType, bool? secureBootEnabled, bool? vTpmEnabled, IDictionary serializedAdditionalRawData) + { + VirtualMachineSecurityType = virtualMachineSecurityType; + SecureBootEnabled = secureBootEnabled; + VTpmEnabled = vTpmEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The security type used by virtual machine in hostpool session host. Default is Standard. + [WirePath("type")] + public VirtualMachineSecurityType? VirtualMachineSecurityType { get; set; } + /// Whether to use secureBoot on the virtual machine. + [WirePath("secureBootEnabled")] + public bool? SecureBootEnabled { get; set; } + /// Whether to use vTPM on the virtual machine. + [WirePath("vTpmEnabled")] + public bool? VTpmEnabled { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.Serialization.cs new file mode 100644 index 000000000000..b3681d5902ae --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.Serialization.cs @@ -0,0 +1,219 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class SessionHostConfigurationList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostConfigurationList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostConfigurationList 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(SessionHostConfigurationList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostConfigurationList(document.RootElement, options); + } + + internal static SessionHostConfigurationList DeserializeSessionHostConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SessionHostConfigurationData.DeserializeSessionHostConfigurationData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationList)} does not support writing '{options.Format}' format."); + } + } + + SessionHostConfigurationList 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostConfigurationList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.cs new file mode 100644 index 000000000000..7f04dacad6cd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// List of SessionHostConfiguration definitions. + internal partial class SessionHostConfigurationList + { + /// + /// 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 . + internal SessionHostConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of SessionHostConfiguration definitions. + /// Link to the next page of results. + /// Keeps track of any properties unknown to the library. + internal SessionHostConfigurationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of SessionHostConfiguration definitions. + public IReadOnlyList Value { get; } + /// Link to the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.Serialization.cs new file mode 100644 index 000000000000..602c5b163198 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.Serialization.cs @@ -0,0 +1,375 @@ +// 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.DesktopVirtualization.Models +{ + public partial class SessionHostConfigurationPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostConfigurationPatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsCollectionDefined(VmTags)) + { + writer.WritePropertyName("vmTags"u8); + writer.WriteStartObject(); + foreach (var item in VmTags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(VmLocation)) + { + writer.WritePropertyName("vmLocation"u8); + writer.WriteStringValue(VmLocation); + } + if (Optional.IsDefined(VmResourceGroup)) + { + writer.WritePropertyName("vmResourceGroup"u8); + writer.WriteStringValue(VmResourceGroup); + } + if (Optional.IsDefined(VmNamePrefix)) + { + writer.WritePropertyName("vmNamePrefix"u8); + writer.WriteStringValue(VmNamePrefix); + } + if (Optional.IsCollectionDefined(AvailabilityZones)) + { + writer.WritePropertyName("availabilityZones"u8); + writer.WriteStartArray(); + foreach (var item in AvailabilityZones) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NetworkInfo)) + { + writer.WritePropertyName("networkInfo"u8); + writer.WriteObjectValue(NetworkInfo, options); + } + if (Optional.IsDefined(VmSizeId)) + { + writer.WritePropertyName("vmSizeId"u8); + writer.WriteStringValue(VmSizeId); + } + if (Optional.IsDefined(DiskInfo)) + { + writer.WritePropertyName("diskInfo"u8); + writer.WriteObjectValue(DiskInfo, options); + } + if (Optional.IsDefined(CustomConfigurationScriptUri)) + { + writer.WritePropertyName("customConfigurationScriptUrl"u8); + writer.WriteStringValue(CustomConfigurationScriptUri.AbsoluteUri); + } + if (Optional.IsDefined(ImageInfo)) + { + writer.WritePropertyName("imageInfo"u8); + writer.WriteObjectValue(ImageInfo, options); + } + if (Optional.IsDefined(DomainInfo)) + { + writer.WritePropertyName("domainInfo"u8); + writer.WriteObjectValue(DomainInfo, options); + } + if (Optional.IsDefined(SecurityInfo)) + { + writer.WritePropertyName("securityInfo"u8); + writer.WriteObjectValue(SecurityInfo, options); + } + if (Optional.IsDefined(VmAdminCredentials)) + { + writer.WritePropertyName("vmAdminCredentials"u8); + writer.WriteObjectValue(VmAdminCredentials, options); + } + if (Optional.IsDefined(BootDiagnosticsInfo)) + { + writer.WritePropertyName("bootDiagnosticsInfo"u8); + writer.WriteObjectValue(BootDiagnosticsInfo, options); + } + writer.WriteEndObject(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostConfigurationPatch 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(SessionHostConfigurationPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostConfigurationPatch(document.RootElement, options); + } + + internal static SessionHostConfigurationPatch DeserializeSessionHostConfigurationPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string friendlyName = default; + IDictionary vmTags = default; + string vmLocation = default; + string vmResourceGroup = default; + string vmNamePrefix = default; + IList availabilityZones = default; + NetworkInfoPatchProperties networkInfo = default; + string vmSizeId = default; + DiskInfoProperties diskInfo = default; + Uri customConfigurationScriptUrl = default; + ImageInfoPatchProperties imageInfo = default; + DomainInfoPatchProperties domainInfo = default; + SecurityInfoPatchProperties securityInfo = default; + KeyVaultCredentialsPatchProperties vmAdminCredentials = default; + BootDiagnosticsInfoPatchProperties bootDiagnosticsInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("friendlyName"u8)) + { + friendlyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmTags"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + vmTags = dictionary; + continue; + } + if (property0.NameEquals("vmLocation"u8)) + { + vmLocation = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmResourceGroup"u8)) + { + vmResourceGroup = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmNamePrefix"u8)) + { + vmNamePrefix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("availabilityZones"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + availabilityZones = array; + continue; + } + if (property0.NameEquals("networkInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkInfo = NetworkInfoPatchProperties.DeserializeNetworkInfoPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmSizeId"u8)) + { + vmSizeId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("diskInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskInfo = DiskInfoProperties.DeserializeDiskInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("customConfigurationScriptUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customConfigurationScriptUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("imageInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageInfo = ImageInfoPatchProperties.DeserializeImageInfoPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("domainInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainInfo = DomainInfoPatchProperties.DeserializeDomainInfoPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("securityInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityInfo = SecurityInfoPatchProperties.DeserializeSecurityInfoPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmAdminCredentials"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmAdminCredentials = KeyVaultCredentialsPatchProperties.DeserializeKeyVaultCredentialsPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("bootDiagnosticsInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootDiagnosticsInfo = BootDiagnosticsInfoPatchProperties.DeserializeBootDiagnosticsInfoPatchProperties(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationPatch( + friendlyName, + vmTags ?? new ChangeTrackingDictionary(), + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones ?? new ChangeTrackingList(), + networkInfo, + vmSizeId, + diskInfo, + customConfigurationScriptUrl, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationPatch)} does not support writing '{options.Format}' format."); + } + } + + SessionHostConfigurationPatch 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostConfigurationPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.cs new file mode 100644 index 000000000000..52257b8fc942 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Represents a SessionHostConfigurationPatch definition. + public partial class SessionHostConfigurationPatch + { + /// + /// 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 SessionHostConfigurationPatch() + { + VmTags = new ChangeTrackingDictionary(); + AvailabilityZones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Friendly name to describe this version of the SessionHostConfiguration. + /// Hashtable that lists key/value pair tags to apply to the VMs. + /// The Location for the session host to be created in. + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + /// The prefix that should be associated with session host names. + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Security information. + /// Local Admin credentials for session hosts. + /// Boot Diagnostics information. + /// Keeps track of any properties unknown to the library. + internal SessionHostConfigurationPatch(string friendlyName, IDictionary vmTags, string vmLocation, string vmResourceGroup, string vmNamePrefix, IList availabilityZones, NetworkInfoPatchProperties networkInfo, string vmSizeId, DiskInfoProperties diskInfo, Uri customConfigurationScriptUri, ImageInfoPatchProperties imageInfo, DomainInfoPatchProperties domainInfo, SecurityInfoPatchProperties securityInfo, KeyVaultCredentialsPatchProperties vmAdminCredentials, BootDiagnosticsInfoPatchProperties bootDiagnosticsInfo, IDictionary serializedAdditionalRawData) + { + FriendlyName = friendlyName; + VmTags = vmTags; + VmLocation = vmLocation; + VmResourceGroup = vmResourceGroup; + VmNamePrefix = vmNamePrefix; + AvailabilityZones = availabilityZones; + NetworkInfo = networkInfo; + VmSizeId = vmSizeId; + DiskInfo = diskInfo; + CustomConfigurationScriptUri = customConfigurationScriptUri; + ImageInfo = imageInfo; + DomainInfo = domainInfo; + SecurityInfo = securityInfo; + VmAdminCredentials = vmAdminCredentials; + BootDiagnosticsInfo = bootDiagnosticsInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Friendly name to describe this version of the SessionHostConfiguration. + [WirePath("properties.friendlyName")] + public string FriendlyName { get; set; } + /// Hashtable that lists key/value pair tags to apply to the VMs. + [WirePath("properties.vmTags")] + public IDictionary VmTags { get; } + /// The Location for the session host to be created in. + [WirePath("properties.vmLocation")] + public string VmLocation { get; set; } + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + [WirePath("properties.vmResourceGroup")] + public string VmResourceGroup { get; set; } + /// The prefix that should be associated with session host names. + [WirePath("properties.vmNamePrefix")] + public string VmNamePrefix { get; set; } + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + [WirePath("properties.availabilityZones")] + public IList AvailabilityZones { get; } + /// Network information. + [WirePath("properties.networkInfo")] + public NetworkInfoPatchProperties NetworkInfo { get; set; } + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + [WirePath("properties.vmSizeId")] + public string VmSizeId { get; set; } + /// Disk information. + [WirePath("properties.diskInfo")] + public DiskInfoProperties DiskInfo { get; set; } + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + [WirePath("properties.customConfigurationScriptUrl")] + public Uri CustomConfigurationScriptUri { get; set; } + /// Image configurations of HostPool. + [WirePath("properties.imageInfo")] + public ImageInfoPatchProperties ImageInfo { get; set; } + /// Domain configurations of session hosts. + internal DomainInfoPatchProperties DomainInfo { get; set; } + /// Credentials needed to create the virtual machine. + [WirePath("properties.domainInfo.activeDirectoryInfo.domainCredentials")] + public KeyVaultCredentialsPatchProperties ActiveDirectoryInfoDomainCredentials + { + get => DomainInfo is null ? default : DomainInfo.ActiveDirectoryInfoDomainCredentials; + set + { + if (DomainInfo is null) + DomainInfo = new DomainInfoPatchProperties(); + DomainInfo.ActiveDirectoryInfoDomainCredentials = value; + } + } + + /// Security information. + [WirePath("properties.securityInfo")] + public SecurityInfoPatchProperties SecurityInfo { get; set; } + /// Local Admin credentials for session hosts. + [WirePath("properties.vmAdminCredentials")] + public KeyVaultCredentialsPatchProperties VmAdminCredentials { get; set; } + /// Boot Diagnostics information. + [WirePath("properties.bootDiagnosticsInfo")] + public BootDiagnosticsInfoPatchProperties BootDiagnosticsInfo { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.Serialization.cs new file mode 100644 index 000000000000..0ce25dc206b3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.Serialization.cs @@ -0,0 +1,219 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + internal partial class SessionHostManagementList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementList 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(SessionHostManagementList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementList(document.RootElement, options); + } + + internal static SessionHostManagementList DeserializeSessionHostManagementList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SessionHostManagementData.DeserializeSessionHostManagementData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementList)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementList 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.cs new file mode 100644 index 000000000000..6543f2ae37a0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// List of SessionHostManagement definitions. + internal partial class SessionHostManagementList + { + /// + /// 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 . + internal SessionHostManagementList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of SessionHostManagement definitions. + /// Link to the next page of results. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of SessionHostManagement definitions. + public IReadOnlyList Value { get; } + /// Link to the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.Serialization.cs new file mode 100644 index 000000000000..c871d10f75dc --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.Serialization.cs @@ -0,0 +1,293 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SessionHostManagementOperationProgress : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementOperationProgress)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ExecutionStartOn)) + { + writer.WritePropertyName("executionStartTime"u8); + writer.WriteStringValue(ExecutionStartOn.Value, "O"); + } + if (Optional.IsDefined(TotalSessionHosts)) + { + writer.WritePropertyName("totalSessionHosts"u8); + writer.WriteNumberValue(TotalSessionHosts.Value); + } + if (Optional.IsDefined(SessionHostsInProgress)) + { + writer.WritePropertyName("sessionHostsInProgress"u8); + writer.WriteNumberValue(SessionHostsInProgress.Value); + } + if (Optional.IsDefined(SessionHostsCompleted)) + { + writer.WritePropertyName("sessionHostsCompleted"u8); + writer.WriteNumberValue(SessionHostsCompleted.Value); + } + if (Optional.IsDefined(SessionHostsRollbackFailed)) + { + writer.WritePropertyName("sessionHostsRollbackFailed"u8); + writer.WriteNumberValue(SessionHostsRollbackFailed.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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementOperationProgress 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(SessionHostManagementOperationProgress)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementOperationProgress(document.RootElement, options); + } + + internal static SessionHostManagementOperationProgress DeserializeSessionHostManagementOperationProgress(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? executionStartTime = default; + int? totalSessionHosts = default; + int? sessionHostsInProgress = default; + int? sessionHostsCompleted = default; + int? sessionHostsRollbackFailed = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("executionStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executionStartTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("totalSessionHosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalSessionHosts = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sessionHostsInProgress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostsInProgress = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sessionHostsCompleted"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostsCompleted = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sessionHostsRollbackFailed"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostsRollbackFailed = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementOperationProgress( + executionStartTime, + totalSessionHosts, + sessionHostsInProgress, + sessionHostsCompleted, + sessionHostsRollbackFailed, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExecutionStartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" executionStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExecutionStartOn)) + { + builder.Append(" executionStartTime: "); + var formattedDateTimeString = TypeFormatters.ToString(ExecutionStartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TotalSessionHosts), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" totalSessionHosts: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TotalSessionHosts)) + { + builder.Append(" totalSessionHosts: "); + builder.AppendLine($"{TotalSessionHosts.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostsInProgress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostsInProgress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostsInProgress)) + { + builder.Append(" sessionHostsInProgress: "); + builder.AppendLine($"{SessionHostsInProgress.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostsCompleted), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostsCompleted: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostsCompleted)) + { + builder.Append(" sessionHostsCompleted: "); + builder.AppendLine($"{SessionHostsCompleted.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostsRollbackFailed), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostsRollbackFailed: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostsRollbackFailed)) + { + builder.Append(" sessionHostsRollbackFailed: "); + builder.AppendLine($"{SessionHostsRollbackFailed.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementOperationProgress)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementOperationProgress 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementOperationProgress(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementOperationProgress)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.cs new file mode 100644 index 000000000000..4742427d59ff --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementOperationProgress.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// SessionHostManagement Operation Progress information. + public partial class SessionHostManagementOperationProgress + { + /// + /// 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 . + internal SessionHostManagementOperationProgress() + { + } + + /// Initializes a new instance of . + /// Time that the sessionHostManagement operation was created. + /// The number of sessionHosts to be started in the sessionHostManagement operation. + /// The number of sessionHosts in progress in the sessionHostManagement operation. + /// The number of sessionHosts completed in the sessionHostManagement operation. + /// The number of sessionHosts rollback failed in the sessionHostManagement operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementOperationProgress(DateTimeOffset? executionStartOn, int? totalSessionHosts, int? sessionHostsInProgress, int? sessionHostsCompleted, int? sessionHostsRollbackFailed, IDictionary serializedAdditionalRawData) + { + ExecutionStartOn = executionStartOn; + TotalSessionHosts = totalSessionHosts; + SessionHostsInProgress = sessionHostsInProgress; + SessionHostsCompleted = sessionHostsCompleted; + SessionHostsRollbackFailed = sessionHostsRollbackFailed; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Time that the sessionHostManagement operation was created. + [WirePath("executionStartTime")] + public DateTimeOffset? ExecutionStartOn { get; } + /// The number of sessionHosts to be started in the sessionHostManagement operation. + [WirePath("totalSessionHosts")] + public int? TotalSessionHosts { get; } + /// The number of sessionHosts in progress in the sessionHostManagement operation. + [WirePath("sessionHostsInProgress")] + public int? SessionHostsInProgress { get; } + /// The number of sessionHosts completed in the sessionHostManagement operation. + [WirePath("sessionHostsCompleted")] + public int? SessionHostsCompleted { get; } + /// The number of sessionHosts rollback failed in the sessionHostManagement operation. + [WirePath("sessionHostsRollbackFailed")] + public int? SessionHostsRollbackFailed { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.Serialization.cs new file mode 100644 index 000000000000..71fbecbac5aa --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.Serialization.cs @@ -0,0 +1,189 @@ +// 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.DesktopVirtualization.Models +{ + public partial class SessionHostManagementPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementPatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ScheduledDateTimeZone)) + { + writer.WritePropertyName("scheduledDateTimeZone"u8); + writer.WriteStringValue(ScheduledDateTimeZone); + } + if (Optional.IsDefined(Update)) + { + writer.WritePropertyName("update"u8); + writer.WriteObjectValue(Update, options); + } + if (Optional.IsDefined(Provisioning)) + { + writer.WritePropertyName("provisioning"u8); + writer.WriteObjectValue(Provisioning, options); + } + if (Optional.IsDefined(FailedSessionHostCleanupPolicy)) + { + writer.WritePropertyName("failedSessionHostCleanupPolicy"u8); + writer.WriteStringValue(FailedSessionHostCleanupPolicy.Value.ToString()); + } + writer.WriteEndObject(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementPatch 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(SessionHostManagementPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementPatch(document.RootElement, options); + } + + internal static SessionHostManagementPatch DeserializeSessionHostManagementPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string scheduledDateTimeZone = default; + HostPoolUpdateConfigurationPatchProperties update = default; + SessionHostProvisioningConfigurationPatchProperties provisioning = default; + FailedSessionHostCleanupPolicySHC? failedSessionHostCleanupPolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scheduledDateTimeZone"u8)) + { + scheduledDateTimeZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("update"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + update = HostPoolUpdateConfigurationPatchProperties.DeserializeHostPoolUpdateConfigurationPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("provisioning"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioning = SessionHostProvisioningConfigurationPatchProperties.DeserializeSessionHostProvisioningConfigurationPatchProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("failedSessionHostCleanupPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + failedSessionHostCleanupPolicy = new FailedSessionHostCleanupPolicySHC(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementPatch(scheduledDateTimeZone, update, provisioning, failedSessionHostCleanupPolicy, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(SessionHostManagementPatch)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementPatch 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.cs new file mode 100644 index 000000000000..84986999c43b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Represents a SessionHostManagementPatch definition. + public partial class SessionHostManagementPatch + { + /// + /// 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 SessionHostManagementPatch() + { + } + + /// Initializes a new instance of . + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + /// Parameters for a hostpool update. + /// Parameters that apply when session hosts are provisioned. + /// The policy that should be applied when the Session Host provisioning operation fails. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementPatch(string scheduledDateTimeZone, HostPoolUpdateConfigurationPatchProperties update, SessionHostProvisioningConfigurationPatchProperties provisioning, FailedSessionHostCleanupPolicySHC? failedSessionHostCleanupPolicy, IDictionary serializedAdditionalRawData) + { + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + Provisioning = provisioning; + FailedSessionHostCleanupPolicy = failedSessionHostCleanupPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + [WirePath("properties.scheduledDateTimeZone")] + public string ScheduledDateTimeZone { get; set; } + /// Parameters for a hostpool update. + [WirePath("properties.update")] + public HostPoolUpdateConfigurationPatchProperties Update { get; set; } + /// Parameters that apply when session hosts are provisioned. + [WirePath("properties.provisioning")] + public SessionHostProvisioningConfigurationPatchProperties Provisioning { get; set; } + /// The policy that should be applied when the Session Host provisioning operation fails. + [WirePath("properties.failedSessionHostCleanupPolicy")] + public FailedSessionHostCleanupPolicySHC? FailedSessionHostCleanupPolicy { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.Serialization.cs new file mode 100644 index 000000000000..a750d723067d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.Serialization.cs @@ -0,0 +1,293 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SessionHostManagementProvisioningOperationProgress : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningOperationProgress)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ExecutionStartOn)) + { + writer.WritePropertyName("executionStartTime"u8); + writer.WriteStringValue(ExecutionStartOn.Value, "O"); + } + if (Optional.IsDefined(SessionHostsInProgress)) + { + writer.WritePropertyName("sessionHostsInProgress"u8); + writer.WriteNumberValue(SessionHostsInProgress.Value); + } + if (Optional.IsDefined(SessionHostsCompleted)) + { + writer.WritePropertyName("sessionHostsCompleted"u8); + writer.WriteNumberValue(SessionHostsCompleted.Value); + } + if (Optional.IsDefined(FinalSessionHostsCount)) + { + writer.WritePropertyName("finalSessionHostsCount"u8); + writer.WriteNumberValue(FinalSessionHostsCount.Value); + } + if (Optional.IsDefined(InitialSessionHostsCount)) + { + writer.WritePropertyName("initialSessionHostsCount"u8); + writer.WriteNumberValue(InitialSessionHostsCount.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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementProvisioningOperationProgress 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(SessionHostManagementProvisioningOperationProgress)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementProvisioningOperationProgress(document.RootElement, options); + } + + internal static SessionHostManagementProvisioningOperationProgress DeserializeSessionHostManagementProvisioningOperationProgress(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? executionStartTime = default; + int? sessionHostsInProgress = default; + int? sessionHostsCompleted = default; + int? finalSessionHostsCount = default; + int? initialSessionHostsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("executionStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executionStartTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("sessionHostsInProgress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostsInProgress = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sessionHostsCompleted"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostsCompleted = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("finalSessionHostsCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + finalSessionHostsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("initialSessionHostsCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialSessionHostsCount = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementProvisioningOperationProgress( + executionStartTime, + sessionHostsInProgress, + sessionHostsCompleted, + finalSessionHostsCount, + initialSessionHostsCount, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExecutionStartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" executionStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExecutionStartOn)) + { + builder.Append(" executionStartTime: "); + var formattedDateTimeString = TypeFormatters.ToString(ExecutionStartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostsInProgress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostsInProgress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostsInProgress)) + { + builder.Append(" sessionHostsInProgress: "); + builder.AppendLine($"{SessionHostsInProgress.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostsCompleted), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostsCompleted: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostsCompleted)) + { + builder.Append(" sessionHostsCompleted: "); + builder.AppendLine($"{SessionHostsCompleted.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FinalSessionHostsCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" finalSessionHostsCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FinalSessionHostsCount)) + { + builder.Append(" finalSessionHostsCount: "); + builder.AppendLine($"{FinalSessionHostsCount.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InitialSessionHostsCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" initialSessionHostsCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InitialSessionHostsCount)) + { + builder.Append(" initialSessionHostsCount: "); + builder.AppendLine($"{InitialSessionHostsCount.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningOperationProgress)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementProvisioningOperationProgress 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementProvisioningOperationProgress(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningOperationProgress)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.cs new file mode 100644 index 000000000000..f7d08df1b4c8 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningOperationProgress.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// SessionHostManagement Provisioning Operation Progress information. + public partial class SessionHostManagementProvisioningOperationProgress + { + /// + /// 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 . + internal SessionHostManagementProvisioningOperationProgress() + { + } + + /// Initializes a new instance of . + /// Time that the sessionHostManagement operation was created. + /// The number of sessionHosts in progress in the sessionHostManagement provisioning operation. + /// The number of sessionHosts completed in the sessionHostManagement provisioning operation. + /// The final instance count of the host pool for this provisioning operation. + /// The initial instance count of the host pool for this provisioning operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementProvisioningOperationProgress(DateTimeOffset? executionStartOn, int? sessionHostsInProgress, int? sessionHostsCompleted, int? finalSessionHostsCount, int? initialSessionHostsCount, IDictionary serializedAdditionalRawData) + { + ExecutionStartOn = executionStartOn; + SessionHostsInProgress = sessionHostsInProgress; + SessionHostsCompleted = sessionHostsCompleted; + FinalSessionHostsCount = finalSessionHostsCount; + InitialSessionHostsCount = initialSessionHostsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Time that the sessionHostManagement operation was created. + [WirePath("executionStartTime")] + public DateTimeOffset? ExecutionStartOn { get; } + /// The number of sessionHosts in progress in the sessionHostManagement provisioning operation. + [WirePath("sessionHostsInProgress")] + public int? SessionHostsInProgress { get; } + /// The number of sessionHosts completed in the sessionHostManagement provisioning operation. + [WirePath("sessionHostsCompleted")] + public int? SessionHostsCompleted { get; } + /// The final instance count of the host pool for this provisioning operation. + [WirePath("finalSessionHostsCount")] + public int? FinalSessionHostsCount { get; } + /// The initial instance count of the host pool for this provisioning operation. + [WirePath("initialSessionHostsCount")] + public int? InitialSessionHostsCount { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.Serialization.cs new file mode 100644 index 000000000000..dbb7e1ffab45 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.Serialization.cs @@ -0,0 +1,512 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SessionHostManagementProvisioningStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningStatus)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + if (Optional.IsDefined(PercentComplete)) + { + writer.WritePropertyName("percentComplete"u8); + writer.WriteNumberValue(PercentComplete.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(Progress)) + { + writer.WritePropertyName("progress"u8); + writer.WriteObjectValue(Progress, options); + } + if (Optional.IsDefined(ScheduledOn)) + { + writer.WritePropertyName("scheduledDateTime"u8); + writer.WriteStringValue(ScheduledOn.Value, "O"); + } + if (Optional.IsDefined(SessionHostManagement)) + { + writer.WritePropertyName("sessionHostManagement"u8); + writer.WriteObjectValue(SessionHostManagement, options); + } + writer.WriteEndObject(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementProvisioningStatus 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(SessionHostManagementProvisioningStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementProvisioningStatus(document.RootElement, options); + } + + internal static SessionHostManagementProvisioningStatus DeserializeSessionHostManagementProvisioningStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string status = default; + float? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + ResponseError error = default; + string correlationId = default; + SessionHostManagementProvisioningOperationProgress progress = default; + DateTimeOffset? scheduledDateTime = default; + SessionHostManagementData sessionHostManagement = 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("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("correlationId"u8)) + { + correlationId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("progress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + progress = SessionHostManagementProvisioningOperationProgress.DeserializeSessionHostManagementProvisioningOperationProgress(property0.Value, options); + continue; + } + if (property0.NameEquals("scheduledDateTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledDateTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("sessionHostManagement"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostManagement = SessionHostManagementData.DeserializeSessionHostManagementData(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementProvisioningStatus( + id, + name, + status, + percentComplete, + startTime, + endTime, + error, + correlationId, + progress, + scheduledDateTime, + sessionHostManagement, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" percentComplete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PercentComplete)) + { + builder.Append(" percentComplete: "); + builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CorrelationId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" correlationId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CorrelationId)) + { + builder.Append(" correlationId: "); + if (CorrelationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CorrelationId}'''"); + } + else + { + builder.AppendLine($"'{CorrelationId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Progress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" progress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Progress)) + { + builder.Append(" progress: "); + BicepSerializationHelpers.AppendChildObject(builder, Progress, options, 4, false, " progress: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scheduledDateTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScheduledOn)) + { + builder.Append(" scheduledDateTime: "); + var formattedDateTimeString = TypeFormatters.ToString(ScheduledOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostManagement), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostManagement: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostManagement)) + { + builder.Append(" sessionHostManagement: "); + BicepSerializationHelpers.AppendChildObject(builder, SessionHostManagement, options, 4, false, " sessionHostManagement: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningStatus)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementProvisioningStatus 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementProvisioningStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementProvisioningStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.cs new file mode 100644 index 000000000000..750833cac6f4 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementProvisioningStatus.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The current status of the session host provisioning async operation. + public partial class SessionHostManagementProvisioningStatus + { + /// + /// 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 . + /// Operation status. Current defined values are < Scheduled | ValidatingSessionHostProvisioning | Cancelling | ProvisioningSessionHosts > | Succeeded | Failed | Canceled. + /// is null. + internal SessionHostManagementProvisioningStatus(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. Current defined values are < Scheduled | ValidatingSessionHostProvisioning | Cancelling | ProvisioningSessionHosts > | Succeeded | Failed | Canceled. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// If present, details of the operation error. + /// The correlation Id for Log Analytics. + /// Progress information on the sessionHostManagement operation. + /// The timestamp that the update is scheduled for. + /// SessionHostManagement properties used for the operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementProvisioningStatus(string id, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, ResponseError error, string correlationId, SessionHostManagementProvisioningOperationProgress progress, DateTimeOffset? scheduledOn, SessionHostManagementData sessionHostManagement, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Error = error; + CorrelationId = correlationId; + Progress = progress; + ScheduledOn = scheduledOn; + SessionHostManagement = sessionHostManagement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostManagementProvisioningStatus() + { + } + + /// Fully qualified ID for the async operation. + [WirePath("id")] + public string Id { get; } + /// Name of the async operation. + [WirePath("name")] + public string Name { get; } + /// Operation status. Current defined values are < Scheduled | ValidatingSessionHostProvisioning | Cancelling | ProvisioningSessionHosts > | Succeeded | Failed | Canceled. + [WirePath("status")] + public string Status { get; } + /// Percent of the operation that is complete. + [WirePath("percentComplete")] + public float? PercentComplete { get; } + /// The start time of the operation. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + [WirePath("endTime")] + public DateTimeOffset? EndOn { get; } + /// If present, details of the operation error. + [WirePath("error")] + public ResponseError Error { get; } + /// The correlation Id for Log Analytics. + [WirePath("properties.correlationId")] + public string CorrelationId { get; } + /// Progress information on the sessionHostManagement operation. + [WirePath("properties.progress")] + public SessionHostManagementProvisioningOperationProgress Progress { get; } + /// The timestamp that the update is scheduled for. + [WirePath("properties.scheduledDateTime")] + public DateTimeOffset? ScheduledOn { get; } + /// SessionHostManagement properties used for the operation. + [WirePath("properties.sessionHostManagement")] + public SessionHostManagementData SessionHostManagement { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.Serialization.cs new file mode 100644 index 000000000000..3447868d3690 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.Serialization.cs @@ -0,0 +1,512 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SessionHostManagementUpdateStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementUpdateStatus)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + if (Optional.IsDefined(PercentComplete)) + { + writer.WritePropertyName("percentComplete"u8); + writer.WriteNumberValue(PercentComplete.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (Optional.IsDefined(Progress)) + { + writer.WritePropertyName("progress"u8); + writer.WriteObjectValue(Progress, options); + } + if (Optional.IsDefined(ScheduledOn)) + { + writer.WritePropertyName("scheduledDateTime"u8); + writer.WriteStringValue(ScheduledOn.Value, "O"); + } + if (Optional.IsDefined(SessionHostManagement)) + { + writer.WritePropertyName("sessionHostManagement"u8); + writer.WriteObjectValue(SessionHostManagement, options); + } + writer.WriteEndObject(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostManagementUpdateStatus 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(SessionHostManagementUpdateStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementUpdateStatus(document.RootElement, options); + } + + internal static SessionHostManagementUpdateStatus DeserializeSessionHostManagementUpdateStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string status = default; + float? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + ResponseError error = default; + string correlationId = default; + SessionHostManagementOperationProgress progress = default; + DateTimeOffset? scheduledDateTime = default; + SessionHostManagementData sessionHostManagement = 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("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("correlationId"u8)) + { + correlationId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("progress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + progress = SessionHostManagementOperationProgress.DeserializeSessionHostManagementOperationProgress(property0.Value, options); + continue; + } + if (property0.NameEquals("scheduledDateTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledDateTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("sessionHostManagement"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostManagement = SessionHostManagementData.DeserializeSessionHostManagementData(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementUpdateStatus( + id, + name, + status, + percentComplete, + startTime, + endTime, + error, + correlationId, + progress, + scheduledDateTime, + sessionHostManagement, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" percentComplete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PercentComplete)) + { + builder.Append(" percentComplete: "); + builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CorrelationId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" correlationId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CorrelationId)) + { + builder.Append(" correlationId: "); + if (CorrelationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CorrelationId}'''"); + } + else + { + builder.AppendLine($"'{CorrelationId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Progress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" progress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Progress)) + { + builder.Append(" progress: "); + BicepSerializationHelpers.AppendChildObject(builder, Progress, options, 4, false, " progress: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scheduledDateTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScheduledOn)) + { + builder.Append(" scheduledDateTime: "); + var formattedDateTimeString = TypeFormatters.ToString(ScheduledOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostManagement), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostManagement: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostManagement)) + { + builder.Append(" sessionHostManagement: "); + BicepSerializationHelpers.AppendChildObject(builder, SessionHostManagement, options, 4, false, " sessionHostManagement: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementUpdateStatus)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementUpdateStatus 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementUpdateStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementUpdateStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.cs new file mode 100644 index 000000000000..d525ce6d9847 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The current status of the session host update async operation. + public partial class SessionHostManagementUpdateStatus + { + /// + /// 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 . + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + /// is null. + internal SessionHostManagementUpdateStatus(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// If present, details of the operation error. + /// The correlation Id for Log Analytics. + /// Progress information on the sessionHostManagement operation. + /// The timestamp that the update is scheduled for. + /// SessionHostManagement properties used for the operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementUpdateStatus(string id, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, ResponseError error, string correlationId, SessionHostManagementOperationProgress progress, DateTimeOffset? scheduledOn, SessionHostManagementData sessionHostManagement, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Error = error; + CorrelationId = correlationId; + Progress = progress; + ScheduledOn = scheduledOn; + SessionHostManagement = sessionHostManagement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostManagementUpdateStatus() + { + } + + /// Fully qualified ID for the async operation. + [WirePath("id")] + public string Id { get; } + /// Name of the async operation. + [WirePath("name")] + public string Name { get; } + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + [WirePath("status")] + public string Status { get; } + /// Percent of the operation that is complete. + [WirePath("percentComplete")] + public float? PercentComplete { get; } + /// The start time of the operation. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + [WirePath("endTime")] + public DateTimeOffset? EndOn { get; } + /// If present, details of the operation error. + [WirePath("error")] + public ResponseError Error { get; } + /// The correlation Id for Log Analytics. + [WirePath("properties.correlationId")] + public string CorrelationId { get; } + /// Progress information on the sessionHostManagement operation. + [WirePath("properties.progress")] + public SessionHostManagementOperationProgress Progress { get; } + /// The timestamp that the update is scheduled for. + [WirePath("properties.scheduledDateTime")] + public DateTimeOffset? ScheduledOn { get; } + /// SessionHostManagement properties used for the operation. + [WirePath("properties.sessionHostManagement")] + public SessionHostManagementData SessionHostManagement { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.Serialization.cs new file mode 100644 index 000000000000..d8f9d4a3687f --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.Serialization.cs @@ -0,0 +1,163 @@ +// 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.DesktopVirtualization.Models +{ + public partial class SessionHostProvisioningConfigurationPatchProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SetDrainMode)) + { + writer.WritePropertyName("setDrainMode"u8); + writer.WriteBooleanValue(SetDrainMode.Value); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"u8); + writer.WriteNumberValue(InstanceCount.Value); + } + if (Optional.IsDefined(CanaryPolicy)) + { + writer.WritePropertyName("canaryPolicy"u8); + writer.WriteStringValue(CanaryPolicy.Value.ToString()); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostProvisioningConfigurationPatchProperties 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(SessionHostProvisioningConfigurationPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostProvisioningConfigurationPatchProperties(document.RootElement, options); + } + + internal static SessionHostProvisioningConfigurationPatchProperties DeserializeSessionHostProvisioningConfigurationPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? setDrainMode = default; + int? instanceCount = default; + CanaryPolicy? canaryPolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("setDrainMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + setDrainMode = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("instanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("canaryPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + canaryPolicy = new CanaryPolicy(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostProvisioningConfigurationPatchProperties(setDrainMode, instanceCount, canaryPolicy, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostProvisioningConfigurationPatchProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostProvisioningConfigurationPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.cs new file mode 100644 index 000000000000..5f28a91f1c1c --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationPatchProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The configuration for session host provisioning operations. + public partial class SessionHostProvisioningConfigurationPatchProperties + { + /// + /// 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 SessionHostProvisioningConfigurationPatchProperties() + { + } + + /// Initializes a new instance of . + /// Whether the session host should be set in drain mode following provisioning. + /// the number of session hosts to exist in the Host Pool. + /// Policy on whether a Canary VM should be provisioned during a session host provisioning operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostProvisioningConfigurationPatchProperties(bool? setDrainMode, int? instanceCount, CanaryPolicy? canaryPolicy, IDictionary serializedAdditionalRawData) + { + SetDrainMode = setDrainMode; + InstanceCount = instanceCount; + CanaryPolicy = canaryPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether the session host should be set in drain mode following provisioning. + [WirePath("setDrainMode")] + public bool? SetDrainMode { get; set; } + /// the number of session hosts to exist in the Host Pool. + [WirePath("instanceCount")] + public int? InstanceCount { get; set; } + /// Policy on whether a Canary VM should be provisioned during a session host provisioning operation. + [WirePath("canaryPolicy")] + public CanaryPolicy? CanaryPolicy { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.Serialization.cs new file mode 100644 index 000000000000..9744d5a38b21 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.Serialization.cs @@ -0,0 +1,227 @@ +// 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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class SessionHostProvisioningConfigurationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SetDrainMode)) + { + writer.WritePropertyName("setDrainMode"u8); + writer.WriteBooleanValue(SetDrainMode.Value); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"u8); + writer.WriteNumberValue(InstanceCount.Value); + } + if (Optional.IsDefined(CanaryPolicy)) + { + writer.WritePropertyName("canaryPolicy"u8); + writer.WriteStringValue(CanaryPolicy.Value.ToString()); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SessionHostProvisioningConfigurationProperties 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(SessionHostProvisioningConfigurationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostProvisioningConfigurationProperties(document.RootElement, options); + } + + internal static SessionHostProvisioningConfigurationProperties DeserializeSessionHostProvisioningConfigurationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? setDrainMode = default; + int? instanceCount = default; + CanaryPolicy? canaryPolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("setDrainMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + setDrainMode = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("instanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("canaryPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + canaryPolicy = new CanaryPolicy(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostProvisioningConfigurationProperties(setDrainMode, instanceCount, canaryPolicy, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SetDrainMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" setDrainMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SetDrainMode)) + { + builder.Append(" setDrainMode: "); + var boolValue = SetDrainMode.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceCount)) + { + builder.Append(" instanceCount: "); + builder.AppendLine($"{InstanceCount.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CanaryPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" canaryPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CanaryPolicy)) + { + builder.Append(" canaryPolicy: "); + builder.AppendLine($"'{CanaryPolicy.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostProvisioningConfigurationProperties 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostProvisioningConfigurationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostProvisioningConfigurationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.cs new file mode 100644 index 000000000000..9e3165a59ec3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostProvisioningConfigurationProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The configuration for session host provisioning operations. + public partial class SessionHostProvisioningConfigurationProperties + { + /// + /// 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 SessionHostProvisioningConfigurationProperties() + { + } + + /// Initializes a new instance of . + /// Whether the session host should be set in drain mode following provisioning. + /// the number of session hosts to exist in the Host Pool. + /// Policy on whether a Canary VM should be provisioned during a session host provisioning operation. + /// Keeps track of any properties unknown to the library. + internal SessionHostProvisioningConfigurationProperties(bool? setDrainMode, int? instanceCount, CanaryPolicy? canaryPolicy, IDictionary serializedAdditionalRawData) + { + SetDrainMode = setDrainMode; + InstanceCount = instanceCount; + CanaryPolicy = canaryPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Whether the session host should be set in drain mode following provisioning. + [WirePath("setDrainMode")] + public bool? SetDrainMode { get; set; } + /// the number of session hosts to exist in the Host Pool. + [WirePath("instanceCount")] + public int? InstanceCount { get; set; } + /// Policy on whether a Canary VM should be provisioned during a session host provisioning operation. + [WirePath("canaryPolicy")] + public CanaryPolicy? CanaryPolicy { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/Type.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..31791de716dd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/Type.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The type of image session hosts use in the hostpool. + public readonly partial struct Type : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Type(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MarketplaceValue = "Marketplace"; + private const string CustomValue = "Custom"; + + /// Using default marketplace images offered by Azure Marketplace. + public static Type Marketplace { get; } = new Type(MarketplaceValue); + /// Using a custom image. + public static Type Custom { get; } = new Type(CustomValue); + /// Determines if two values are the same. + public static bool operator ==(Type left, Type right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Type left, Type right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Type(string value) => new Type(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Type other && Equals(other); + /// + public bool Equals(Type other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.Serialization.cs new file mode 100644 index 000000000000..0acb0a2cf518 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.Serialization.cs @@ -0,0 +1,159 @@ +// 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.DesktopVirtualization.Models +{ + public partial class UpdateSessionHostsRequestBody : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateSessionHostsRequestBody)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ScheduledOn)) + { + writer.WritePropertyName("scheduledDateTime"u8); + writer.WriteStringValue(ScheduledOn.Value, "O"); + } + if (Optional.IsDefined(ScheduledDateTimeZone)) + { + writer.WritePropertyName("scheduledDateTimeZone"u8); + writer.WriteStringValue(ScheduledDateTimeZone); + } + if (Optional.IsDefined(Update)) + { + writer.WritePropertyName("update"u8); + writer.WriteObjectValue(Update, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateSessionHostsRequestBody 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(UpdateSessionHostsRequestBody)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateSessionHostsRequestBody(document.RootElement, options); + } + + internal static UpdateSessionHostsRequestBody DeserializeUpdateSessionHostsRequestBody(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? scheduledDateTime = default; + string scheduledDateTimeZone = default; + HostPoolUpdateConfigurationPatchProperties update = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduledDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("scheduledDateTimeZone"u8)) + { + scheduledDateTimeZone = property.Value.GetString(); + continue; + } + if (property.NameEquals("update"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + update = HostPoolUpdateConfigurationPatchProperties.DeserializeHostPoolUpdateConfigurationPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateSessionHostsRequestBody(scheduledDateTime, scheduledDateTimeZone, update, 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, AzureResourceManagerDesktopVirtualizationContext.Default); + default: + throw new FormatException($"The model {nameof(UpdateSessionHostsRequestBody)} does not support writing '{options.Format}' format."); + } + } + + UpdateSessionHostsRequestBody 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateSessionHostsRequestBody(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateSessionHostsRequestBody)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.cs new file mode 100644 index 000000000000..97f4e6b9ddb9 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UpdateSessionHostsRequestBody.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Object containing the definition for properties to be used for a sessionHostUpdate operation. + public partial class UpdateSessionHostsRequestBody + { + /// + /// 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 UpdateSessionHostsRequestBody() + { + } + + /// Initializes a new instance of . + /// The timestamp that the update validation is scheduled for. If none is provided, the update will be executed immediately. + /// The timeZone as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + /// settings for management information for the hostpool update operation. If none is provided the update will use the settings saved in the sessionHostManagement object. + /// Keeps track of any properties unknown to the library. + internal UpdateSessionHostsRequestBody(DateTimeOffset? scheduledOn, string scheduledDateTimeZone, HostPoolUpdateConfigurationPatchProperties update, IDictionary serializedAdditionalRawData) + { + ScheduledOn = scheduledOn; + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The timestamp that the update validation is scheduled for. If none is provided, the update will be executed immediately. + [WirePath("scheduledDateTime")] + public DateTimeOffset? ScheduledOn { get; set; } + /// The timeZone as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + [WirePath("scheduledDateTimeZone")] + public string ScheduledDateTimeZone { get; set; } + /// settings for management information for the hostpool update operation. If none is provided the update will use the settings saved in the sessionHostManagement object. + [WirePath("update")] + public HostPoolUpdateConfigurationPatchProperties Update { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineDiskType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineDiskType.cs new file mode 100644 index 000000000000..93bf90551bb7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineDiskType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The disk type used by virtual machine in hostpool session host. + public readonly partial struct VirtualMachineDiskType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualMachineDiskType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StandardLRSValue = "Standard_LRS"; + private const string PremiumLRSValue = "Premium_LRS"; + private const string StandardSSDLRSValue = "StandardSSD_LRS"; + + /// Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. + public static VirtualMachineDiskType StandardLRS { get; } = new VirtualMachineDiskType(StandardLRSValue); + /// Premium SSD locally redundant storage. Best for production and performance sensitive workloads. + public static VirtualMachineDiskType PremiumLRS { get; } = new VirtualMachineDiskType(PremiumLRSValue); + /// Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev/test. + public static VirtualMachineDiskType StandardSSDLRS { get; } = new VirtualMachineDiskType(StandardSSDLRSValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualMachineDiskType left, VirtualMachineDiskType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualMachineDiskType left, VirtualMachineDiskType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VirtualMachineDiskType(string value) => new VirtualMachineDiskType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualMachineDiskType other && Equals(other); + /// + public bool Equals(VirtualMachineDiskType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineSecurityType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineSecurityType.cs new file mode 100644 index 000000000000..780a7cda4e3e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualMachineSecurityType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// The security type used by virtual machine in hostpool session host. Default is Standard. + public readonly partial struct VirtualMachineSecurityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualMachineSecurityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StandardValue = "Standard"; + private const string TrustedLaunchValue = "TrustedLaunch"; + private const string ConfidentialVmValue = "ConfidentialVM"; + + /// Standard security protocol. No additional parameters. + public static VirtualMachineSecurityType Standard { get; } = new VirtualMachineSecurityType(StandardValue); + /// TrustedLaunch allows for secure boot adn vTPM. + public static VirtualMachineSecurityType TrustedLaunch { get; } = new VirtualMachineSecurityType(TrustedLaunchValue); + /// Confidential Virtual Machine security protocol. + public static VirtualMachineSecurityType ConfidentialVm { get; } = new VirtualMachineSecurityType(ConfidentialVmValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualMachineSecurityType left, VirtualMachineSecurityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualMachineSecurityType left, VirtualMachineSecurityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VirtualMachineSecurityType(string value) => new VirtualMachineSecurityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualMachineSecurityType other && Equals(other); + /// + public bool Equals(VirtualMachineSecurityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs index 4aa621f896fd..2bf78db972f4 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string msixPac /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string msixPackageFullName, Can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string msixPackageFullName /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string msixPackageFullName, CancellationTok /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.cs index c4e0c4809990..6829153f3211 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.cs @@ -71,7 +71,7 @@ public MsixPackageData() /// Specifies how to register Package in feed. /// Make this version of the package the active one across the hostpool. /// List of package dependencies. - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. /// Date Package was last updated, found in the appxmanifest.xml. /// List of package applications. /// Keeps track of any properties unknown to the library. @@ -115,7 +115,7 @@ internal MsixPackageData(ResourceIdentifier id, string name, ResourceType resour /// List of package dependencies. [WirePath("properties.packageDependencies")] public IList PackageDependencies { get; } - /// Package version found in the appxmanifest.xml. + /// Package Version found in the appxmanifest.xml. [WirePath("properties.version")] public string Version { get; set; } /// Date Package was last updated, found in the appxmanifest.xml. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs index 01d98bc9d831..fbc92fb7fdaa 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(MsixPackage /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ActiveSessionHostConfigurationsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ActiveSessionHostConfigurationsRestOperations.cs new file mode 100644 index 000000000000..bfc333e60371 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ActiveSessionHostConfigurationsRestOperations.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class ActiveSessionHostConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ActiveSessionHostConfigurationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ActiveSessionHostConfigurationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/activeSessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/activeSessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update operations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ActiveSessionHostConfigurationData.DeserializeActiveSessionHostConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ActiveSessionHostConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update operations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ActiveSessionHostConfigurationData.DeserializeActiveSessionHostConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ActiveSessionHostConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/activeSessionHostConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/activeSessionHostConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List activeSessionHostConfigurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ActiveSessionHostConfigurationList.DeserializeActiveSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List activeSessionHostConfigurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ActiveSessionHostConfigurationList.DeserializeActiveSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List activeSessionHostConfigurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ActiveSessionHostConfigurationList.DeserializeActiveSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List activeSessionHostConfigurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPoolNextPage(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ActiveSessionHostConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ActiveSessionHostConfigurationList.DeserializeActiveSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageInfoRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageInfoRestOperations.cs index 75979fd4ed60..9d97cf3cad21 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageInfoRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageInfoRestOperations.cs @@ -32,7 +32,7 @@ public AppAttachPackageInfoRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs index e61d1c676c2d..cbe5bbfb5efc 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs @@ -32,7 +32,7 @@ public AppAttachPackageRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -73,7 +73,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// Get an app attach package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -104,7 +104,7 @@ public async Task> GetAsync(string subscriptionId /// Get an app attach package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -173,7 +173,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// Create or update an App Attach package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definitions. /// The cancellation token to use. /// , , or is null. @@ -205,7 +205,7 @@ public async Task> CreateOrUpdateAsync(string sub /// Create or update an App Attach package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definitions. /// The cancellation token to use. /// , , or is null. @@ -234,7 +234,7 @@ public Response CreateOrUpdate(string subscriptionId, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -245,10 +245,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (force != null) + { + uri.AppendQuery("force", force.Value, true); + } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -262,6 +266,10 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (force != null) + { + uri.AppendQuery("force", force.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -271,17 +279,18 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// Remove an App Attach Package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. + /// Force flag to delete App Attach package. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName, force); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -296,17 +305,18 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// Remove an App Attach Package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. + /// Force flag to delete App Attach package. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string appAttachPackageName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName, force); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -359,7 +369,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// Update an App Attach Package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definition. /// The cancellation token to use. /// , , or is null. @@ -390,7 +400,7 @@ public async Task> UpdateAsync(string subscriptio /// Update an App Attach Package. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the App Attach package. + /// The name of the App Attach package arm object. /// Object containing App Attach Package definition. /// The cancellation token to use. /// , , or is null. @@ -461,7 +471,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str /// List App Attach packages in resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -489,7 +499,7 @@ public async Task> ListByResourceGroupAsync(strin /// List App Attach packages in resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -552,7 +562,7 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, stri /// List App Attach packages in subscription. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -578,7 +588,7 @@ public async Task> ListBySubscriptionAsync(string /// List App Attach packages in subscription. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -628,7 +638,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -658,7 +668,7 @@ public async Task> ListByResourceGroupNextPageAsy /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// OData filter expression. Valid properties for filtering are package name, host pool, package owner name, and custom data. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -709,7 +719,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// List App Attach packages in subscription. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -737,7 +747,7 @@ public async Task> ListBySubscriptionNextPageAsyn /// List App Attach packages in subscription. /// The URL to the next page of results. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. + /// OData filter expression. Valid properties for filtering are package name, resource group, host pool, package owner name, and custom data. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs index d3cc7916f029..af84e7f68141 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs @@ -32,7 +32,7 @@ public ApplicationGroupsRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs index ea92e0d83eb2..f44426f2106d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs @@ -32,7 +32,7 @@ public ApplicationsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostProvisioningRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostProvisioningRestOperations.cs new file mode 100644 index 000000000000..9e864676a0b3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostProvisioningRestOperations.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class ControlSessionHostProvisioningRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ControlSessionHostProvisioningRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ControlSessionHostProvisioningRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/controlSessionHostProvisioning", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/controlSessionHostProvisioning", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(hostPoolProvisioningControlParameter, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Control provisioning of a hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing control action for hostpool provisioning. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task PostAsync(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(hostPoolProvisioningControlParameter, nameof(hostPoolProvisioningControlParameter)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, hostPoolProvisioningControlParameter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Control provisioning of a hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing control action for hostpool provisioning. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(hostPoolProvisioningControlParameter, nameof(hostPoolProvisioningControlParameter)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, hostPoolProvisioningControlParameter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostUpdateRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostUpdateRestOperations.cs new file mode 100644 index 000000000000..5cd19ae87042 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ControlSessionHostUpdateRestOperations.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class ControlSessionHostUpdateRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ControlSessionHostUpdateRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ControlSessionHostUpdateRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolUpdateControlParameter hostPoolUpdateControlParameter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/controlSessionHostUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolUpdateControlParameter hostPoolUpdateControlParameter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/controlSessionHostUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(hostPoolUpdateControlParameter, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Control update of a hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing control action for hostpool update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task PostAsync(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolUpdateControlParameter hostPoolUpdateControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(hostPoolUpdateControlParameter, nameof(hostPoolUpdateControlParameter)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, hostPoolUpdateControlParameter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Control update of a hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing control action for hostpool update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolUpdateControlParameter hostPoolUpdateControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(hostPoolUpdateControlParameter, nameof(hostPoolUpdateControlParameter)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, hostPoolUpdateControlParameter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs index 04576cf347fd..8770eb44e098 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs @@ -32,7 +32,7 @@ public DesktopsRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs index 9e9add92947a..070aa4642f35 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs @@ -32,7 +32,7 @@ public HostPoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -746,6 +746,100 @@ public Response RetrieveRegistrationToken(string subsc } } + internal RequestUriBuilder CreateListRegistrationTokensRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/listRegistrationTokens", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRegistrationTokensRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/listRegistrationTokens", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Operation to list the RegistrationTokens associated with the HostPool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListRegistrationTokensAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListRegistrationTokensRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RegistrationTokenList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RegistrationTokenList.DeserializeRegistrationTokenList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Operation to list the RegistrationTokens associated with the HostPool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListRegistrationTokens(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListRegistrationTokensRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RegistrationTokenList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RegistrationTokenList.DeserializeRegistrationTokenList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/InitiateSessionHostUpdateRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/InitiateSessionHostUpdateRestOperations.cs new file mode 100644 index 000000000000..4e2547f318c0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/InitiateSessionHostUpdateRestOperations.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class InitiateSessionHostUpdateRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InitiateSessionHostUpdateRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public InitiateSessionHostUpdateRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, UpdateSessionHostsRequestBody updateSessionHostsRequestBody) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/initiateSessionHostUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string hostPoolName, UpdateSessionHostsRequestBody updateSessionHostsRequestBody) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/initiateSessionHostUpdate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (updateSessionHostsRequestBody != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateSessionHostsRequestBody, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Initiates a hostpool update or schedule an update for the future. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing the definition for properties to be used in the sessionHostUpdate validation. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task PostAsync(string subscriptionId, string resourceGroupName, string hostPoolName, UpdateSessionHostsRequestBody updateSessionHostsRequestBody = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, updateSessionHostsRequestBody); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Initiates a hostpool update or schedule an update for the future. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing the definition for properties to be used in the sessionHostUpdate validation. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Post(string subscriptionId, string resourceGroupName, string hostPoolName, UpdateSessionHostsRequestBody updateSessionHostsRequestBody = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreatePostRequest(subscriptionId, resourceGroupName, hostPoolName, updateSessionHostsRequestBody); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixImagesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixImagesRestOperations.cs index b7ba6d245deb..74ed898a457c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixImagesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixImagesRestOperations.cs @@ -32,7 +32,7 @@ public MsixImagesRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs index d77d07a94a9e..6f6cfe5bc05d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs @@ -32,7 +32,7 @@ public MsixPackagesRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index bfa9dc38176a..1820f8052507 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index a275b5c5796e..8d0d88ef58e2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -32,7 +32,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs index d2acff0a185e..20360b998456 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs @@ -32,7 +32,7 @@ public ScalingPlanPersonalSchedulesRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs index a78cb95dfb5c..d985952e3339 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs @@ -32,7 +32,7 @@ public ScalingPlanPooledSchedulesRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs index 00c9f0d4e9dd..d507f61a4cee 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs @@ -32,7 +32,7 @@ public ScalingPlansRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostConfigurationsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostConfigurationsRestOperations.cs new file mode 100644 index 000000000000..18ac53257beb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostConfigurationsRestOperations.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class SessionHostConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SessionHostConfigurationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SessionHostConfigurationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostConfigurationData.DeserializeSessionHostConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SessionHostConfiguration. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostConfigurationData.DeserializeSessionHostConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List sessionHostConfigurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostConfigurationList.DeserializeSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List sessionHostConfigurations. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostConfigurationList.DeserializeSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List sessionHostConfigurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostConfigurationList.DeserializeSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List sessionHostConfigurations. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPoolNextPage(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostConfigurationList.DeserializeSessionHostConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsRestOperations.cs new file mode 100644 index 000000000000..bac3b0d6715c --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsRestOperations.cs @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class SessionHostManagementsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SessionHostManagementsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SessionHostManagementsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostManagementData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostManagementData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SessionHostManagementData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SessionHostManagementData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a SessionHostManagement. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string hostPoolName, SessionHostManagementPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementData.DeserializeSessionHostManagementData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SessionHostManagements by hostPool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementList.DeserializeSessionHostManagementList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SessionHostManagements by hostPool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementList.DeserializeSessionHostManagementList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SessionHostManagements by hostPool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByHostPoolNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementList.DeserializeSessionHostManagementList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SessionHostManagements by hostPool. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPoolNextPage(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementList.DeserializeSessionHostManagementList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsUpdateStatusRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsUpdateStatusRestOperations.cs new file mode 100644 index 000000000000..fc8879d6b15e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostManagementsUpdateStatusRestOperations.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class SessionHostManagementsUpdateStatusRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SessionHostManagementsUpdateStatusRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SessionHostManagementsUpdateStatusRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/sessionHostUpdateStatuses/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/sessionHostUpdateStatuses/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the session host update status for a given hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementUpdateStatus value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementUpdateStatus.DeserializeSessionHostManagementUpdateStatus(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the session host update status for a given hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementUpdateStatus value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementUpdateStatus.DeserializeSessionHostManagementUpdateStatus(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostProvisioningStatusesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostProvisioningStatusesRestOperations.cs new file mode 100644 index 000000000000..0f8d827529d3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostProvisioningStatusesRestOperations.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class SessionHostProvisioningStatusesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SessionHostProvisioningStatusesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SessionHostProvisioningStatusesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/sessionHostProvisioningStatuses/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHostManagements/default/sessionHostProvisioningStatuses/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the session host provisioning status for a given hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementProvisioningStatus value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostManagementProvisioningStatus.DeserializeSessionHostManagementProvisioningStatus(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the session host provisioning status for a given hostpool. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SessionHostManagementProvisioningStatus value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostManagementProvisioningStatus.DeserializeSessionHostManagementProvisioningStatus(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostRestOperations.cs new file mode 100644 index 000000000000..55d1eb154d5e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostRestOperations.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + internal partial class SessionHostRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SessionHostRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SessionHostRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-03-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateRetryProvisioningRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHosts/", false); + uri.AppendPath(sessionHostName, true); + uri.AppendPath("/retryProvisioning", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateRetryProvisioningRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/sessionHosts/", false); + uri.AppendPath(sessionHostName, true); + uri.AppendPath("/retryProvisioning", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retry provisioning on a SessionHost. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The name of the session host within the specified host pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task RetryProvisioningAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + + using var message = CreateRetryProvisioningRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retry provisioning on a SessionHost. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the host pool within the specified resource group. + /// The name of the session host within the specified host pool. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response RetryProvisioning(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + + using var message = CreateRetryProvisioningRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs index 3e66d56c351b..a50beab6f151 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs @@ -32,7 +32,7 @@ public SessionHostsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -360,7 +360,7 @@ public Response Update(string subscriptionId, string resourceGr } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip, string vmPath) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -384,10 +384,14 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re { uri.AppendQuery("initialSkip", initialSkip.Value, true); } + if (vmPath != null) + { + uri.AppendQuery("vmPath", vmPath, true); + } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip, string vmPath) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -414,6 +418,10 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro { uri.AppendQuery("initialSkip", initialSkip.Value, true); } + if (vmPath != null) + { + uri.AppendQuery("vmPath", vmPath, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); @@ -427,16 +435,17 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -459,16 +468,17 @@ public async Task> ListAsync(string subscriptionId, st /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public Response List(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -484,7 +494,7 @@ public Response List(string subscriptionId, string resourceGrou } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip, string vmPath) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -492,7 +502,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip, string vmPath) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -514,17 +524,18 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -548,17 +559,18 @@ public async Task> ListNextPageAsync(string nextLink, /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/StartMenuItemsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/StartMenuItemsRestOperations.cs index 1ed70afad2f2..478efe5a9d78 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/StartMenuItemsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/StartMenuItemsRestOperations.cs @@ -32,7 +32,7 @@ public StartMenuItemsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs index 6f2e4ac08269..45829e4365a5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs @@ -32,7 +32,7 @@ public UserSessionsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs index 83c49ddd9f38..bbb5531bfc67 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs @@ -32,7 +32,7 @@ public WorkspacesRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-04-03"; + _apiVersion = apiVersion ?? "2025-03-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs index 31db3f619312..690cada641cc 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string scaling /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string scalingPlanName, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string scalingPlanName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string scalingPlanName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs index bb3c0a8f7553..18a286cf3c2d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs @@ -57,7 +57,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (Optional.IsDefined(Sku)) { @@ -194,7 +195,8 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, { continue; } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("sku"u8)) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs index 1590791c9bb0..599085408477 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs @@ -77,14 +77,14 @@ public ScalingPlanData(AzureLocation location, string timeZone) : base(location) /// Timezone of the scaling plan. /// HostPool type for desktop. /// Exclusion tag for scaling plan. - /// List of ScalingPlanPooledSchedule definitions. + /// List of Pooled ScalingSchedule definitions. /// List of ScalingHostPoolReference definitions. /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// Keeps track of any properties unknown to the library. internal ScalingPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string description, string friendlyName, string timeZone, ScalingHostPoolType? scalingHostPoolType, string exclusionTag, IList schedules, IList hostPoolReferences, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -128,7 +128,7 @@ internal ScalingPlanData() /// Exclusion tag for scaling plan. [WirePath("properties.exclusionTag")] public string ExclusionTag { get; set; } - /// List of ScalingPlanPooledSchedule definitions. + /// List of Pooled ScalingSchedule definitions. [WirePath("properties.schedules")] public IList Schedules { get; } /// List of ScalingHostPoolReference definitions. @@ -143,13 +143,13 @@ internal ScalingPlanData() /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. [WirePath("etag")] public ETag? ETag { get; } - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } /// The resource model definition representing SKU. [WirePath("sku")] public DesktopVirtualizationSku Sku { get; set; } - /// Gets or sets the plan. + /// Plan for the resource. [WirePath("plan")] public ArmPlan Plan { get; set; } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleCollection.cs index 68505be93e0a..8e6897589a97 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Cre /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string scalingP /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(in /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSiz /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string scalingPlanSchedule /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string scalingPlanScheduleName, Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.Serialization.cs index bef66f25ac20..a166e82b2c9b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.Serialization.cs @@ -41,21 +41,15 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsCollectionDefined(DaysOfWeek)) + writer.WritePropertyName("daysOfWeek"u8); + writer.WriteStartArray(); + foreach (var item in DaysOfWeek) { - writer.WritePropertyName("daysOfWeek"u8); - writer.WriteStartArray(); - foreach (var item in DaysOfWeek) - { - writer.WriteStringValue(item.ToSerialString()); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(RampUpStartTime)) - { - writer.WritePropertyName("rampUpStartTime"u8); - writer.WriteObjectValue(RampUpStartTime, options); + writer.WriteStringValue(item.ToSerialString()); } + writer.WriteEndArray(); + writer.WritePropertyName("rampUpStartTime"u8); + writer.WriteObjectValue(RampUpStartTime, options); if (Optional.IsDefined(RampUpAutoStartHosts)) { writer.WritePropertyName("rampUpAutoStartHosts"u8); @@ -86,11 +80,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("rampUpMinutesToWaitOnLogoff"u8); writer.WriteNumberValue(RampUpMinutesToWaitOnLogoff.Value); } - if (Optional.IsDefined(PeakStartTime)) - { - writer.WritePropertyName("peakStartTime"u8); - writer.WriteObjectValue(PeakStartTime, options); - } + writer.WritePropertyName("peakStartTime"u8); + writer.WriteObjectValue(PeakStartTime, options); if (Optional.IsDefined(PeakStartVmOnConnect)) { writer.WritePropertyName("peakStartVMOnConnect"u8); @@ -116,11 +107,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("peakMinutesToWaitOnLogoff"u8); writer.WriteNumberValue(PeakMinutesToWaitOnLogoff.Value); } - if (Optional.IsDefined(RampDownStartTime)) - { - writer.WritePropertyName("rampDownStartTime"u8); - writer.WriteObjectValue(RampDownStartTime, options); - } + writer.WritePropertyName("rampDownStartTime"u8); + writer.WriteObjectValue(RampDownStartTime, options); if (Optional.IsDefined(RampDownStartVmOnConnect)) { writer.WritePropertyName("rampDownStartVMOnConnect"u8); @@ -146,11 +134,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("rampDownMinutesToWaitOnLogoff"u8); writer.WriteNumberValue(RampDownMinutesToWaitOnLogoff.Value); } - if (Optional.IsDefined(OffPeakStartTime)) - { - writer.WritePropertyName("offPeakStartTime"u8); - writer.WriteObjectValue(OffPeakStartTime, options); - } + writer.WritePropertyName("offPeakStartTime"u8); + writer.WriteObjectValue(OffPeakStartTime, options); if (Optional.IsDefined(OffPeakStartVmOnConnect)) { writer.WritePropertyName("offPeakStartVMOnConnect"u8); @@ -268,10 +253,6 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc { if (property0.NameEquals("daysOfWeek"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { @@ -282,10 +263,6 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc } if (property0.NameEquals("rampUpStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -345,10 +322,6 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc } if (property0.NameEquals("peakStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } peakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -399,10 +372,6 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc } if (property0.NameEquals("rampDownStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -453,10 +422,6 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc } if (property0.NameEquals("offPeakStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -519,7 +484,7 @@ internal static ScalingPlanPersonalScheduleData DeserializeScalingPlanPersonalSc name, type, systemData, - daysOfWeek ?? new ChangeTrackingList(), + daysOfWeek, rampUpStartTime, rampUpAutoStartHosts, rampUpStartVmOnConnect, diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.cs index 761dd707af80..423213f0ed3c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleData.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Core; using Azure.ResourceManager.DesktopVirtualization.Models; using Azure.ResourceManager.Models; @@ -52,9 +53,25 @@ public partial class ScalingPlanPersonalScheduleData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ScalingPlanPersonalScheduleData() + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// Starting time for peak period. + /// Starting time for ramp down period. + /// Starting time for off-peak period. + /// , , , or is null. + public ScalingPlanPersonalScheduleData(IEnumerable daysOfWeek, ScalingActionTime rampUpStartTime, ScalingActionTime peakStartTime, ScalingActionTime rampDownStartTime, ScalingActionTime offPeakStartTime) { - DaysOfWeek = new ChangeTrackingList(); + Argument.AssertNotNull(daysOfWeek, nameof(daysOfWeek)); + Argument.AssertNotNull(rampUpStartTime, nameof(rampUpStartTime)); + Argument.AssertNotNull(peakStartTime, nameof(peakStartTime)); + Argument.AssertNotNull(rampDownStartTime, nameof(rampDownStartTime)); + Argument.AssertNotNull(offPeakStartTime, nameof(offPeakStartTime)); + + DaysOfWeek = daysOfWeek.ToList(); + RampUpStartTime = rampUpStartTime; + PeakStartTime = peakStartTime; + RampDownStartTime = rampDownStartTime; + OffPeakStartTime = offPeakStartTime; } /// Initializes a new instance of . @@ -120,6 +137,11 @@ internal ScalingPlanPersonalScheduleData(ResourceIdentifier id, string name, Res _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Initializes a new instance of for deserialization. + internal ScalingPlanPersonalScheduleData() + { + } + /// Set of days of the week on which this schedule is active. [WirePath("properties.daysOfWeek")] public IList DaysOfWeek { get; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs index 4b281661f966..bddbb54a26ca 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationTok /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs index d05cbd661d11..00c6c0b294ce 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string scalingPla /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string scalingPlanSchedule /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string scalingPlanScheduleName, Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs index 7e530bd60923..a4e263b2747b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs @@ -41,21 +41,37 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsCollectionDefined(DaysOfWeek)) + if (options.Format != "W" && Optional.IsDefined(NamePropertiesName)) { - writer.WritePropertyName("daysOfWeek"u8); - writer.WriteStartArray(); - foreach (var item in DaysOfWeek) - { - writer.WriteStringValue(item.ToSerialString()); - } - writer.WriteEndArray(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(NamePropertiesName); + } + writer.WritePropertyName("daysOfWeek"u8); + writer.WriteStartArray(); + foreach (var item in DaysOfWeek) + { + writer.WriteStringValue(item.ToSerialString()); } - if (Optional.IsDefined(RampUpStartTime)) + writer.WriteEndArray(); + if (Optional.IsDefined(ScalingMethod)) { - writer.WritePropertyName("rampUpStartTime"u8); - writer.WriteObjectValue(RampUpStartTime, options); + writer.WritePropertyName("scalingMethod"u8); + writer.WriteStringValue(ScalingMethod.Value.ToString()); } + if (Optional.IsDefined(CreateDelete)) + { + if (CreateDelete != null) + { + writer.WritePropertyName("createDelete"u8); + writer.WriteObjectValue(CreateDelete, options); + } + else + { + writer.WriteNull("createDelete"); + } + } + writer.WritePropertyName("rampUpStartTime"u8); + writer.WriteObjectValue(RampUpStartTime, options); if (Optional.IsDefined(RampUpLoadBalancingAlgorithm)) { writer.WritePropertyName("rampUpLoadBalancingAlgorithm"u8); @@ -66,26 +82,17 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("rampUpMinimumHostsPct"u8); writer.WriteNumberValue(RampUpMinimumHostsPct.Value); } - if (Optional.IsDefined(RampUpCapacityThresholdPct)) - { - writer.WritePropertyName("rampUpCapacityThresholdPct"u8); - writer.WriteNumberValue(RampUpCapacityThresholdPct.Value); - } - if (Optional.IsDefined(PeakStartTime)) - { - writer.WritePropertyName("peakStartTime"u8); - writer.WriteObjectValue(PeakStartTime, options); - } + writer.WritePropertyName("rampUpCapacityThresholdPct"u8); + writer.WriteNumberValue(RampUpCapacityThresholdPct); + writer.WritePropertyName("peakStartTime"u8); + writer.WriteObjectValue(PeakStartTime, options); if (Optional.IsDefined(PeakLoadBalancingAlgorithm)) { writer.WritePropertyName("peakLoadBalancingAlgorithm"u8); writer.WriteStringValue(PeakLoadBalancingAlgorithm.Value.ToString()); } - if (Optional.IsDefined(RampDownStartTime)) - { - writer.WritePropertyName("rampDownStartTime"u8); - writer.WriteObjectValue(RampDownStartTime, options); - } + writer.WritePropertyName("rampDownStartTime"u8); + writer.WriteObjectValue(RampDownStartTime, options); if (Optional.IsDefined(RampDownLoadBalancingAlgorithm)) { writer.WritePropertyName("rampDownLoadBalancingAlgorithm"u8); @@ -96,11 +103,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("rampDownMinimumHostsPct"u8); writer.WriteNumberValue(RampDownMinimumHostsPct.Value); } - if (Optional.IsDefined(RampDownCapacityThresholdPct)) - { - writer.WritePropertyName("rampDownCapacityThresholdPct"u8); - writer.WriteNumberValue(RampDownCapacityThresholdPct.Value); - } + writer.WritePropertyName("rampDownCapacityThresholdPct"u8); + writer.WriteNumberValue(RampDownCapacityThresholdPct); if (Optional.IsDefined(RampDownForceLogoffUsers)) { writer.WritePropertyName("rampDownForceLogoffUsers"u8); @@ -121,11 +125,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("rampDownNotificationMessage"u8); writer.WriteStringValue(RampDownNotificationMessage); } - if (Optional.IsDefined(OffPeakStartTime)) - { - writer.WritePropertyName("offPeakStartTime"u8); - writer.WriteObjectValue(OffPeakStartTime, options); - } + writer.WritePropertyName("offPeakStartTime"u8); + writer.WriteObjectValue(OffPeakStartTime, options); if (Optional.IsDefined(OffPeakLoadBalancingAlgorithm)) { writer.WritePropertyName("offPeakLoadBalancingAlgorithm"u8); @@ -158,17 +159,20 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu string name = default; ResourceType type = default; SystemData systemData = default; + string name0 = default; IList daysOfWeek = default; + ScalingMethod? scalingMethod = default; + CreateDeleteProperties createDelete = default; ScalingActionTime rampUpStartTime = default; SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; int? rampUpMinimumHostsPct = default; - int? rampUpCapacityThresholdPct = default; + int rampUpCapacityThresholdPct = default; ScalingActionTime peakStartTime = default; SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = default; ScalingActionTime rampDownStartTime = default; SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = default; int? rampDownMinimumHostsPct = default; - int? rampDownCapacityThresholdPct = default; + int rampDownCapacityThresholdPct = default; bool? rampDownForceLogoffUsers = default; DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = default; int? rampDownWaitTimeMinutes = default; @@ -212,12 +216,13 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("name"u8)) + { + name0 = property0.Value.GetString(); + continue; + } if (property0.NameEquals("daysOfWeek"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { @@ -226,12 +231,27 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu daysOfWeek = array; continue; } - if (property0.NameEquals("rampUpStartTime"u8)) + if (property0.NameEquals("scalingMethod"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } + scalingMethod = new ScalingMethod(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("createDelete"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + createDelete = null; + continue; + } + createDelete = CreateDeleteProperties.DeserializeCreateDeleteProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("rampUpStartTime"u8)) + { rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -255,19 +275,11 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu } if (property0.NameEquals("rampUpCapacityThresholdPct"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } rampUpCapacityThresholdPct = property0.Value.GetInt32(); continue; } if (property0.NameEquals("peakStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } peakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -282,10 +294,6 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu } if (property0.NameEquals("rampDownStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -309,10 +317,6 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu } if (property0.NameEquals("rampDownCapacityThresholdPct"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } rampDownCapacityThresholdPct = property0.Value.GetInt32(); continue; } @@ -350,10 +354,6 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu } if (property0.NameEquals("offPeakStartTime"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); continue; } @@ -380,7 +380,10 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu name, type, systemData, - daysOfWeek ?? new ChangeTrackingList(), + name0, + daysOfWeek, + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -466,6 +469,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NamePropertiesName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NamePropertiesName)) + { + builder.Append(" name: "); + if (NamePropertiesName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NamePropertiesName}'''"); + } + else + { + builder.AppendLine($"'{NamePropertiesName}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaysOfWeek), out propertyOverride); if (hasPropertyOverride) { @@ -489,6 +515,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScalingMethod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scalingMethod: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScalingMethod)) + { + builder.Append(" scalingMethod: "); + builder.AppendLine($"'{ScalingMethod.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateDelete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" createDelete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CreateDelete)) + { + builder.Append(" createDelete: "); + BicepSerializationHelpers.AppendChildObject(builder, CreateDelete, options, 4, false, " createDelete: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpStartTime), out propertyOverride); if (hasPropertyOverride) { @@ -542,11 +598,8 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } else { - if (Optional.IsDefined(RampUpCapacityThresholdPct)) - { - builder.Append(" rampUpCapacityThresholdPct: "); - builder.AppendLine($"{RampUpCapacityThresholdPct.Value}"); - } + builder.Append(" rampUpCapacityThresholdPct: "); + builder.AppendLine($"{RampUpCapacityThresholdPct}"); } hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PeakStartTime), out propertyOverride); @@ -632,11 +685,8 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } else { - if (Optional.IsDefined(RampDownCapacityThresholdPct)) - { - builder.Append(" rampDownCapacityThresholdPct: "); - builder.AppendLine($"{RampDownCapacityThresholdPct.Value}"); - } + builder.Append(" rampDownCapacityThresholdPct: "); + builder.AppendLine($"{RampDownCapacityThresholdPct}"); } hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownForceLogoffUsers), out propertyOverride); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs index 8fb91ded38fd..f0d31be9dcf9 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Core; using Azure.ResourceManager.DesktopVirtualization.Models; using Azure.ResourceManager.Models; @@ -52,9 +53,29 @@ public partial class ScalingPlanPooledScheduleData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public ScalingPlanPooledScheduleData() + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// Capacity threshold for ramp up period. + /// Starting time for peak period. + /// Starting time for ramp down period. + /// Capacity threshold for ramp down period. + /// Starting time for off-peak period. + /// , , , or is null. + public ScalingPlanPooledScheduleData(IEnumerable daysOfWeek, ScalingActionTime rampUpStartTime, int rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, ScalingActionTime rampDownStartTime, int rampDownCapacityThresholdPct, ScalingActionTime offPeakStartTime) { - DaysOfWeek = new ChangeTrackingList(); + Argument.AssertNotNull(daysOfWeek, nameof(daysOfWeek)); + Argument.AssertNotNull(rampUpStartTime, nameof(rampUpStartTime)); + Argument.AssertNotNull(peakStartTime, nameof(peakStartTime)); + Argument.AssertNotNull(rampDownStartTime, nameof(rampDownStartTime)); + Argument.AssertNotNull(offPeakStartTime, nameof(offPeakStartTime)); + + DaysOfWeek = daysOfWeek.ToList(); + RampUpStartTime = rampUpStartTime; + RampUpCapacityThresholdPct = rampUpCapacityThresholdPct; + PeakStartTime = peakStartTime; + RampDownStartTime = rampDownStartTime; + RampDownCapacityThresholdPct = rampDownCapacityThresholdPct; + OffPeakStartTime = offPeakStartTime; } /// Initializes a new instance of . @@ -62,7 +83,10 @@ public ScalingPlanPooledScheduleData() /// The name. /// The resourceType. /// The systemData. + /// Name of the ScalingPlanPooledSchedule. /// Set of days of the week on which this schedule is active. + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. /// Starting time for ramp up period. /// Load balancing algorithm for ramp up period. /// Minimum host percentage for ramp up period. @@ -80,9 +104,12 @@ public ScalingPlanPooledScheduleData() /// Starting time for off-peak period. /// Load balancing algorithm for off-peak period. /// Keeps track of any properties unknown to the library. - internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList daysOfWeek, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int? rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int? rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string namePropertiesName, IList daysOfWeek, ScalingMethod? scalingMethod, CreateDeleteProperties createDelete, ScalingActionTime rampUpStartTime, SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm, int? rampUpMinimumHostsPct, int rampUpCapacityThresholdPct, ScalingActionTime peakStartTime, SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm, ScalingActionTime rampDownStartTime, SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm, int? rampDownMinimumHostsPct, int rampDownCapacityThresholdPct, bool? rampDownForceLogoffUsers, DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen, int? rampDownWaitTimeMinutes, string rampDownNotificationMessage, ScalingActionTime offPeakStartTime, SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + NamePropertiesName = namePropertiesName; DaysOfWeek = daysOfWeek; + ScalingMethod = scalingMethod; + CreateDelete = createDelete; RampUpStartTime = rampUpStartTime; RampUpLoadBalancingAlgorithm = rampUpLoadBalancingAlgorithm; RampUpMinimumHostsPct = rampUpMinimumHostsPct; @@ -102,9 +129,23 @@ internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, Resou _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Initializes a new instance of for deserialization. + internal ScalingPlanPooledScheduleData() + { + } + + /// Name of the ScalingPlanPooledSchedule. + [WirePath("properties.name")] + public string NamePropertiesName { get; } /// Set of days of the week on which this schedule is active. [WirePath("properties.daysOfWeek")] public IList DaysOfWeek { get; } + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + [WirePath("properties.scalingMethod")] + public ScalingMethod? ScalingMethod { get; set; } + /// The properties that control how Scaling will manage the size of the hostpool by creating and deleting hosts. + [WirePath("properties.createDelete")] + public CreateDeleteProperties CreateDelete { get; set; } /// Starting time for ramp up period. [WirePath("properties.rampUpStartTime")] public ScalingActionTime RampUpStartTime { get; set; } @@ -116,7 +157,7 @@ internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, Resou public int? RampUpMinimumHostsPct { get; set; } /// Capacity threshold for ramp up period. [WirePath("properties.rampUpCapacityThresholdPct")] - public int? RampUpCapacityThresholdPct { get; set; } + public int RampUpCapacityThresholdPct { get; set; } /// Starting time for peak period. [WirePath("properties.peakStartTime")] public ScalingActionTime PeakStartTime { get; set; } @@ -134,7 +175,7 @@ internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, Resou public int? RampDownMinimumHostsPct { get; set; } /// Capacity threshold for ramp down period. [WirePath("properties.rampDownCapacityThresholdPct")] - public int? RampDownCapacityThresholdPct { get; set; } + public int RampDownCapacityThresholdPct { get; set; } /// Should users be logged off forcefully from hosts. [WirePath("properties.rampDownForceLogoffUsers")] public bool? RampDownForceLogoffUsers { get; set; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs index b18eecd4a47e..c959986b1f4c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs index 71ccaf7c9ef1..cd865c4c1eb8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs @@ -110,7 +110,7 @@ public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetScalin /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -179,7 +179,7 @@ public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSched /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -210,7 +210,7 @@ public virtual async Task> GetScal /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -241,7 +241,7 @@ public virtual Response GetScalingPlanPerso /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -281,7 +281,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -321,7 +321,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -451,7 +451,7 @@ public virtual async Task> UpdateAsync(ScalingPlan /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -493,7 +493,7 @@ public virtual Response Update(ScalingPlanPatch patch, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -555,7 +555,7 @@ public virtual async Task> AddTagAsync(string key, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -617,7 +617,7 @@ public virtual Response AddTag(string key, string value, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -674,7 +674,7 @@ public virtual async Task> SetTagsAsync(IDictionar /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -731,7 +731,7 @@ public virtual Response SetTags(IDictionary /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -791,7 +791,7 @@ public virtual async Task> RemoveTagAsync(string k /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs index bb2398815538..76ab4c23864b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string session /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string sessionHostName, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -165,12 +165,13 @@ public virtual Response Get(string sessionHostName, Cancell /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetAllAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _sessionHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sessionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage FirstPageRequest(int? pageSizeHint) => _sessionHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip, vmPath); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sessionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip, vmPath); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SessionHostResource(Client, SessionHostData.DeserializeSessionHostData(e)), _sessionHostClientDiagnostics, Pipeline, "SessionHostCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -187,7 +188,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -198,12 +199,13 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. + /// The path to the VM. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, string vmPath = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _sessionHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sessionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage FirstPageRequest(int? pageSizeHint) => _sessionHostRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip, vmPath); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sessionHostRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip, vmPath); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SessionHostResource(Client, SessionHostData.DeserializeSessionHostData(e)), _sessionHostClientDiagnostics, Pipeline, "SessionHostCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -220,7 +222,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -263,7 +265,7 @@ public virtual async Task> ExistsAsync(string sessionHostName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -306,7 +308,7 @@ public virtual Response Exists(string sessionHostName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +353,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.Serialization.cs new file mode 100644 index 000000000000..411af13ceee6 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.Serialization.cs @@ -0,0 +1,787 @@ +// 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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class SessionHostConfigurationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostConfigurationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version.Value, "O"); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsCollectionDefined(VmTags)) + { + writer.WritePropertyName("vmTags"u8); + writer.WriteStartObject(); + foreach (var item in VmTags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(VmLocation)) + { + writer.WritePropertyName("vmLocation"u8); + writer.WriteStringValue(VmLocation); + } + if (Optional.IsDefined(VmResourceGroup)) + { + writer.WritePropertyName("vmResourceGroup"u8); + writer.WriteStringValue(VmResourceGroup); + } + writer.WritePropertyName("vmNamePrefix"u8); + writer.WriteStringValue(VmNamePrefix); + if (Optional.IsCollectionDefined(AvailabilityZones)) + { + writer.WritePropertyName("availabilityZones"u8); + writer.WriteStartArray(); + foreach (var item in AvailabilityZones) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("networkInfo"u8); + writer.WriteObjectValue(NetworkInfo, options); + writer.WritePropertyName("vmSizeId"u8); + writer.WriteStringValue(VmSizeId); + writer.WritePropertyName("diskInfo"u8); + writer.WriteObjectValue(DiskInfo, options); + if (Optional.IsDefined(CustomConfigurationScriptUri)) + { + writer.WritePropertyName("customConfigurationScriptUrl"u8); + writer.WriteStringValue(CustomConfigurationScriptUri.AbsoluteUri); + } + writer.WritePropertyName("imageInfo"u8); + writer.WriteObjectValue(ImageInfo, options); + writer.WritePropertyName("domainInfo"u8); + writer.WriteObjectValue(DomainInfo, options); + if (Optional.IsDefined(SecurityInfo)) + { + writer.WritePropertyName("securityInfo"u8); + writer.WriteObjectValue(SecurityInfo, options); + } + writer.WritePropertyName("vmAdminCredentials"u8); + writer.WriteObjectValue(VmAdminCredentials, options); + if (Optional.IsDefined(BootDiagnosticsInfo)) + { + writer.WritePropertyName("bootDiagnosticsInfo"u8); + writer.WriteObjectValue(BootDiagnosticsInfo, options); + } + writer.WriteEndObject(); + } + + SessionHostConfigurationData 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(SessionHostConfigurationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostConfigurationData(document.RootElement, options); + } + + internal static SessionHostConfigurationData DeserializeSessionHostConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + DateTimeOffset? version = default; + string friendlyName = default; + ProvisioningStateSHC? provisioningState = default; + IDictionary vmTags = default; + string vmLocation = default; + string vmResourceGroup = default; + string vmNamePrefix = default; + IList availabilityZones = default; + NetworkInfoProperties networkInfo = default; + string vmSizeId = default; + DiskInfoProperties diskInfo = default; + Uri customConfigurationScriptUrl = default; + ImageInfoProperties imageInfo = default; + DomainInfoProperties domainInfo = default; + SecurityInfoProperties securityInfo = default; + KeyVaultCredentialsProperties vmAdminCredentials = default; + BootDiagnosticsInfoProperties bootDiagnosticsInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("version"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("friendlyName"u8)) + { + friendlyName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningStateSHC(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("vmTags"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + vmTags = dictionary; + continue; + } + if (property0.NameEquals("vmLocation"u8)) + { + vmLocation = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmResourceGroup"u8)) + { + vmResourceGroup = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmNamePrefix"u8)) + { + vmNamePrefix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("availabilityZones"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + availabilityZones = array; + continue; + } + if (property0.NameEquals("networkInfo"u8)) + { + networkInfo = NetworkInfoProperties.DeserializeNetworkInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmSizeId"u8)) + { + vmSizeId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("diskInfo"u8)) + { + diskInfo = DiskInfoProperties.DeserializeDiskInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("customConfigurationScriptUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customConfigurationScriptUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("imageInfo"u8)) + { + imageInfo = ImageInfoProperties.DeserializeImageInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("domainInfo"u8)) + { + domainInfo = DomainInfoProperties.DeserializeDomainInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("securityInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityInfo = SecurityInfoProperties.DeserializeSecurityInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("vmAdminCredentials"u8)) + { + vmAdminCredentials = KeyVaultCredentialsProperties.DeserializeKeyVaultCredentialsProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("bootDiagnosticsInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootDiagnosticsInfo = BootDiagnosticsInfoProperties.DeserializeBootDiagnosticsInfoProperties(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationData( + id, + name, + type, + systemData, + version, + friendlyName, + provisioningState, + vmTags ?? new ChangeTrackingDictionary(), + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones ?? new ChangeTrackingList(), + networkInfo, + vmSizeId, + diskInfo, + customConfigurationScriptUrl, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + var formattedDateTimeString = TypeFormatters.ToString(Version.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FriendlyName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" friendlyName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FriendlyName)) + { + builder.Append(" friendlyName: "); + if (FriendlyName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FriendlyName}'''"); + } + else + { + builder.AppendLine($"'{FriendlyName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmTags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmTags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VmTags)) + { + if (VmTags.Any()) + { + builder.Append(" vmTags: "); + builder.AppendLine("{"); + foreach (var item in VmTags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmLocation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmLocation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmLocation)) + { + builder.Append(" vmLocation: "); + if (VmLocation.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmLocation}'''"); + } + else + { + builder.AppendLine($"'{VmLocation}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmResourceGroup), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmResourceGroup: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmResourceGroup)) + { + builder.Append(" vmResourceGroup: "); + if (VmResourceGroup.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmResourceGroup}'''"); + } + else + { + builder.AppendLine($"'{VmResourceGroup}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmNamePrefix), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmNamePrefix: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmNamePrefix)) + { + builder.Append(" vmNamePrefix: "); + if (VmNamePrefix.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmNamePrefix}'''"); + } + else + { + builder.AppendLine($"'{VmNamePrefix}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailabilityZones), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availabilityZones: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AvailabilityZones)) + { + if (AvailabilityZones.Any()) + { + builder.Append(" availabilityZones: "); + builder.AppendLine("["); + foreach (var item in AvailabilityZones) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkInfo)) + { + builder.Append(" networkInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkInfo, options, 4, false, " networkInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSizeId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmSizeId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmSizeId)) + { + builder.Append(" vmSizeId: "); + if (VmSizeId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmSizeId}'''"); + } + else + { + builder.AppendLine($"'{VmSizeId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiskInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diskInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DiskInfo)) + { + builder.Append(" diskInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, DiskInfo, options, 4, false, " diskInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomConfigurationScriptUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customConfigurationScriptUrl: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomConfigurationScriptUri)) + { + builder.Append(" customConfigurationScriptUrl: "); + builder.AppendLine($"'{CustomConfigurationScriptUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" imageInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ImageInfo)) + { + builder.Append(" imageInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, ImageInfo, options, 4, false, " imageInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DomainInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" domainInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DomainInfo)) + { + builder.Append(" domainInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, DomainInfo, options, 4, false, " domainInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecurityInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" securityInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecurityInfo)) + { + builder.Append(" securityInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, SecurityInfo, options, 4, false, " securityInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmAdminCredentials), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmAdminCredentials: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmAdminCredentials)) + { + builder.Append(" vmAdminCredentials: "); + BicepSerializationHelpers.AppendChildObject(builder, VmAdminCredentials, options, 4, false, " vmAdminCredentials: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BootDiagnosticsInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bootDiagnosticsInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BootDiagnosticsInfo)) + { + builder.Append(" bootDiagnosticsInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, BootDiagnosticsInfo, options, 4, false, " bootDiagnosticsInfo: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationData)} does not support writing '{options.Format}' format."); + } + } + + SessionHostConfigurationData 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostConfigurationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.cs new file mode 100644 index 000000000000..1eaeb4372f3e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A class representing the SessionHostConfiguration data model. + /// Represents a SessionHostConfiguration definition. + /// + public partial class SessionHostConfigurationData : ResourceData + { + /// + /// 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 . + /// The prefix that should be associated with session host names. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Local Admin credentials for session hosts. + /// , , , , , or is null. + public SessionHostConfigurationData(string vmNamePrefix, NetworkInfoProperties networkInfo, string vmSizeId, DiskInfoProperties diskInfo, ImageInfoProperties imageInfo, DomainInfoProperties domainInfo, KeyVaultCredentialsProperties vmAdminCredentials) + { + Argument.AssertNotNull(vmNamePrefix, nameof(vmNamePrefix)); + Argument.AssertNotNull(networkInfo, nameof(networkInfo)); + Argument.AssertNotNull(vmSizeId, nameof(vmSizeId)); + Argument.AssertNotNull(diskInfo, nameof(diskInfo)); + Argument.AssertNotNull(imageInfo, nameof(imageInfo)); + Argument.AssertNotNull(domainInfo, nameof(domainInfo)); + Argument.AssertNotNull(vmAdminCredentials, nameof(vmAdminCredentials)); + + VmTags = new ChangeTrackingDictionary(); + VmNamePrefix = vmNamePrefix; + AvailabilityZones = new ChangeTrackingList(); + NetworkInfo = networkInfo; + VmSizeId = vmSizeId; + DiskInfo = diskInfo; + ImageInfo = imageInfo; + DomainInfo = domainInfo; + VmAdminCredentials = vmAdminCredentials; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The timestamp of the last update. + /// Friendly name to describe this version of the SessionHostConfiguration. + /// Provisioning state of the Session Host Configuration. + /// Hashtable that lists key/value pair tags to apply to the VMs. + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + /// The prefix that should be associated with session host names. + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + /// Network information. + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + /// Disk information. + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + /// Image configurations of HostPool. + /// Domain configurations of session hosts. + /// Security information. + /// Local Admin credentials for session hosts. + /// Boot Diagnostics information. + /// Keeps track of any properties unknown to the library. + internal SessionHostConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? version, string friendlyName, ProvisioningStateSHC? provisioningState, IDictionary vmTags, string vmLocation, string vmResourceGroup, string vmNamePrefix, IList availabilityZones, NetworkInfoProperties networkInfo, string vmSizeId, DiskInfoProperties diskInfo, Uri customConfigurationScriptUri, ImageInfoProperties imageInfo, DomainInfoProperties domainInfo, SecurityInfoProperties securityInfo, KeyVaultCredentialsProperties vmAdminCredentials, BootDiagnosticsInfoProperties bootDiagnosticsInfo, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Version = version; + FriendlyName = friendlyName; + ProvisioningState = provisioningState; + VmTags = vmTags; + VmLocation = vmLocation; + VmResourceGroup = vmResourceGroup; + VmNamePrefix = vmNamePrefix; + AvailabilityZones = availabilityZones; + NetworkInfo = networkInfo; + VmSizeId = vmSizeId; + DiskInfo = diskInfo; + CustomConfigurationScriptUri = customConfigurationScriptUri; + ImageInfo = imageInfo; + DomainInfo = domainInfo; + SecurityInfo = securityInfo; + VmAdminCredentials = vmAdminCredentials; + BootDiagnosticsInfo = bootDiagnosticsInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostConfigurationData() + { + } + + /// The timestamp of the last update. + [WirePath("properties.version")] + public DateTimeOffset? Version { get; } + /// Friendly name to describe this version of the SessionHostConfiguration. + [WirePath("properties.friendlyName")] + public string FriendlyName { get; set; } + /// Provisioning state of the Session Host Configuration. + [WirePath("properties.provisioningState")] + public ProvisioningStateSHC? ProvisioningState { get; } + /// Hashtable that lists key/value pair tags to apply to the VMs. + [WirePath("properties.vmTags")] + public IDictionary VmTags { get; } + /// The Location for the session host to be created in. It will default to the location of the hostpool if not provided. + [WirePath("properties.vmLocation")] + public string VmLocation { get; set; } + /// The ResourceGroup for the session hosts to be created in. It will default to the ResourceGroup of the hostpool if not provided. + [WirePath("properties.vmResourceGroup")] + public string VmResourceGroup { get; set; } + /// The prefix that should be associated with session host names. + [WirePath("properties.vmNamePrefix")] + public string VmNamePrefix { get; set; } + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + [WirePath("properties.availabilityZones")] + public IList AvailabilityZones { get; } + /// Network information. + [WirePath("properties.networkInfo")] + public NetworkInfoProperties NetworkInfo { get; set; } + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + [WirePath("properties.vmSizeId")] + public string VmSizeId { get; set; } + /// Disk information. + [WirePath("properties.diskInfo")] + public DiskInfoProperties DiskInfo { get; set; } + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + [WirePath("properties.customConfigurationScriptUrl")] + public Uri CustomConfigurationScriptUri { get; set; } + /// Image configurations of HostPool. + [WirePath("properties.imageInfo")] + public ImageInfoProperties ImageInfo { get; set; } + /// Domain configurations of session hosts. + [WirePath("properties.domainInfo")] + public DomainInfoProperties DomainInfo { get; set; } + /// Security information. + [WirePath("properties.securityInfo")] + public SecurityInfoProperties SecurityInfo { get; set; } + /// Local Admin credentials for session hosts. + [WirePath("properties.vmAdminCredentials")] + public KeyVaultCredentialsProperties VmAdminCredentials { get; set; } + /// Boot Diagnostics information. + [WirePath("properties.bootDiagnosticsInfo")] + public BootDiagnosticsInfoProperties BootDiagnosticsInfo { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..2a9e80e72284 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class SessionHostConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SessionHostConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + SessionHostConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.cs new file mode 100644 index 000000000000..b104c4b51c07 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationResource.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A Class representing a SessionHostConfiguration along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSessionHostConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetSessionHostConfiguration method. + /// + public partial class SessionHostConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _sessionHostConfigurationClientDiagnostics; + private readonly SessionHostConfigurationsRestOperations _sessionHostConfigurationRestClient; + private readonly SessionHostConfigurationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DesktopVirtualization/hostPools/sessionHostConfigurations"; + + /// Initializes a new instance of the class for mocking. + protected SessionHostConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SessionHostConfigurationResource(ArmClient client, SessionHostConfigurationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SessionHostConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _sessionHostConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string sessionHostConfigurationApiVersion); + _sessionHostConfigurationRestClient = new SessionHostConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sessionHostConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SessionHostConfigurationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _sessionHostConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SessionHostConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.Get"); + scope.Start(); + try + { + var response = _sessionHostConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SessionHostConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_Update + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SessionHostConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.Update"); + scope.Start(); + try + { + var response = await _sessionHostConfigurationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DesktopVirtualizationArmOperation(new SessionHostConfigurationOperationSource(Client), _sessionHostConfigurationClientDiagnostics, Pipeline, _sessionHostConfigurationRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_Update + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SessionHostConfigurationPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.Update"); + scope.Start(); + try + { + var response = _sessionHostConfigurationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch, cancellationToken); + var operation = new DesktopVirtualizationArmOperation(new SessionHostConfigurationOperationSource(Client), _sessionHostConfigurationClientDiagnostics, Pipeline, _sessionHostConfigurationRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, SessionHostConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _sessionHostConfigurationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DesktopVirtualizationArmOperation(new SessionHostConfigurationOperationSource(Client), _sessionHostConfigurationClientDiagnostics, Pipeline, _sessionHostConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default + /// + /// + /// Operation Id + /// SessionHostConfigurations_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostConfiguration definitions. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, SessionHostConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sessionHostConfigurationClientDiagnostics.CreateScope("SessionHostConfigurationResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _sessionHostConfigurationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); + var operation = new DesktopVirtualizationArmOperation(new SessionHostConfigurationOperationSource(Client), _sessionHostConfigurationClientDiagnostics, Pipeline, _sessionHostConfigurationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.Serialization.cs index 16831273458f..2cbdac90eac5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.Serialization.cs @@ -41,6 +41,21 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); + if (Optional.IsDefined(ActiveSessions)) + { + writer.WritePropertyName("activeSessions"u8); + writer.WriteNumberValue(ActiveSessions.Value); + } + if (Optional.IsDefined(DisconnectedSessions)) + { + writer.WritePropertyName("disconnectedSessions"u8); + writer.WriteNumberValue(DisconnectedSessions.Value); + } + if (Optional.IsDefined(PendingSessions)) + { + writer.WritePropertyName("pendingSessions"u8); + writer.WriteNumberValue(PendingSessions.Value); + } if (options.Format != "W" && Optional.IsDefined(ObjectId)) { writer.WritePropertyName("objectId"u8); @@ -121,6 +136,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("updateErrorMessage"u8); writer.WriteStringValue(UpdateErrorMessage); } + if (options.Format != "W" && Optional.IsDefined(LastSessionHostUpdateOn)) + { + writer.WritePropertyName("lastSessionHostUpdateTime"u8); + writer.WriteStringValue(LastSessionHostUpdateOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(SessionHostConfiguration)) + { + writer.WritePropertyName("sessionHostConfiguration"u8); + writer.WriteStringValue(SessionHostConfiguration); + } if (options.Format != "W" && Optional.IsCollectionDefined(SessionHostHealthCheckResults)) { writer.WritePropertyName("sessionHostHealthCheckResults"u8); @@ -158,6 +183,9 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, string name = default; ResourceType type = default; SystemData systemData = default; + int? activeSessions = default; + int? disconnectedSessions = default; + int? pendingSessions = default; string objectId = default; DateTimeOffset? lastHeartBeat = default; int? sessions = default; @@ -174,6 +202,8 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, SessionHostUpdateState? updateState = default; DateTimeOffset? lastUpdateTime = default; string updateErrorMessage = default; + DateTimeOffset? lastSessionHostUpdateTime = default; + string sessionHostConfiguration = default; IReadOnlyList sessionHostHealthCheckResults = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -212,6 +242,33 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, } foreach (var property0 in property.Value.EnumerateObject()) { + if (property0.NameEquals("activeSessions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeSessions = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("disconnectedSessions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disconnectedSessions = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("pendingSessions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pendingSessions = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("objectId"u8)) { objectId = property0.Value.GetString(); @@ -324,6 +381,20 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, updateErrorMessage = property0.Value.GetString(); continue; } + if (property0.NameEquals("lastSessionHostUpdateTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null || property0.Value.ValueKind == JsonValueKind.String && property0.Value.GetString().Length == 0) + { + continue; + } + lastSessionHostUpdateTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("sessionHostConfiguration"u8)) + { + sessionHostConfiguration = property0.Value.GetString(); + continue; + } if (property0.NameEquals("sessionHostHealthCheckResults"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -352,6 +423,9 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, name, type, systemData, + activeSessions, + disconnectedSessions, + pendingSessions, objectId, lastHeartBeat, sessions, @@ -368,6 +442,8 @@ internal static SessionHostData DeserializeSessionHostData(JsonElement element, updateState, lastUpdateTime, updateErrorMessage, + lastSessionHostUpdateTime, + sessionHostConfiguration, sessionHostHealthCheckResults ?? new ChangeTrackingList(), serializedAdditionalRawData); } @@ -438,6 +514,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActiveSessions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" activeSessions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActiveSessions)) + { + builder.Append(" activeSessions: "); + builder.AppendLine($"{ActiveSessions.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisconnectedSessions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" disconnectedSessions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisconnectedSessions)) + { + builder.Append(" disconnectedSessions: "); + builder.AppendLine($"{DisconnectedSessions.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PendingSessions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" pendingSessions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PendingSessions)) + { + builder.Append(" pendingSessions: "); + builder.AppendLine($"{PendingSessions.Value}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); if (hasPropertyOverride) { @@ -746,6 +867,45 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastSessionHostUpdateOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastSessionHostUpdateTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastSessionHostUpdateOn)) + { + builder.Append(" lastSessionHostUpdateTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastSessionHostUpdateOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sessionHostConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SessionHostConfiguration)) + { + builder.Append(" sessionHostConfiguration: "); + if (SessionHostConfiguration.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SessionHostConfiguration}'''"); + } + else + { + builder.AppendLine($"'{SessionHostConfiguration}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SessionHostHealthCheckResults), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.cs index 564aa47c5f00..589985163359 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostData.cs @@ -62,6 +62,9 @@ public SessionHostData() /// The name. /// The resourceType. /// The systemData. + /// Number of active sessions on SessionHost. + /// Number of disconnected sessions on SessionHost. + /// Number of pending sessions on SessionHost. /// ObjectId of SessionHost. (internal use). /// Last heart beat from SessionHost. /// Number of sessions on SessionHost. @@ -78,10 +81,15 @@ public SessionHostData() /// Update state of a SessionHost. /// The timestamp of the last update. /// The error message. + /// The last time update was completed. + /// SessionHostConfiguration version reference at the time the update is initiated, in the format of date time. Example: 2024-04-26T04:56:45Z. /// List of SessionHostHealthCheckReports. /// Keeps track of any properties unknown to the library. - internal SessionHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string objectId, DateTimeOffset? lastHeartBeatOn, int? sessions, string agentVersion, bool? allowNewSession, string vmId, ResourceIdentifier resourceId, string assignedUser, string friendlyName, SessionHostStatus? status, DateTimeOffset? statusTimestamp, string osVersion, string sxsStackVersion, SessionHostUpdateState? updateState, DateTimeOffset? lastUpdatedOn, string updateErrorMessage, IReadOnlyList sessionHostHealthCheckResults, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal SessionHostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? activeSessions, int? disconnectedSessions, int? pendingSessions, string objectId, DateTimeOffset? lastHeartBeatOn, int? sessions, string agentVersion, bool? allowNewSession, string vmId, ResourceIdentifier resourceId, string assignedUser, string friendlyName, SessionHostStatus? status, DateTimeOffset? statusTimestamp, string osVersion, string sxsStackVersion, SessionHostUpdateState? updateState, DateTimeOffset? lastUpdatedOn, string updateErrorMessage, DateTimeOffset? lastSessionHostUpdateOn, string sessionHostConfiguration, IReadOnlyList sessionHostHealthCheckResults, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { + ActiveSessions = activeSessions; + DisconnectedSessions = disconnectedSessions; + PendingSessions = pendingSessions; ObjectId = objectId; LastHeartBeatOn = lastHeartBeatOn; Sessions = sessions; @@ -98,10 +106,21 @@ internal SessionHostData(ResourceIdentifier id, string name, ResourceType resour UpdateState = updateState; LastUpdatedOn = lastUpdatedOn; UpdateErrorMessage = updateErrorMessage; + LastSessionHostUpdateOn = lastSessionHostUpdateOn; + SessionHostConfiguration = sessionHostConfiguration; SessionHostHealthCheckResults = sessionHostHealthCheckResults; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Number of active sessions on SessionHost. + [WirePath("properties.activeSessions")] + public int? ActiveSessions { get; set; } + /// Number of disconnected sessions on SessionHost. + [WirePath("properties.disconnectedSessions")] + public int? DisconnectedSessions { get; set; } + /// Number of pending sessions on SessionHost. + [WirePath("properties.pendingSessions")] + public int? PendingSessions { get; set; } /// ObjectId of SessionHost. (internal use). [WirePath("properties.objectId")] public string ObjectId { get; } @@ -150,6 +169,12 @@ internal SessionHostData(ResourceIdentifier id, string name, ResourceType resour /// The error message. [WirePath("properties.updateErrorMessage")] public string UpdateErrorMessage { get; set; } + /// The last time update was completed. + [WirePath("properties.lastSessionHostUpdateTime")] + public DateTimeOffset? LastSessionHostUpdateOn { get; } + /// SessionHostConfiguration version reference at the time the update is initiated, in the format of date time. Example: 2024-04-26T04:56:45Z. + [WirePath("properties.sessionHostConfiguration")] + public string SessionHostConfiguration { get; } /// List of SessionHostHealthCheckReports. [WirePath("properties.sessionHostHealthCheckResults")] public IReadOnlyList SessionHostHealthCheckResults { get; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.Serialization.cs new file mode 100644 index 000000000000..147becb5ccbf --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.Serialization.cs @@ -0,0 +1,346 @@ +// 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; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class SessionHostManagementData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SessionHostManagementData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("scheduledDateTimeZone"u8); + writer.WriteStringValue(ScheduledDateTimeZone); + writer.WritePropertyName("update"u8); + writer.WriteObjectValue(Update, options); + if (Optional.IsDefined(Provisioning)) + { + writer.WritePropertyName("provisioning"u8); + writer.WriteObjectValue(Provisioning, options); + } + if (Optional.IsDefined(FailedSessionHostCleanupPolicy)) + { + writer.WritePropertyName("failedSessionHostCleanupPolicy"u8); + writer.WriteStringValue(FailedSessionHostCleanupPolicy.Value.ToString()); + } + writer.WriteEndObject(); + } + + SessionHostManagementData 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(SessionHostManagementData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementData(document.RootElement, options); + } + + internal static SessionHostManagementData DeserializeSessionHostManagementData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string scheduledDateTimeZone = default; + HostPoolUpdateConfigurationProperties update = default; + SessionHostProvisioningConfigurationProperties provisioning = default; + FailedSessionHostCleanupPolicySHC? failedSessionHostCleanupPolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scheduledDateTimeZone"u8)) + { + scheduledDateTimeZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("update"u8)) + { + update = HostPoolUpdateConfigurationProperties.DeserializeHostPoolUpdateConfigurationProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("provisioning"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioning = SessionHostProvisioningConfigurationProperties.DeserializeSessionHostProvisioningConfigurationProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("failedSessionHostCleanupPolicy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + failedSessionHostCleanupPolicy = new FailedSessionHostCleanupPolicySHC(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementData( + id, + name, + type, + systemData, + scheduledDateTimeZone, + update, + provisioning, + failedSessionHostCleanupPolicy, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduledDateTimeZone), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scheduledDateTimeZone: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScheduledDateTimeZone)) + { + builder.Append(" scheduledDateTimeZone: "); + if (ScheduledDateTimeZone.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ScheduledDateTimeZone}'''"); + } + else + { + builder.AppendLine($"'{ScheduledDateTimeZone}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Update), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" update: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Update)) + { + builder.Append(" update: "); + BicepSerializationHelpers.AppendChildObject(builder, Update, options, 4, false, " update: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Provisioning), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioning: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Provisioning)) + { + builder.Append(" provisioning: "); + BicepSerializationHelpers.AppendChildObject(builder, Provisioning, options, 4, false, " provisioning: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FailedSessionHostCleanupPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" failedSessionHostCleanupPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FailedSessionHostCleanupPolicy)) + { + builder.Append(" failedSessionHostCleanupPolicy: "); + builder.AppendLine($"'{FailedSessionHostCleanupPolicy.Value.ToString()}'"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + 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, AzureResourceManagerDesktopVirtualizationContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementData)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementData 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, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSessionHostManagementData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.cs new file mode 100644 index 000000000000..1e13415fa980 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DesktopVirtualization.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A class representing the SessionHostManagement data model. + /// Represents a SessionHostManagement definition. + /// + public partial class SessionHostManagementData : ResourceData + { + /// + /// 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 . + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + /// Parameters for a hostpool update. + /// or is null. + public SessionHostManagementData(string scheduledDateTimeZone, HostPoolUpdateConfigurationProperties update) + { + Argument.AssertNotNull(scheduledDateTimeZone, nameof(scheduledDateTimeZone)); + Argument.AssertNotNull(update, nameof(update)); + + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + /// Parameters for a hostpool update. + /// Parameters that apply when session hosts are provisioned. + /// The policy that should be applied when the Session Host provisioning operation fails. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scheduledDateTimeZone, HostPoolUpdateConfigurationProperties update, SessionHostProvisioningConfigurationProperties provisioning, FailedSessionHostCleanupPolicySHC? failedSessionHostCleanupPolicy, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + Provisioning = provisioning; + FailedSessionHostCleanupPolicy = failedSessionHostCleanupPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostManagementData() + { + } + + /// Time zone for sessionHostManagement operations as defined in https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set if useLocalTime is true. + [WirePath("properties.scheduledDateTimeZone")] + public string ScheduledDateTimeZone { get; set; } + /// Parameters for a hostpool update. + [WirePath("properties.update")] + public HostPoolUpdateConfigurationProperties Update { get; set; } + /// Parameters that apply when session hosts are provisioned. + [WirePath("properties.provisioning")] + public SessionHostProvisioningConfigurationProperties Provisioning { get; set; } + /// The policy that should be applied when the Session Host provisioning operation fails. + [WirePath("properties.failedSessionHostCleanupPolicy")] + public FailedSessionHostCleanupPolicySHC? FailedSessionHostCleanupPolicy { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.Serialization.cs new file mode 100644 index 000000000000..7a8709d10d8a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + public partial class SessionHostManagementResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SessionHostManagementData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + SessionHostManagementData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDesktopVirtualizationContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.cs new file mode 100644 index 000000000000..ed0fbb897ddd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.cs @@ -0,0 +1,745 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DesktopVirtualization.Models; + +namespace Azure.ResourceManager.DesktopVirtualization +{ + /// + /// A Class representing a SessionHostManagement along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSessionHostManagementResource method. + /// Otherwise you can get one from its parent resource using the GetSessionHostManagement method. + /// + public partial class SessionHostManagementResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The hostPoolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _sessionHostManagementClientDiagnostics; + private readonly SessionHostManagementsRestOperations _sessionHostManagementRestClient; + private readonly ClientDiagnostics _initiateSessionHostUpdateClientDiagnostics; + private readonly InitiateSessionHostUpdateRestOperations _initiateSessionHostUpdateRestClient; + private readonly ClientDiagnostics _controlSessionHostUpdateClientDiagnostics; + private readonly ControlSessionHostUpdateRestOperations _controlSessionHostUpdateRestClient; + private readonly ClientDiagnostics _controlSessionHostProvisioningClientDiagnostics; + private readonly ControlSessionHostProvisioningRestOperations _controlSessionHostProvisioningRestClient; + private readonly ClientDiagnostics _sessionHostManagementsUpdateStatusClientDiagnostics; + private readonly SessionHostManagementsUpdateStatusRestOperations _sessionHostManagementsUpdateStatusRestClient; + private readonly ClientDiagnostics _sessionHostProvisioningStatusesClientDiagnostics; + private readonly SessionHostProvisioningStatusesRestOperations _sessionHostProvisioningStatusesRestClient; + private readonly SessionHostManagementData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DesktopVirtualization/hostPools/sessionHostManagements"; + + /// Initializes a new instance of the class for mocking. + protected SessionHostManagementResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SessionHostManagementResource(ArmClient client, SessionHostManagementData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SessionHostManagementResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _sessionHostManagementClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string sessionHostManagementApiVersion); + _sessionHostManagementRestClient = new SessionHostManagementsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sessionHostManagementApiVersion); + _initiateSessionHostUpdateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _initiateSessionHostUpdateRestClient = new InitiateSessionHostUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _controlSessionHostUpdateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _controlSessionHostUpdateRestClient = new ControlSessionHostUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _controlSessionHostProvisioningClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _controlSessionHostProvisioningRestClient = new ControlSessionHostProvisioningRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _sessionHostManagementsUpdateStatusClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _sessionHostManagementsUpdateStatusRestClient = new SessionHostManagementsUpdateStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _sessionHostProvisioningStatusesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _sessionHostProvisioningStatusesRestClient = new SessionHostProvisioningStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SessionHostManagementData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.Get"); + scope.Start(); + try + { + var response = await _sessionHostManagementRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SessionHostManagementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.Get"); + scope.Start(); + try + { + var response = _sessionHostManagementRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SessionHostManagementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_Update + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(SessionHostManagementPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.Update"); + scope.Start(); + try + { + var response = await _sessionHostManagementRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SessionHostManagementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_Update + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// is null. + public virtual Response Update(SessionHostManagementPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.Update"); + scope.Start(); + try + { + var response = _sessionHostManagementRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, patch, cancellationToken); + return Response.FromValue(new SessionHostManagementResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, SessionHostManagementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _sessionHostManagementRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _sessionHostManagementRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new SessionHostManagementResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SessionHostManagement. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default + /// + /// + /// Operation Id + /// SessionHostManagements_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Object containing SessionHostManagement definitions. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, SessionHostManagementData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sessionHostManagementClientDiagnostics.CreateScope("SessionHostManagementResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _sessionHostManagementRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); + var uri = _sessionHostManagementRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new SessionHostManagementResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Initiates a hostpool update or schedule an update for the future. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate + /// + /// + /// Operation Id + /// InitiateSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// Object containing the definition for properties to be used in the sessionHostUpdate validation. + /// The cancellation token to use. + public virtual async Task PostInitiateSessionHostUpdateAsync(UpdateSessionHostsRequestBody updateSessionHostsRequestBody = null, CancellationToken cancellationToken = default) + { + using var scope = _initiateSessionHostUpdateClientDiagnostics.CreateScope("SessionHostManagementResource.PostInitiateSessionHostUpdate"); + scope.Start(); + try + { + var response = await _initiateSessionHostUpdateRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, updateSessionHostsRequestBody, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Initiates a hostpool update or schedule an update for the future. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate + /// + /// + /// Operation Id + /// InitiateSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// Object containing the definition for properties to be used in the sessionHostUpdate validation. + /// The cancellation token to use. + public virtual Response PostInitiateSessionHostUpdate(UpdateSessionHostsRequestBody updateSessionHostsRequestBody = null, CancellationToken cancellationToken = default) + { + using var scope = _initiateSessionHostUpdateClientDiagnostics.CreateScope("SessionHostManagementResource.PostInitiateSessionHostUpdate"); + scope.Start(); + try + { + var response = _initiateSessionHostUpdateRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, updateSessionHostsRequestBody, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Control update of a hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate + /// + /// + /// Operation Id + /// ControlSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// 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. + /// Object containing control action for hostpool update. + /// The cancellation token to use. + /// is null. + public virtual async Task PostControlSessionHostUpdateAsync(WaitUntil waitUntil, HostPoolUpdateControlParameter hostPoolUpdateControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(hostPoolUpdateControlParameter, nameof(hostPoolUpdateControlParameter)); + + using var scope = _controlSessionHostUpdateClientDiagnostics.CreateScope("SessionHostManagementResource.PostControlSessionHostUpdate"); + scope.Start(); + try + { + var response = await _controlSessionHostUpdateRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolUpdateControlParameter, cancellationToken).ConfigureAwait(false); + var operation = new DesktopVirtualizationArmOperation(_controlSessionHostUpdateClientDiagnostics, Pipeline, _controlSessionHostUpdateRestClient.CreatePostRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolUpdateControlParameter).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Control update of a hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate + /// + /// + /// Operation Id + /// ControlSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// 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. + /// Object containing control action for hostpool update. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation PostControlSessionHostUpdate(WaitUntil waitUntil, HostPoolUpdateControlParameter hostPoolUpdateControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(hostPoolUpdateControlParameter, nameof(hostPoolUpdateControlParameter)); + + using var scope = _controlSessionHostUpdateClientDiagnostics.CreateScope("SessionHostManagementResource.PostControlSessionHostUpdate"); + scope.Start(); + try + { + var response = _controlSessionHostUpdateRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolUpdateControlParameter, cancellationToken); + var operation = new DesktopVirtualizationArmOperation(_controlSessionHostUpdateClientDiagnostics, Pipeline, _controlSessionHostUpdateRestClient.CreatePostRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolUpdateControlParameter).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Control provisioning of a hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostProvisioning + /// + /// + /// Operation Id + /// ControlSessionHostProvisioning_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// 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. + /// Object containing control action for hostpool provisioning. + /// The cancellation token to use. + /// is null. + public virtual async Task PostControlSessionHostProvisioningAsync(WaitUntil waitUntil, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(hostPoolProvisioningControlParameter, nameof(hostPoolProvisioningControlParameter)); + + using var scope = _controlSessionHostProvisioningClientDiagnostics.CreateScope("SessionHostManagementResource.PostControlSessionHostProvisioning"); + scope.Start(); + try + { + var response = await _controlSessionHostProvisioningRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolProvisioningControlParameter, cancellationToken).ConfigureAwait(false); + var operation = new DesktopVirtualizationArmOperation(_controlSessionHostProvisioningClientDiagnostics, Pipeline, _controlSessionHostProvisioningRestClient.CreatePostRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolProvisioningControlParameter).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Control provisioning of a hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostProvisioning + /// + /// + /// Operation Id + /// ControlSessionHostProvisioning_Post + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// 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. + /// Object containing control action for hostpool provisioning. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation PostControlSessionHostProvisioning(WaitUntil waitUntil, HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(hostPoolProvisioningControlParameter, nameof(hostPoolProvisioningControlParameter)); + + using var scope = _controlSessionHostProvisioningClientDiagnostics.CreateScope("SessionHostManagementResource.PostControlSessionHostProvisioning"); + scope.Start(); + try + { + var response = _controlSessionHostProvisioningRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolProvisioningControlParameter, cancellationToken); + var operation = new DesktopVirtualizationArmOperation(_controlSessionHostProvisioningClientDiagnostics, Pipeline, _controlSessionHostProvisioningRestClient.CreatePostRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, hostPoolProvisioningControlParameter).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the session host update status for a given hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default + /// + /// + /// Operation Id + /// SessionHostManagementsUpdateStatus_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSessionHostManagementsUpdateStatuAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostManagementsUpdateStatusClientDiagnostics.CreateScope("SessionHostManagementResource.GetSessionHostManagementsUpdateStatu"); + scope.Start(); + try + { + var response = await _sessionHostManagementsUpdateStatusRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the session host update status for a given hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default + /// + /// + /// Operation Id + /// SessionHostManagementsUpdateStatus_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSessionHostManagementsUpdateStatu(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostManagementsUpdateStatusClientDiagnostics.CreateScope("SessionHostManagementResource.GetSessionHostManagementsUpdateStatu"); + scope.Start(); + try + { + var response = _sessionHostManagementsUpdateStatusRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the session host provisioning status for a given hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostProvisioningStatuses/default + /// + /// + /// Operation Id + /// SessionHostProvisioningStatuses_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetSessionHostProvisioningStatusAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostProvisioningStatusesClientDiagnostics.CreateScope("SessionHostManagementResource.GetSessionHostProvisioningStatus"); + scope.Start(); + try + { + var response = await _sessionHostProvisioningStatusesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the session host provisioning status for a given hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostProvisioningStatuses/default + /// + /// + /// Operation Id + /// SessionHostProvisioningStatuses_Get + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetSessionHostProvisioningStatus(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostProvisioningStatusesClientDiagnostics.CreateScope("SessionHostManagementResource.GetSessionHostProvisioningStatus"); + scope.Start(); + try + { + var response = _sessionHostProvisioningStatusesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs index 4a4feebf385e..b567e605b764 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs @@ -36,6 +36,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _sessionHostClientDiagnostics; private readonly SessionHostsRestOperations _sessionHostRestClient; + private readonly ClientDiagnostics _sessionHostClientDiagnostics0; + private readonly SessionHostRestOperations _sessionHostRestClient0; private readonly SessionHostData _data; /// Gets the resource type for the operations. @@ -63,6 +65,8 @@ internal SessionHostResource(ArmClient client, ResourceIdentifier id) : base(cli _sessionHostClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string sessionHostApiVersion); _sessionHostRestClient = new SessionHostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sessionHostApiVersion); + _sessionHostClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _sessionHostRestClient = new SessionHostRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -109,7 +113,7 @@ public virtual UserSessionCollection GetUserSessions() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -140,7 +144,7 @@ public virtual async Task> GetUserSessionAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -171,7 +175,7 @@ public virtual Response GetUserSession(string userSessionId /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -211,7 +215,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -251,7 +255,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -296,7 +300,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -341,7 +345,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -384,7 +388,7 @@ public virtual async Task> UpdateAsync(SessionHost /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -413,5 +417,73 @@ public virtual Response Update(SessionHostPatch patch, bool throw; } } + + /// + /// Retry provisioning on a SessionHost. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning + /// + /// + /// Operation Id + /// SessionHost_RetryProvisioning + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RetryProvisioningSessionHostAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostResource.RetryProvisioningSessionHost"); + scope.Start(); + try + { + var response = await _sessionHostRestClient.RetryProvisioningAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retry provisioning on a SessionHost. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning + /// + /// + /// Operation Id + /// SessionHost_RetryProvisioning + /// + /// + /// Default Api Version + /// 2025-03-01-preview + /// + /// + /// + /// The cancellation token to use. + public virtual Response RetryProvisioningSessionHost(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostResource.RetryProvisioningSessionHost"); + scope.Start(); + try + { + var response = _sessionHostRestClient.RetryProvisioning(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs index 9417f20af7d9..c04d48d5421c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string userSes /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string userSessionId, Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -187,7 +187,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -263,7 +263,7 @@ public virtual async Task> ExistsAsync(string userSessionId, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Response Exists(string userSessionId, CancellationToken can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs index 8239a83aa58e..38d61cba2320 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/UserSessionResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -228,7 +228,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -273,7 +273,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task DisconnectAsync(CancellationToken cancellati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -349,7 +349,7 @@ public virtual Response Disconnect(CancellationToken cancellationToken = default /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -388,7 +388,7 @@ public virtual async Task SendMessageAsync(UserSessionMessage sendMess /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs index 84122d060881..9c91b1bc3191 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpda /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string applicationName, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSi /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize = null, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string applicationName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string applicationName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> GetIfExi /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs index db5f602715d8..e32469dac6d4 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateO /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(Wait /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(st /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string applicationG /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -291,7 +291,7 @@ public virtual AsyncPageable GetAllAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -325,7 +325,7 @@ public virtual Pageable GetAll(string filter = /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -368,7 +368,7 @@ public virtual async Task> ExistsAsync(string applicationGroupNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -411,7 +411,7 @@ public virtual Response Exists(string applicationGroupName, CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -456,7 +456,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs index e3a77087b04f..d32848206c8c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs @@ -57,7 +57,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (Optional.IsDefined(Sku)) { @@ -195,7 +196,8 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa { continue; } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("sku"u8)) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs index f5ff1a068478..281763459fc2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs @@ -82,9 +82,9 @@ public VirtualApplicationGroupData(AzureLocation location, ResourceIdentifier ho /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// Keeps track of any properties unknown to the library. internal VirtualApplicationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string description, string friendlyName, ResourceIdentifier hostPoolId, ResourceIdentifier workspaceId, VirtualApplicationGroupType applicationGroupType, bool? isCloudPCResource, bool? showInFeed, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -143,13 +143,13 @@ internal VirtualApplicationGroupData() /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. [WirePath("etag")] public ETag? ETag { get; } - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } /// The resource model definition representing SKU. [WirePath("sku")] public DesktopVirtualizationSku Sku { get; set; } - /// Gets or sets the plan. + /// Plan for the resource. [WirePath("plan")] public ArmPlan Plan { get; set; } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs index e3499220abfa..7b0b8c060b6f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs @@ -115,7 +115,7 @@ public virtual VirtualApplicationCollection GetVirtualApplications() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -146,7 +146,7 @@ public virtual async Task> GetVirtualApplic /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -184,7 +184,7 @@ public virtual VirtualDesktopCollection GetVirtualDesktops() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -215,7 +215,7 @@ public virtual async Task> GetVirtualDesktopAsy /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -246,7 +246,7 @@ public virtual Response GetVirtualDesktop(string desktop /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -286,7 +286,7 @@ public virtual async Task> GetAsync(Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -326,7 +326,7 @@ public virtual Response Get(CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -370,7 +370,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -414,7 +414,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -456,7 +456,7 @@ public virtual async Task> UpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -498,7 +498,7 @@ public virtual Response Update(VirtualApplicati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -527,7 +527,7 @@ public virtual AsyncPageable GetStartMenuIte /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -556,7 +556,7 @@ public virtual Pageable GetStartMenuItems(in /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -618,7 +618,7 @@ public virtual async Task> AddTagAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -680,7 +680,7 @@ public virtual Response AddTag(string key, stri /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -737,7 +737,7 @@ public virtual async Task> SetTagsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -794,7 +794,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -854,7 +854,7 @@ public virtual async Task> RemoveTagAs /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs index 864c1cef4bb9..080b4b0bce15 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(Virt /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs index ea22250af43c..a603e012afbe 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string desk /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string desktopName, Cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -187,7 +187,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(int? pageSize = null, boo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -263,7 +263,7 @@ public virtual async Task> ExistsAsync(string desktopName, Cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Response Exists(string desktopName, CancellationToken cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs index 7425dac21067..11f57e62930a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -224,7 +224,7 @@ public virtual async Task> UpdateAsync(VirtualD /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs index 9a803d5ff4f8..8df9f0193101 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string wo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string workspaceName, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, b /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string workspaceName, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string workspaceName, CancellationToken can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExist /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs index 74c0b797e22f..896e161eb3d1 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs @@ -57,7 +57,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (Optional.IsDefined(Sku)) { @@ -219,7 +220,8 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { continue; } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("sku"u8)) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs index 907903d5edc7..46c4e804f666 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs @@ -76,9 +76,9 @@ public VirtualWorkspaceData(AzureLocation location) : base(location) /// The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. /// Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). /// The resource model definition representing SKU. - /// Gets or sets the plan. + /// Plan for the resource. /// Keeps track of any properties unknown to the library. internal VirtualWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string description, string friendlyName, IList applicationGroupReferences, bool? isCloudPCResource, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess, IReadOnlyList privateEndpointConnections, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -133,13 +133,13 @@ internal VirtualWorkspaceData() /// The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. [WirePath("etag")] public ETag? ETag { get; } - /// Gets or sets the identity. Current supported identity types: SystemAssigned. + /// Managed service identity (system assigned and/or user assigned identities). [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } /// The resource model definition representing SKU. [WirePath("sku")] public DesktopVirtualizationSku Sku { get; set; } - /// Gets or sets the plan. + /// Plan for the resource. [WirePath("plan")] public ArmPlan Plan { get; set; } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs index 8df1f7a58767..3a89890742c2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs @@ -115,7 +115,7 @@ public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateE /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -146,7 +146,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -177,7 +177,7 @@ public virtual Response GetWorkspace /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -217,7 +217,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -301,7 +301,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -345,7 +345,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -387,7 +387,7 @@ public virtual async Task> UpdateAsync(Virtua /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -429,7 +429,7 @@ public virtual Response Update(VirtualWorkspacePatch p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -458,7 +458,7 @@ public virtual AsyncPageable GetPr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// @@ -487,7 +487,7 @@ public virtual Pageable GetPrivate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -549,7 +549,7 @@ public virtual async Task> AddTagAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -611,7 +611,7 @@ public virtual Response AddTag(string key, string valu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -668,7 +668,7 @@ public virtual async Task> SetTagsAsync(IDict /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -725,7 +725,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -785,7 +785,7 @@ public virtual async Task> RemoveTagAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs index 7badf4867d49..4d2dba45b017 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -403,7 +403,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -448,7 +448,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs index d7cc80f7a684..eb6e9114c99f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(Cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource @@ -318,7 +318,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-03-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/autorest.md b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/autorest.md index 6822f4279ee1..17d0bc81b873 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/autorest.md +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: true csharp: true library-name: DesktopVirtualization namespace: Azure.ResourceManager.DesktopVirtualization -require: https://github.com/Azure/azure-rest-api-specs/blob/ec07fc78c6c25b68107f8ff419d137ffecced005/specification/desktopvirtualization/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/desktopvirtualization/resource-manager/readme.md # tag: package-2024-04 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ActiveSessionHostConfigurationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ActiveSessionHostConfigurationResource.cs new file mode 100644 index 000000000000..bea85aa83c32 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ActiveSessionHostConfigurationResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.DesktopVirtualization.Samples +{ + public partial class Sample_ActiveSessionHostConfigurationResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SessionHostConfigurationsGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ActiveSessionHostConfigurations_Get.json + // this example is just showing the usage of "ActiveSessionHostConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ActiveSessionHostConfigurationResource created on azure + // for more information of creating ActiveSessionHostConfigurationResource, please refer to the document of ActiveSessionHostConfigurationResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier activeSessionHostConfigurationResourceId = ActiveSessionHostConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + ActiveSessionHostConfigurationResource activeSessionHostConfiguration = client.GetActiveSessionHostConfigurationResource(activeSessionHostConfigurationResourceId); + + // invoke the operation + ActiveSessionHostConfigurationResource result = await activeSessionHostConfiguration.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ActiveSessionHostConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageCollection.cs index b977dc337511..a4c6946a6227 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_AppAttachPackageCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_AppAttachPackageCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Create.json // this example is just showing the usage of "AppAttachPackage_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,6 +78,8 @@ public async Task CreateOrUpdate_AppAttachPackageCreate() HostPoolReferences = { }, KeyVaultUri = new Uri(""), FailHealthCheckOnStagingFailure = FailHealthCheckOnStagingFailure.NeedsAssistance, + PackageOwnerName = "App Attach", + CustomData = "", }); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, appAttachPackageName, data); AppAttachPackageResource result = lro.Value; @@ -93,7 +95,7 @@ public async Task CreateOrUpdate_AppAttachPackageCreate() [Ignore("Only validating compilation of examples")] public async Task Get_AppAttachPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Get.json // this example is just showing the usage of "AppAttachPackage_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +128,7 @@ public async Task Get_AppAttachPackageGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_AppAttachPackageListByResourceGroup() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListByResourceGroup.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_ListByResourceGroup.json // this example is just showing the usage of "AppAttachPackage_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +164,7 @@ public async Task GetAll_AppAttachPackageListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_AppAttachPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Get.json // this example is just showing the usage of "AppAttachPackage_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -191,7 +193,7 @@ public async Task Exists_AppAttachPackageGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_AppAttachPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Get.json // this example is just showing the usage of "AppAttachPackage_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageResource.cs index b7a1106b3f98..499977531291 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_AppAttachPackageResource.cs @@ -20,7 +20,7 @@ public partial class Sample_AppAttachPackageResource [Ignore("Only validating compilation of examples")] public async Task Get_AppAttachPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Get.json // this example is just showing the usage of "AppAttachPackage_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_AppAttachPackageGet() [Ignore("Only validating compilation of examples")] public async Task Delete_AppAttachPackageDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Delete.json // this example is just showing the usage of "AppAttachPackage_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_AppAttachPackageDelete() [Ignore("Only validating compilation of examples")] public async Task Update_AppAttachPackageUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_Update.json // this example is just showing the usage of "AppAttachPackage_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolCollection.cs index 7e1c9a5c3c7b..99bd9aee0661 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_HostPoolCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_HostPoolCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Create.json // this example is just showing the usage of "HostPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,6 +54,7 @@ public async Task CreateOrUpdate_HostPoolCreate() RegistrationTokenOperation = HostPoolRegistrationTokenOperation.Update, }, VmTemplate = "{json:json}", + ManagementType = ManagementType.Automated, SsoAdfsAuthority = "https://adfs", SsoClientId = "client", SsoClientSecretKeyVaultPath = "https://keyvault/secret", @@ -74,6 +75,10 @@ public async Task CreateOrUpdate_HostPoolCreate() DayOfWeek = DesktopVirtualizationDayOfWeek.Saturday, }}, }, + ManagedPrivateUDP = ManagedPrivateUDP.Enabled, + DirectUDP = DirectUDP.Enabled, + PublicUDP = PublicUDP.Enabled, + RelayUDP = RelayUDP.Enabled, Tags = { ["tag1"] = "value1", @@ -94,7 +99,7 @@ public async Task CreateOrUpdate_HostPoolCreate() [Ignore("Only validating compilation of examples")] public async Task Get_HostPoolGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Get.json // this example is just showing the usage of "HostPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -127,7 +132,7 @@ public async Task Get_HostPoolGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_HostPoolListByResourceGroup() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_ListByResourceGroup.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_ListByResourceGroup.json // this example is just showing the usage of "HostPools_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -165,7 +170,7 @@ public async Task GetAll_HostPoolListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_HostPoolGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Get.json // this example is just showing the usage of "HostPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +199,7 @@ public async Task Exists_HostPoolGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_HostPoolGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Get.json // this example is just showing the usage of "HostPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionCollection.cs index 56146b119bce..61c7cb2a8459 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_HostPoolPrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_UpdateByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionGetByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_GetByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task Get_PrivateEndpointConnectionGetByHostPool() [Ignore("Only validating compilation of examples")] public async Task GetAll_PrivateEndpointConnectionListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_ListByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_ListByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +134,7 @@ public async Task GetAll_PrivateEndpointConnectionListByHostPool() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateEndpointConnectionGetByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_GetByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -164,7 +164,7 @@ public async Task Exists_PrivateEndpointConnectionGetByHostPool() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateEndpointConnectionGetByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_GetByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionResource.cs index aea8c7840276..876ef18d4a4f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolPrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_HostPoolPrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionGetByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_GetByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_PrivateEndpointConnectionGetByHostPool() [Ignore("Only validating compilation of examples")] public async Task Delete_PrivateEndpointConnectionDeleteByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_DeleteByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_PrivateEndpointConnectionDeleteByHostPool() [Ignore("Only validating compilation of examples")] public async Task Update_PrivateEndpointConnectionUpdateByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json // this example is just showing the usage of "PrivateEndpointConnections_UpdateByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolResource.cs index 6da17ec4fed6..794d9993af7c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_HostPoolResource.cs @@ -20,7 +20,7 @@ public partial class Sample_HostPoolResource [Ignore("Only validating compilation of examples")] public async Task Get_HostPoolGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Get.json // this example is just showing the usage of "HostPools_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_HostPoolGet() [Ignore("Only validating compilation of examples")] public async Task Delete_HostPoolDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Delete.json // this example is just showing the usage of "HostPools_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task Delete_HostPoolDelete() [Ignore("Only validating compilation of examples")] public async Task Update_HostPoolUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_Update.json // this example is just showing the usage of "HostPools_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -133,6 +133,10 @@ public async Task Update_HostPoolUpdate() DayOfWeek = DesktopVirtualizationDayOfWeek.Saturday, }}, }, + ManagedPrivateUDP = ManagedPrivateUDP.Enabled, + DirectUDP = DirectUDP.Enabled, + PublicUDP = PublicUDP.Enabled, + RelayUDP = RelayUDP.Enabled, }; HostPoolResource result = await hostPool.UpdateAsync(patch); @@ -147,7 +151,7 @@ public async Task Update_HostPoolUpdate() [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateLinkResources_ListByHostPool.json // this example is just showing the usage of "PrivateLinkResources_ListByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -176,7 +180,7 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() [Ignore("Only validating compilation of examples")] public async Task GetScalingPlans_ScalingPlanListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_ListByHostPool.json // this example is just showing the usage of "ScalingPlans_ListByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -212,7 +216,7 @@ public async Task GetScalingPlans_ScalingPlanListByHostPool() [Ignore("Only validating compilation of examples")] public async Task RetrieveRegistrationToken_HostPoolsRetrieveRegistrationTokenPost() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_RetrieveRegistrationToken_Post.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPools_RetrieveRegistrationToken_Post.json // this example is just showing the usage of "HostPools_RetrieveRegistrationToken" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -234,11 +238,40 @@ public async Task RetrieveRegistrationToken_HostPoolsRetrieveRegistrationTokenPo Console.WriteLine($"Succeeded: {result}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetRegistrationTokens_HostPoolsListRegistrationTokenPost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPools_ListRegistrationToken_Post.json + // this example is just showing the usage of "HostPools_ListRegistrationTokens" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostPoolResource created on azure + // for more information of creating HostPoolResource, please refer to the document of HostPoolResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); + + // invoke the operation and iterate over the result + await foreach (RegistrationTokenMinimal item in hostPool.GetRegistrationTokensAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetUserSessions_UserSessionListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_ListByHostPool.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_ListByHostPool.json // this example is just showing the usage of "UserSessions_ListByHostPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -275,7 +308,7 @@ public async Task GetUserSessions_UserSessionListByHostPool() [Ignore("Only validating compilation of examples")] public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackageInfo_Import_Post.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackageInfo_Import_Post.json // this example is just showing the usage of "AppAttachPackageInfo_Import" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -313,7 +346,7 @@ public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() [Ignore("Only validating compilation of examples")] public async Task ExpandMsixImages_MsixImageExpand() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixImage_Expand_Post.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixImage_Expand_Post.json // this example is just showing the usage of "MsixImages_Expand" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageCollection.cs index 7e6368e6b423..d7cd3fcdc723 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MsixPackageCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_MSIXPackageCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Create.json // this example is just showing the usage of "MSIXPackages_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,7 +83,7 @@ public async Task CreateOrUpdate_MSIXPackageCreate() [Ignore("Only validating compilation of examples")] public async Task Get_MSIXPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Get.json // this example is just showing the usage of "MSIXPackages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Get_MSIXPackageGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_MSIXPackageList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_List.json // this example is just showing the usage of "MSIXPackages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -156,7 +156,7 @@ public async Task GetAll_MSIXPackageList() [Ignore("Only validating compilation of examples")] public async Task Exists_MSIXPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Get.json // this example is just showing the usage of "MSIXPackages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -186,7 +186,7 @@ public async Task Exists_MSIXPackageGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_MSIXPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Get.json // this example is just showing the usage of "MSIXPackages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageResource.cs index cd2ff7e4eae1..222cba825f54 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_MsixPackageResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MsixPackageResource [Ignore("Only validating compilation of examples")] public async Task Get_MSIXPackageGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Get.json // this example is just showing the usage of "MSIXPackages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_MSIXPackageGet() [Ignore("Only validating compilation of examples")] public async Task Delete_MSIXPackageDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Delete.json // this example is just showing the usage of "MSIXPackages_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_MSIXPackageDelete() [Ignore("Only validating compilation of examples")] public async Task Update_MSIXPackageUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/MsixPackage_Update.json // this example is just showing the usage of "MSIXPackages_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanCollection.cs index 85c1f46fdecf..f45dc45eafa2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_ScalingPlanCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ScalingPlansCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Create.json // this example is just showing the usage of "ScalingPlans_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task CreateOrUpdate_ScalingPlansCreate() Schedules = {new ScalingSchedule { Name = "schedule1", -DaysOfWeek = {ScalingScheduleDaysOfWeekItem.Monday, ScalingScheduleDaysOfWeekItem.Tuesday, ScalingScheduleDaysOfWeekItem.Wednesday, ScalingScheduleDaysOfWeekItem.Thursday, ScalingScheduleDaysOfWeekItem.Friday}, +DaysOfWeek = {DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday}, RampUpStartTime = new ScalingActionTime(6, 0), RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, RampUpMinimumHostsPct = 20, @@ -92,7 +92,7 @@ public async Task CreateOrUpdate_ScalingPlansCreate() [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlansGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Get.json // this example is just showing the usage of "ScalingPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Get_ScalingPlansGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScalingPlansListByResourceGroup() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByResourceGroup.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_ListByResourceGroup.json // this example is just showing the usage of "ScalingPlans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task GetAll_ScalingPlansListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_ScalingPlansGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Get.json // this example is just showing the usage of "ScalingPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -192,7 +192,7 @@ public async Task Exists_ScalingPlansGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScalingPlansGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Get.json // this example is just showing the usage of "ScalingPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleCollection.cs index cfddb58b35aa..68d195f53d07 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_ScalingPlanPersonalScheduleCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ScalingPlanPersonalSchedulesCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Create.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,29 +41,24 @@ public async Task CreateOrUpdate_ScalingPlanPersonalSchedulesCreate() // invoke the operation string scalingPlanScheduleName = "scalingPlanScheduleWeekdays1"; - ScalingPlanPersonalScheduleData data = new ScalingPlanPersonalScheduleData + ScalingPlanPersonalScheduleData data = new ScalingPlanPersonalScheduleData(new DesktopVirtualizationDayOfWeek[] { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, new ScalingActionTime(6, 0), new ScalingActionTime(8, 0), new ScalingActionTime(18, 0), new ScalingActionTime(20, 0)) { - DaysOfWeek = { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, - RampUpStartTime = new ScalingActionTime(6, 0), RampUpAutoStartHosts = StartupBehavior.All, RampUpStartVmOnConnect = SetStartVmOnConnect.Enable, RampUpActionOnDisconnect = SessionHandlingOperation.None, RampUpMinutesToWaitOnDisconnect = 10, RampUpActionOnLogoff = SessionHandlingOperation.None, RampUpMinutesToWaitOnLogoff = 10, - PeakStartTime = new ScalingActionTime(8, 0), PeakStartVmOnConnect = SetStartVmOnConnect.Enable, PeakActionOnDisconnect = SessionHandlingOperation.None, PeakMinutesToWaitOnDisconnect = 10, PeakActionOnLogoff = SessionHandlingOperation.Deallocate, PeakMinutesToWaitOnLogoff = 10, - RampDownStartTime = new ScalingActionTime(18, 0), RampDownStartVmOnConnect = SetStartVmOnConnect.Enable, RampDownActionOnDisconnect = SessionHandlingOperation.None, RampDownMinutesToWaitOnDisconnect = 10, RampDownActionOnLogoff = SessionHandlingOperation.Deallocate, RampDownMinutesToWaitOnLogoff = 10, - OffPeakStartTime = new ScalingActionTime(20, 0), OffPeakStartVmOnConnect = SetStartVmOnConnect.Enable, OffPeakActionOnDisconnect = SessionHandlingOperation.None, OffPeakMinutesToWaitOnDisconnect = 10, @@ -84,7 +79,7 @@ public async Task CreateOrUpdate_ScalingPlanPersonalSchedulesCreate() [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlanPersonalSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Get.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -118,7 +113,7 @@ public async Task Get_ScalingPlanPersonalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScalingPlanPersonalSchedulesList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_List.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -157,7 +152,7 @@ public async Task GetAll_ScalingPlanPersonalSchedulesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ScalingPlanPersonalSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Get.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -187,7 +182,7 @@ public async Task Exists_ScalingPlanPersonalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScalingPlanPersonalSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Get.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleResource.cs index 62750d78eb51..51df14473985 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPersonalScheduleResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ScalingPlanPersonalScheduleResource [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlanPersonalSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Get.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_ScalingPlanPersonalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ScalingPlanPersonalSchedulesDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Delete.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_ScalingPlanPersonalSchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ScalingPlanPersonalSchedulesUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPersonalSchedule_Update.json // this example is just showing the usage of "ScalingPlanPersonalSchedules_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs index b69462e6ec46..2b1df48937d3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleCollection.cs @@ -16,11 +16,71 @@ namespace Azure.ResourceManager.DesktopVirtualization.Samples { public partial class Sample_ScalingPlanPooledScheduleCollection { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ScalingPlanPooledScheduleCreateUsingCreateDelete() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_CreateUsingCreateDelete.json + // this example is just showing the usage of "ScalingPlanPooledSchedules_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ScalingPlanResource created on azure + // for more information of creating ScalingPlanResource, please refer to the document of ScalingPlanResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string scalingPlanName = "scalingPlan1"; + ResourceIdentifier scalingPlanResourceId = ScalingPlanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, scalingPlanName); + ScalingPlanResource scalingPlan = client.GetScalingPlanResource(scalingPlanResourceId); + + // get the collection of this ScalingPlanPooledScheduleResource + ScalingPlanPooledScheduleCollection collection = scalingPlan.GetScalingPlanPooledSchedules(); + + // invoke the operation + string scalingPlanScheduleName = "scalingPlanScheduleWeekdays1"; + ScalingPlanPooledScheduleData data = new ScalingPlanPooledScheduleData( + new DesktopVirtualizationDayOfWeek[] { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, + new ScalingActionTime(6, 0), + 80, + new ScalingActionTime(8, 0), + new ScalingActionTime(18, 0), + 50, + new ScalingActionTime(20, 0)) + { + ScalingMethod = ScalingMethod.CreateDeletePowerManage, + CreateDelete = new CreateDeleteProperties + { + RampUpMaximumHostPoolSize = 10, + RampUpMinimumHostPoolSize = 5, + RampDownMaximumHostPoolSize = 7, + RampDownMinimumHostPoolSize = 2, + }, + RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + PeakLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.BreadthFirst, + RampDownLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + RampDownForceLogoffUsers = true, + RampDownWaitTimeMinutes = 30, + RampDownNotificationMessage = "message", + OffPeakLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, scalingPlanScheduleName, data); + ScalingPlanPooledScheduleResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ScalingPlanPooledScheduleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ScalingPlanPooledSchedulesCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Create.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,23 +101,23 @@ public async Task CreateOrUpdate_ScalingPlanPooledSchedulesCreate() // invoke the operation string scalingPlanScheduleName = "scalingPlanScheduleWeekdays1"; - ScalingPlanPooledScheduleData data = new ScalingPlanPooledScheduleData + ScalingPlanPooledScheduleData data = new ScalingPlanPooledScheduleData( + new DesktopVirtualizationDayOfWeek[] { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, + new ScalingActionTime(6, 0), + 80, + new ScalingActionTime(8, 0), + new ScalingActionTime(18, 0), + 50, + new ScalingActionTime(20, 0)) { - DaysOfWeek = { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, - RampUpStartTime = new ScalingActionTime(6, 0), RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, RampUpMinimumHostsPct = 20, - RampUpCapacityThresholdPct = 80, - PeakStartTime = new ScalingActionTime(8, 0), PeakLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.BreadthFirst, - RampDownStartTime = new ScalingActionTime(18, 0), RampDownLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, RampDownMinimumHostsPct = 20, - RampDownCapacityThresholdPct = 50, RampDownForceLogoffUsers = true, RampDownWaitTimeMinutes = 30, RampDownNotificationMessage = "message", - OffPeakStartTime = new ScalingActionTime(20, 0), OffPeakLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, scalingPlanScheduleName, data); @@ -74,7 +134,7 @@ public async Task CreateOrUpdate_ScalingPlanPooledSchedulesCreate() [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlanPooledSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Get.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -108,7 +168,7 @@ public async Task Get_ScalingPlanPooledSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ScalingPlanPooledSchedulesList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_List.json // this example is just showing the usage of "ScalingPlanPooledSchedules_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -147,7 +207,7 @@ public async Task GetAll_ScalingPlanPooledSchedulesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ScalingPlanPooledSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Get.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -177,7 +237,7 @@ public async Task Exists_ScalingPlanPooledSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ScalingPlanPooledSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Get.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleResource.cs index 33271d157fc8..264a832de568 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanPooledScheduleResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ScalingPlanPooledScheduleResource [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlanPooledSchedulesGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Get.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_ScalingPlanPooledSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ScalingPlanPooledSchedulesDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Delete.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_ScalingPlanPooledSchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ScalingPlanPooledSchedulesUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlanPooledSchedule_Update.json // this example is just showing the usage of "ScalingPlanPooledSchedules_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanResource.cs index 92fa800f4d5e..2bf8e07ebdd8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_ScalingPlanResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ScalingPlanResource [Ignore("Only validating compilation of examples")] public async Task Get_ScalingPlansGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Get.json // this example is just showing the usage of "ScalingPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_ScalingPlansGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ScalingPlansDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Delete.json // this example is just showing the usage of "ScalingPlans_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_ScalingPlansDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ScalingPlansUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_Update.json // this example is just showing the usage of "ScalingPlans_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostCollection.cs index b2d6cb8397bd..b3bb99a166c9 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SessionHostCollection [Ignore("Only validating compilation of examples")] public async Task Get_SessionHostGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Get.json // this example is just showing the usage of "SessionHosts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_SessionHostGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_SessionHostList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_List.json // this example is just showing the usage of "SessionHosts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task GetAll_SessionHostList() [Ignore("Only validating compilation of examples")] public async Task Exists_SessionHostGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Get.json // this example is just showing the usage of "SessionHosts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_SessionHostGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_SessionHostGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Get.json // this example is just showing the usage of "SessionHosts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostConfigurationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostConfigurationResource.cs new file mode 100644 index 000000000000..d22edbd0ac98 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostConfigurationResource.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DesktopVirtualization.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DesktopVirtualization.Samples +{ + public partial class Sample_SessionHostConfigurationResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SessionHostConfigurationsGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostConfigurations_Get.json + // this example is just showing the usage of "SessionHostConfigurations_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostConfigurationResource created on azure + // for more information of creating SessionHostConfigurationResource, please refer to the document of SessionHostConfigurationResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostConfigurationResourceId = SessionHostConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostConfigurationResource sessionHostConfiguration = client.GetSessionHostConfigurationResource(sessionHostConfigurationResourceId); + + // invoke the operation + SessionHostConfigurationResource result = await sessionHostConfiguration.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SessionHostConfigurationsUpdate() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostConfigurations_Update.json + // this example is just showing the usage of "SessionHostConfigurations_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostConfigurationResource created on azure + // for more information of creating SessionHostConfigurationResource, please refer to the document of SessionHostConfigurationResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostConfigurationResourceId = SessionHostConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostConfigurationResource sessionHostConfiguration = client.GetSessionHostConfigurationResource(sessionHostConfigurationResourceId); + + // invoke the operation + SessionHostConfigurationPatch patch = new SessionHostConfigurationPatch + { + FriendlyName = "Second Version, Updated Location", + VmTags = +{ +["Department"] = "myDepartment", +["Team"] = "myTeam" +}, + VmLocation = "eastus2", + VmResourceGroup = "myResourceGroup", + VmNamePrefix = "westus2-vm", + AvailabilityZones = { 1, 3 }, + NetworkInfo = new NetworkInfoPatchProperties + { + SubnetId = new ResourceIdentifier("/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/virtualNetworks/.../subnets/subnet1"), + SecurityGroupId = "/subscriptions/.../resourceGroups/.../provider s/Microsoft.Network/networkSecurityGroups/nsg1", + }, + VmSizeId = "Standard_D2s_v3", + DiskInfo = new DiskInfoProperties + { + DiffDiskSettings = new DiffDiskProperties + { + Option = DiffDiskOption.Local, + Placement = DiffDiskPlacement.CacheDisk, + }, + }, + CustomConfigurationScriptUri = new Uri("https://storageaccountname.blob.core.windows.net/blobcontainer/file"), + ImageInfo = new ImageInfoPatchProperties + { + ImageType = Models.Type.Marketplace, + MarketplaceInfo = new MarketplaceInfoPatchProperties + { + Offer = "Windows-10", + Publisher = "MicrosoftWindowsDesktop", + Sku = "19h2-ent", + ExactVersion = "2019.0.20190115", + }, + CustomInfoResourceId = new ResourceIdentifier("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/images/imageName"), + }, + ActiveDirectoryInfoDomainCredentials = new KeyVaultCredentialsPatchProperties + { + UsernameKeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/myusername"), + PasswordKeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/mysecretname"), + }, + SecurityInfo = new SecurityInfoPatchProperties + { + VirtualMachineSecurityType = VirtualMachineSecurityType.TrustedLaunch, + SecureBootEnabled = true, + VTpmEnabled = true, + }, + VmAdminCredentials = new KeyVaultCredentialsPatchProperties + { + UsernameKeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/myusername"), + PasswordKeyVaultSecretUri = new Uri("https://myvault.vault.azure.net/secrets/mysecretname"), + }, + BootDiagnosticsInfo = new BootDiagnosticsInfoPatchProperties + { + Enabled = true, + StorageUri = new Uri("https://myStorageAccountName.blob.core.windows.net"), + }, + }; + ArmOperation lro = await sessionHostConfiguration.UpdateAsync(WaitUntil.Completed, patch); + SessionHostConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SessionHostConfigurationsCreate() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostConfigurations_Create.json + // this example is just showing the usage of "SessionHostConfigurations_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostConfigurationResource created on azure + // for more information of creating SessionHostConfigurationResource, please refer to the document of SessionHostConfigurationResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostConfigurationResourceId = SessionHostConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostConfigurationResource sessionHostConfiguration = client.GetSessionHostConfigurationResource(sessionHostConfigurationResourceId); + + // invoke the operation + SessionHostConfigurationData data = new SessionHostConfigurationData( + "westus2-vm", + new NetworkInfoProperties(new ResourceIdentifier("/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/virtualNetworks/.../subnets/subnet1")) + { + SecurityGroupId = "/subscriptions/.../resourceGroups/.../provider s/Microsoft.Network/networkSecurityGroups/nsg1", + }, + "Standard_D2s_v3", + new DiskInfoProperties + { + VirtualMachineDiskType = VirtualMachineDiskType.StandardLRS, + }, + new ImageInfoProperties(Models.Type.Marketplace) + { + MarketplaceInfo = new MarketplaceInfoProperties("Windows-10", "MicrosoftWindowsDesktop", "19h2-ent", "2019.0.20190115"), + CustomInfoResourceId = new ResourceIdentifier("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/images/imageName"), + }, + new DomainInfoProperties(DomainJoinType.ActiveDirectory) + { + ActiveDirectoryInfo = new ActiveDirectoryInfoProperties(new KeyVaultCredentialsProperties(new Uri("https://myvault.vault.azure.net/secrets/myusername"), new Uri("https://myvault.vault.azure.net/secrets/mysecretname")), "OU=testOU,DC=domain,DC=Domain,DC=com") + { + DomainName = "wvdarmtest1.net", + }, + AzureActiveDirectoryInfoMdmProviderGuid = "bdefabc0-95b4-48b3-b645-8a753a63c4fa", + }, + new KeyVaultCredentialsProperties(new Uri("https://myvault.vault.azure.net/secrets/myusername"), new Uri("https://myvault.vault.azure.net/secrets/mysecretname"))) + { + FriendlyName = "InitialConfiguration", + VmTags = +{ +["Department"] = "myDepartment", +["Team"] = "myTeam" +}, + VmLocation = "eastus2", + VmResourceGroup = "myResourceGroup", + AvailabilityZones = { 1, 3 }, + CustomConfigurationScriptUri = new Uri("https://storageaccountname.blob.core.windows.net/blobcontainer/file"), + SecurityInfo = new SecurityInfoProperties + { + VirtualMachineSecurityType = VirtualMachineSecurityType.TrustedLaunch, + SecureBootEnabled = true, + VTpmEnabled = true, + }, + BootDiagnosticsInfo = new BootDiagnosticsInfoProperties + { + Enabled = true, + StorageUri = new Uri("https://myStorageAccountName.blob.core.windows.net"), + }, + }; + ArmOperation lro = await sessionHostConfiguration.CreateOrUpdateAsync(WaitUntil.Completed, data); + SessionHostConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostManagementResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostManagementResource.cs new file mode 100644 index 000000000000..a5bb7c8d7ec5 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostManagementResource.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DesktopVirtualization.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DesktopVirtualization.Samples +{ + public partial class Sample_SessionHostManagementResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SessionHostManagementsGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_Get.json + // this example is just showing the usage of "SessionHostManagements_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + SessionHostManagementResource result = await sessionHostManagement.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostManagementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SessionHostManagementsUpdate() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_Update.json + // this example is just showing the usage of "SessionHostManagements_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + SessionHostManagementPatch patch = new SessionHostManagementPatch + { + ScheduledDateTimeZone = "Alaskan Standard Time", + Update = new HostPoolUpdateConfigurationPatchProperties + { + DeleteOriginalVm = true, + MaxVmsRemoved = 4, + LogOffDelayMinutes = 10, + LogOffMessage = "logging off for hostpool update", + }, + }; + SessionHostManagementResource result = await sessionHostManagement.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostManagementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SessionHostManagementsCreate() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_Create.json + // this example is just showing the usage of "SessionHostManagements_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + SessionHostManagementData data = new SessionHostManagementData("Alaskan Standard Time", new HostPoolUpdateConfigurationProperties(4, 10) + { + DeleteOriginalVm = true, + LogOffMessage = "logging off for hostpool update", + }); + ArmOperation lro = await sessionHostManagement.CreateOrUpdateAsync(WaitUntil.Completed, data); + SessionHostManagementResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SessionHostManagementData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task PostInitiateSessionHostUpdate_HostPoolsUpdatePost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_UpdateSessionHosts_Post.json + // this example is just showing the usage of "InitiateSessionHostUpdate_Post" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + UpdateSessionHostsRequestBody updateSessionHostsRequestBody = new UpdateSessionHostsRequestBody + { + ScheduledOn = DateTimeOffset.Parse("2008-09-22T14:01:54.9571247Z"), + ScheduledDateTimeZone = "Alaskan Standard Time", + Update = new HostPoolUpdateConfigurationPatchProperties + { + DeleteOriginalVm = true, + MaxVmsRemoved = 4, + LogOffDelayMinutes = 10, + LogOffMessage = "logging off for hostpool update", + }, + }; + await sessionHostManagement.PostInitiateSessionHostUpdateAsync(updateSessionHostsRequestBody: updateSessionHostsRequestBody); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task PostControlSessionHostUpdate_SessionHostManagementsControlUpdatePost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_ControlSessionHostUpdate_Post.json + // this example is just showing the usage of "ControlSessionHostUpdate_Post" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + HostPoolUpdateControlParameter hostPoolUpdateControlParameter = new HostPoolUpdateControlParameter(HostPoolUpdateAction.Start) + { + CancelMessage = "Host pool update started", + }; + await sessionHostManagement.PostControlSessionHostUpdateAsync(WaitUntil.Completed, hostPoolUpdateControlParameter); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task PostControlSessionHostProvisioning_ControlSessionHostProvisioningPost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_ControlSessionHostProvisioning_Post.json + // this example is just showing the usage of "ControlSessionHostProvisioning_Post" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + HostPoolProvisioningControlParameter hostPoolProvisioningControlParameter = new HostPoolProvisioningControlParameter(HostPoolProvisioningAction.Cancel) + { + CancelMessage = "Cancel host pool provisioning", + }; + await sessionHostManagement.PostControlSessionHostProvisioningAsync(WaitUntil.Completed, hostPoolProvisioningControlParameter); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetSessionHostManagementsUpdateStatu_SessionHostManagementsUpdateStatusGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_UpdateStatus_Get.json + // this example is just showing the usage of "SessionHostManagementsUpdateStatus_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + SessionHostManagementUpdateStatus result = await sessionHostManagement.GetSessionHostManagementsUpdateStatuAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetSessionHostProvisioningStatus_SessionHostProvisioningStatusesGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHostManagements_SessionHostProvisioningStatuses_Get.json + // this example is just showing the usage of "SessionHostProvisioningStatuses_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostManagementResource created on azure + // for more information of creating SessionHostManagementResource, please refer to the document of SessionHostManagementResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + ResourceIdentifier sessionHostManagementResourceId = SessionHostManagementResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); + SessionHostManagementResource sessionHostManagement = client.GetSessionHostManagementResource(sessionHostManagementResourceId); + + // invoke the operation + SessionHostManagementProvisioningStatus result = await sessionHostManagement.GetSessionHostProvisioningStatusAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostResource.cs index dc951de52446..d752706f5248 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SessionHostResource [Ignore("Only validating compilation of examples")] public async Task Get_SessionHostGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Get.json // this example is just showing the usage of "SessionHosts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_SessionHostGet() [Ignore("Only validating compilation of examples")] public async Task Delete_SessionHostDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Delete.json // this example is just showing the usage of "SessionHosts_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -79,7 +79,7 @@ public async Task Delete_SessionHostDelete() [Ignore("Only validating compilation of examples")] public async Task Update_SessionHostUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_Update.json // this example is just showing the usage of "SessionHosts_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -112,5 +112,32 @@ public async Task Update_SessionHostUpdate() // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RetryProvisioningSessionHost_SessionHostRetryProvisioningPost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/SessionHost_RetryProvisioning_Post.json + // this example is just showing the usage of "SessionHost_RetryProvisioning" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SessionHostResource created on azure + // for more information of creating SessionHostResource, please refer to the document of SessionHostResource + string subscriptionId = "daefabc0-95b4-48b3-b645-8a753a63c4fa"; + string resourceGroupName = "resourceGroup1"; + string hostPoolName = "hostPool1"; + string sessionHostName = "sessionHost1.microsoft.com"; + ResourceIdentifier sessionHostResourceId = SessionHostResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + SessionHostResource sessionHost = client.GetSessionHostResource(sessionHostResourceId); + + // invoke the operation + await sessionHost.RetryProvisioningSessionHostAsync(); + + Console.WriteLine("Succeeded"); + } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index c6ad0227ebe6..d0fef456d351 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetVirtualWorkspaces_WorkspaceListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListBySubscription.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_ListBySubscription.json // this example is just showing the usage of "Workspaces_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task GetVirtualWorkspaces_WorkspaceListBySubscription() [Ignore("Only validating compilation of examples")] public async Task GetScalingPlans_ScalingPlansListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListBySubscription.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ScalingPlan_ListBySubscription.json // this example is just showing the usage of "ScalingPlans_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +85,7 @@ public async Task GetScalingPlans_ScalingPlansListBySubscription() [Ignore("Only validating compilation of examples")] public async Task GetVirtualApplicationGroups_ApplicationGroupList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListBySubscription.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_ListBySubscription.json // this example is just showing the usage of "ApplicationGroups_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task GetVirtualApplicationGroups_ApplicationGroupList() [Ignore("Only validating compilation of examples")] public async Task GetHostPools_HostPoolList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/HostPool_List.json // this example is just showing the usage of "HostPools_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +151,7 @@ public async Task GetHostPools_HostPoolList() [Ignore("Only validating compilation of examples")] public async Task GetAppAttachPackages_AppAttachPackageListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListBySubscription.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/AppAttachPackage_ListBySubscription.json // this example is just showing the usage of "AppAttachPackage_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionCollection.cs index 32d5e11c7f8c..66bd0426562d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_UserSessionCollection [Ignore("Only validating compilation of examples")] public async Task Get_UserSessionGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Get.json // this example is just showing the usage of "UserSessions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_UserSessionGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_UserSessionList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_List.json // this example is just showing the usage of "UserSessions_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task GetAll_UserSessionList() [Ignore("Only validating compilation of examples")] public async Task Exists_UserSessionGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Get.json // this example is just showing the usage of "UserSessions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_UserSessionGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_UserSessionGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Get.json // this example is just showing the usage of "UserSessions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionResource.cs index 0efe289e2d54..1e46d0819755 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_UserSessionResource [Ignore("Only validating compilation of examples")] public async Task Get_UserSessionGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Get.json // this example is just showing the usage of "UserSessions_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_UserSessionGet() [Ignore("Only validating compilation of examples")] public async Task Delete_UserSessionDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Delete.json // this example is just showing the usage of "UserSessions_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -81,7 +81,7 @@ public async Task Delete_UserSessionDelete() [Ignore("Only validating compilation of examples")] public async Task Disconnect_UserSessionDisconnectPost() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Disconnect_Post.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_Disconnect_Post.json // this example is just showing the usage of "UserSessions_Disconnect" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -109,7 +109,7 @@ public async Task Disconnect_UserSessionDisconnectPost() [Ignore("Only validating compilation of examples")] public async Task SendMessage_UserSessionSendMessagePost() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_SendMessage_Post.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/UserSession_SendMessage_Post.json // this example is just showing the usage of "UserSessions_SendMessage" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationCollection.cs index 719d7db7a212..d80e81e91953 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualApplicationCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ApplicationCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Create.json // this example is just showing the usage of "Applications_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -65,7 +65,7 @@ public async Task CreateOrUpdate_ApplicationCreate() [Ignore("Only validating compilation of examples")] public async Task Get_ApplicationGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Get.json // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +99,7 @@ public async Task Get_ApplicationGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ApplicationsList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_List.json // this example is just showing the usage of "Applications_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +138,7 @@ public async Task GetAll_ApplicationsList() [Ignore("Only validating compilation of examples")] public async Task Exists_ApplicationGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Get.json // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task Exists_ApplicationGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ApplicationGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Get.json // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs index 9cdccdbefedb..34efe63e2485 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_VirtualApplicationGroupCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ApplicationGroupCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Create.json // this example is just showing the usage of "ApplicationGroups_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -66,7 +66,7 @@ public async Task CreateOrUpdate_ApplicationGroupCreate() [Ignore("Only validating compilation of examples")] public async Task Get_ApplicationGroupGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Get.json // this example is just showing the usage of "ApplicationGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +99,7 @@ public async Task Get_ApplicationGroupGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ApplicationGroupListByResourceGroup() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListByResourceGroup.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_ListByResourceGroup.json // this example is just showing the usage of "ApplicationGroups_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +138,7 @@ public async Task GetAll_ApplicationGroupListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_ApplicationGroupGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Get.json // this example is just showing the usage of "ApplicationGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +167,7 @@ public async Task Exists_ApplicationGroupGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ApplicationGroupGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Get.json // this example is just showing the usage of "ApplicationGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupResource.cs index a2314ed198a9..f700875a5b64 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationGroupResource.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualApplicationGroupResource [Ignore("Only validating compilation of examples")] public async Task Get_ApplicationGroupGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Get.json // this example is just showing the usage of "ApplicationGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_ApplicationGroupGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ApplicationGroupDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Delete.json // this example is just showing the usage of "ApplicationGroups_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_ApplicationGroupDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ApplicationGroupsUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/ApplicationGroup_Update.json // this example is just showing the usage of "ApplicationGroups_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Update_ApplicationGroupsUpdate() [Ignore("Only validating compilation of examples")] public async Task GetStartMenuItems_StartMenuItemList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/StartMenuItem_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/StartMenuItem_List.json // this example is just showing the usage of "StartMenuItems_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationResource.cs index fcf93c07ee81..2517a5017f25 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualApplicationResource.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualApplicationResource [Ignore("Only validating compilation of examples")] public async Task Get_ApplicationGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Get.json // this example is just showing the usage of "Applications_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_ApplicationGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ApplicationDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Delete.json // this example is just showing the usage of "Applications_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_ApplicationDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ApplicationUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Application_Update.json // this example is just showing the usage of "Applications_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopCollection.cs index 530d4064a0fb..977ca64d376e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_VirtualDesktopCollection [Ignore("Only validating compilation of examples")] public async Task Get_DesktopGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_Get.json // this example is just showing the usage of "Desktops_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_DesktopGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_DesktopList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_List.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_List.json // this example is just showing the usage of "Desktops_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task GetAll_DesktopList() [Ignore("Only validating compilation of examples")] public async Task Exists_DesktopGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_Get.json // this example is just showing the usage of "Desktops_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_DesktopGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_DesktopGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_Get.json // this example is just showing the usage of "Desktops_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopResource.cs index 872fc689d260..88389739c0be 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualDesktopResource.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualDesktopResource [Ignore("Only validating compilation of examples")] public async Task Get_DesktopGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_Get.json // this example is just showing the usage of "Desktops_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_DesktopGet() [Ignore("Only validating compilation of examples")] public async Task Update_DesktopUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Desktop_Update.json // this example is just showing the usage of "Desktops_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceCollection.cs index c20e2eb44495..8f18ab885a3c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualWorkspaceCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_WorkspaceCreate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Create.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Create.json // this example is just showing the usage of "Workspaces_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task CreateOrUpdate_WorkspaceCreate() [Ignore("Only validating compilation of examples")] public async Task Get_WorkspaceGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Get.json // this example is just showing the usage of "Workspaces_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +97,7 @@ public async Task Get_WorkspaceGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_WorkspaceListByResourceGroup() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListByResourceGroup.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_ListByResourceGroup.json // this example is just showing the usage of "Workspaces_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -135,7 +135,7 @@ public async Task GetAll_WorkspaceListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_WorkspaceGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Get.json // this example is just showing the usage of "Workspaces_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -164,7 +164,7 @@ public async Task Exists_WorkspaceGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_WorkspaceGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Get.json // this example is just showing the usage of "Workspaces_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceResource.cs index ae383e2f68d5..1fe393691f89 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_VirtualWorkspaceResource.cs @@ -20,7 +20,7 @@ public partial class Sample_VirtualWorkspaceResource [Ignore("Only validating compilation of examples")] public async Task Get_WorkspaceGet() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Get.json // this example is just showing the usage of "Workspaces_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_WorkspaceGet() [Ignore("Only validating compilation of examples")] public async Task Delete_WorkspaceDelete() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Delete.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Delete.json // this example is just showing the usage of "Workspaces_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_WorkspaceDelete() [Ignore("Only validating compilation of examples")] public async Task Update_WorkspaceUpdate() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Update.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/Workspace_Update.json // this example is just showing the usage of "Workspaces_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -116,7 +116,7 @@ public async Task Update_WorkspaceUpdate() [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinkResources_PrivateLinkResourcesListByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateLinkResources_ListByWorkspace.json // this example is just showing the usage of "PrivateLinkResources_ListByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionCollection.cs index 96f29b953ae2..23d0744e96a1 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_WorkspacePrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_UpdateByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionGetByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_GetByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task Get_PrivateEndpointConnectionGetByWorkspace() [Ignore("Only validating compilation of examples")] public async Task GetAll_PrivateEndpointConnectionListByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_ListByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_ListByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +134,7 @@ public async Task GetAll_PrivateEndpointConnectionListByWorkspace() [Ignore("Only validating compilation of examples")] public async Task Exists_PrivateEndpointConnectionGetByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_GetByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -164,7 +164,7 @@ public async Task Exists_PrivateEndpointConnectionGetByWorkspace() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PrivateEndpointConnectionGetByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_GetByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionResource.cs index 909f4e397b46..162840158499 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_WorkspacePrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_WorkspacePrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_PrivateEndpointConnectionGetByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_GetByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_GetByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_PrivateEndpointConnectionGetByWorkspace() [Ignore("Only validating compilation of examples")] public async Task Delete_PrivateEndpointConnectionDeleteByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_DeleteByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_PrivateEndpointConnectionDeleteByWorkspace() [Ignore("Only validating compilation of examples")] public async Task Update_PrivateEndpointConnectionUpdateByWorkspace() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByWorkspace.json + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-03-01-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json // this example is just showing the usage of "PrivateEndpointConnections_UpdateByWorkspace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/