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..5f66df257afb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.Serialization.cs @@ -0,0 +1,761 @@ +// 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("VirtualMachineDiskType", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diskInfo: "); + builder.AppendLine("{"); + builder.AppendLine(" diskInfo: {"); + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + 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); + 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..f1051371f765 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ActiveSessionHostConfigurationData.cs @@ -0,0 +1,191 @@ +// 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. + /// Schema for ActiveSessionHostConfiguration properties. + /// + 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 the 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 the 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. + internal DiskInfoProperties DiskInfo { get; set; } + /// The disk type used by virtual machine in hostpool session host. + [WirePath("properties.diskInfo.type")] + public VirtualMachineDiskType? VirtualMachineDiskType + { + get => DiskInfo is null ? default(VirtualMachineDiskType?) : DiskInfo.VirtualMachineDiskType; + set + { + DiskInfo = value.HasValue ? new DiskInfoProperties(value.Value) : null; + } + } + + /// 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 the 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..c95105c78e89 --- /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); + + ActiveSessionHostConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + 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..dd86a0bd8a1a --- /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 a ActiveSessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default + /// + /// + /// Operation Id + /// ActiveSessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-04-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 a ActiveSessionHostConfiguration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default + /// + /// + /// Operation Id + /// ActiveSessionHostConfigurations_Get + /// + /// + /// Default Api Version + /// 2025-04-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..2d2452265ac1 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-04-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string ap /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string appAttachPackageNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -288,7 +288,7 @@ public virtual AsyncPageable GetAllAsync(string filter /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -319,7 +319,7 @@ public virtual Pageable GetAll(string filter = null, C /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string appAttachPackageNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -405,7 +405,7 @@ public virtual Response Exists(string appAttachPackageName, CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -450,7 +450,7 @@ public virtual async Task> GetIfExist /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.Serialization.cs index 47672944dc3d..c21c549d38f6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.Serialization.cs @@ -40,7 +40,53 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Image)) + { + writer.WritePropertyName("image"u8); + writer.WriteObjectValue(Image, options); + } + if (Optional.IsCollectionDefined(HostPoolReferences)) + { + writer.WritePropertyName("hostPoolReferences"u8); + writer.WriteStartArray(); + foreach (var item in HostPoolReferences) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(KeyVaultURL)) + { + writer.WritePropertyName("keyVaultURL"u8); + writer.WriteStringValue(KeyVaultURL); + } + if (Optional.IsDefined(FailHealthCheckOnStagingFailure)) + { + writer.WritePropertyName("failHealthCheckOnStagingFailure"u8); + writer.WriteStringValue(FailHealthCheckOnStagingFailure.Value.ToString()); + } + if (Optional.IsDefined(PackageOwnerName)) + { + writer.WritePropertyName("packageOwnerName"u8); + writer.WriteStringValue(PackageOwnerName); + } + if (Optional.IsDefined(PackageLookbackUri)) + { + writer.WritePropertyName("packageLookbackUrl"u8); + writer.WriteStringValue(PackageLookbackUri.AbsoluteUri); + } + if (Optional.IsDefined(CustomData)) + { + writer.WritePropertyName("customData"u8); + writer.WriteStringValue(CustomData); + } + writer.WriteEndObject(); } AppAttachPackageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -63,22 +109,24 @@ internal static AppAttachPackageData DeserializeAppAttachPackageData(JsonElement { return null; } - AppAttachPackageProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; + AppAttachPackageProvisioningState? provisioningState = default; + AppAttachPackageInfoProperties image = default; + IList hostPoolReferences = default; + string 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()) { - if (property.NameEquals("properties"u8)) - { - properties = AppAttachPackageProperties.DeserializeAppAttachPackageProperties(property.Value, options); - continue; - } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -122,6 +170,83 @@ internal static AppAttachPackageData DeserializeAppAttachPackageData(JsonElement 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("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AppAttachPackageProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("image"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + image = AppAttachPackageInfoProperties.DeserializeAppAttachPackageInfoProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("hostPoolReferences"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hostPoolReferences = array; + continue; + } + if (property0.NameEquals("keyVaultURL"u8)) + { + keyVaultURL = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("failHealthCheckOnStagingFailure"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + failHealthCheckOnStagingFailure = new FailHealthCheckOnStagingFailure(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("packageOwnerName"u8)) + { + packageOwnerName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("packageLookbackUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + packageLookbackUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("customData"u8)) + { + customData = property0.Value.GetString(); + continue; + } + } + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -135,7 +260,14 @@ internal static AppAttachPackageData DeserializeAppAttachPackageData(JsonElement systemData, tags ?? new ChangeTrackingDictionary(), location, - properties, + provisioningState, + image, + hostPoolReferences ?? new ChangeTrackingList(), + keyVaultURL, + failHealthCheckOnStagingFailure, + packageOwnerName, + packageLookbackUrl, + customData, serializedAdditionalRawData); } @@ -222,21 +354,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" properties: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Properties)) - { - builder.Append(" properties: "); - BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); - } - } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { @@ -267,6 +384,174 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + builder.Append(" properties:"); + builder.AppendLine(" {"); + 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(Image), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" image: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Image)) + { + builder.Append(" image: "); + BicepSerializationHelpers.AppendChildObject(builder, Image, options, 4, false, " image: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostPoolReferences), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hostPoolReferences: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(HostPoolReferences)) + { + if (HostPoolReferences.Any()) + { + builder.Append(" hostPoolReferences: "); + builder.AppendLine("["); + foreach (var item in HostPoolReferences) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultURL), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keyVaultURL: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KeyVaultURL)) + { + builder.Append(" keyVaultURL: "); + if (KeyVaultURL.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{KeyVaultURL}'''"); + } + else + { + builder.AppendLine($"'{KeyVaultURL}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FailHealthCheckOnStagingFailure), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" failHealthCheckOnStagingFailure: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FailHealthCheckOnStagingFailure)) + { + builder.Append(" failHealthCheckOnStagingFailure: "); + builder.AppendLine($"'{FailHealthCheckOnStagingFailure.Value.ToString()}'"); + } + } + + 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(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.cs index c13e57ba66fa..79d3490995b6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageData.cs @@ -53,13 +53,9 @@ public partial class AppAttachPackageData : TrackedResourceData /// Initializes a new instance of . /// The location. - /// Detailed properties for App Attach Package. - /// is null. - public AppAttachPackageData(AzureLocation location, AppAttachPackageProperties properties) : base(location) + public AppAttachPackageData(AzureLocation location) : base(location) { - Argument.AssertNotNull(properties, nameof(properties)); - - Properties = properties; + HostPoolReferences = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -69,11 +65,25 @@ public AppAttachPackageData(AzureLocation location, AppAttachPackageProperties p /// The systemData. /// The tags. /// The location. - /// Detailed properties for App Attach Package. + /// 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. + /// 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 AppAttachPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppAttachPackageProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal AppAttachPackageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppAttachPackageProvisioningState? provisioningState, AppAttachPackageInfoProperties image, IList hostPoolReferences, string keyVaultURL, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, string packageOwnerName, Uri packageLookbackUri, string customData, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - Properties = properties; + ProvisioningState = provisioningState; + Image = image; + HostPoolReferences = hostPoolReferences; + KeyVaultURL = keyVaultURL; + FailHealthCheckOnStagingFailure = failHealthCheckOnStagingFailure; + PackageOwnerName = packageOwnerName; + PackageLookbackUri = packageLookbackUri; + CustomData = customData; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -82,8 +92,29 @@ internal AppAttachPackageData() { } + /// The provisioning state of the App Attach Package. + [WirePath("properties.provisioningState")] + public AppAttachPackageProvisioningState? ProvisioningState { get; } /// Detailed properties for App Attach Package. - [WirePath("properties")] - public AppAttachPackageProperties Properties { get; set; } + [WirePath("properties.image")] + public AppAttachPackageInfoProperties Image { get; set; } + /// List of Hostpool resource Ids. + [WirePath("properties.hostPoolReferences")] + public IList HostPoolReferences { get; } + /// URL path to certificate name located in keyVault. + [WirePath("properties.keyVaultURL")] + public string KeyVaultURL { get; set; } + /// Parameter indicating how the health check should behave if this package fails staging. + [WirePath("properties.failHealthCheckOnStagingFailure")] + public FailHealthCheckOnStagingFailure? FailHealthCheckOnStagingFailure { get; set; } + /// Specific name of package owner, is "AppAttach" for native app attach packages. + [WirePath("properties.packageOwnerName")] + public string PackageOwnerName { get; set; } + /// Lookback url to third party control plane, is null for native app attach packages. + [WirePath("properties.packageLookbackUrl")] + public Uri PackageLookbackUri { get; set; } + /// Field that can be populated with custom data and filtered on in list GET calls. + [WirePath("properties.customData")] + public string CustomData { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/AppAttachPackageResource.cs index 61eb87ae10fa..b341983aee5e 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-04-01-preview /// /// /// Resource @@ -142,7 +143,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -182,7 +183,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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. + /// Allows force delete. /// 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-04-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. + /// Allows force delete. /// 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-04-01-preview /// /// /// Resource @@ -278,7 +281,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing App Attach Package definition. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(AppAttachPackagePatch patch, CancellationToken cancellationToken = default) @@ -312,7 +315,7 @@ public virtual async Task> UpdateAsync(AppAtt /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -320,7 +323,7 @@ public virtual async Task> UpdateAsync(AppAtt /// /// /// - /// Object containing App Attach Package definition. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(AppAttachPackagePatch patch, CancellationToken cancellationToken = default) @@ -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-04-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-04-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-04-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-04-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-04-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-04-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..2bd854ec363c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ArmDesktopVirtualizationModelFactory.cs @@ -17,133 +17,221 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models /// Model factory for models. public static partial class ArmDesktopVirtualizationModelFactory { - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// ObjectId of Workspace. (internal use). - /// Description of Workspace. - /// Friendly name of Workspace. - /// List of applicationGroup resource Ids. - /// 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. - /// 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. - 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) + /// 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. + /// 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 AppAttachPackageData AppAttachPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppAttachPackageProvisioningState? provisioningState = null, AppAttachPackageInfoProperties image = null, IEnumerable hostPoolReferences = null, string keyVaultURL = null, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = null, string packageOwnerName = null, Uri packageLookbackUri = null, string customData = null) { tags ??= new Dictionary(); - applicationGroupReferences ??= new List(); - privateEndpointConnections ??= new List(); + hostPoolReferences ??= new List(); - return new VirtualWorkspaceData( + return new AppAttachPackageData( id, name, resourceType, systemData, tags, location, - objectId, - description, - friendlyName, - applicationGroupReferences?.ToList(), - isCloudPCResource, - publicNetworkAccess, - privateEndpointConnections?.ToList(), - managedBy, - kind, - etag, - identity, - sku, - plan, + provisioningState, + image, + hostPoolReferences?.ToList(), + keyVaultURL, + failHealthCheckOnStagingFailure, + packageOwnerName, + packageLookbackUri, + customData, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The group ids for the private endpoint resource. - /// The private endpoint resource. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. - /// A new instance for mocking. - public static DesktopVirtualizationPrivateEndpointConnection DesktopVirtualizationPrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState = null, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = null) + /// The tags. + /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// ObjectId of ApplicationGroup. (internal use). + /// Description of ApplicationGroup. + /// Friendly name of ApplicationGroup. + /// HostPool arm path of ApplicationGroup. + /// Workspace arm path of ApplicationGroup. + /// Resource Type of ApplicationGroup. + /// Is cloud pc resource. + /// Boolean representing whether the applicationGroup is show in the feed. + /// 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, ManagedServiceIdentity identity = null, ETag? etag = null, string kind = null, string managedBy = null, ArmPlan plan = null, DesktopVirtualizationSku sku = null, string objectId = null, string description = null, string friendlyName = null, ResourceIdentifier hostPoolId = null, ResourceIdentifier workspaceId = null, VirtualApplicationGroupType applicationGroupType = default, bool? isCloudPCResource = null, bool? showInFeed = null) { - groupIds ??= new List(); + tags ??= new Dictionary(); - return new DesktopVirtualizationPrivateEndpointConnection( + return new VirtualApplicationGroupData( id, name, resourceType, systemData, - groupIds?.ToList(), - privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, - connectionState, - provisioningState, + tags, + location, + identity, + etag, + kind, + managedBy, + plan, + sku, + objectId, + description, + friendlyName, + hostPoolId, + workspaceId, + applicationGroupType, + isCloudPCResource, + showInFeed, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The group ids for the private endpoint resource. - /// The private endpoint resource. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. - /// A new instance for mocking. - public static DesktopVirtualizationPrivateEndpointConnectionDataData DesktopVirtualizationPrivateEndpointConnectionDataData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState = null, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = null) + /// The tags. + /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// 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. + /// 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 type of management for this hostpool, Automated or Standard. The default value is Automated. + /// 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, ManagedServiceIdentity identity = null, ETag? etag = null, string kind = null, string managedBy = null, ArmPlan plan = null, DesktopVirtualizationSku sku = null, 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, ManagedPrivateUDP? managedPrivateUDP = null, DirectUDP? directUDP = null, PublicUDP? publicUDP = null, RelayUDP? relayUDP = null, ManagementType? managementType = null) { - groupIds ??= new List(); + tags ??= new Dictionary(); + applicationGroupReferences ??= new List(); + appAttachPackageReferences ??= new List(); + privateEndpointConnections ??= new List(); - return new DesktopVirtualizationPrivateEndpointConnectionDataData( + return new HostPoolData( id, name, resourceType, systemData, - groupIds?.ToList(), - privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, - connectionState, - provisioningState, + tags, + location, + identity, + etag, + kind, + managedBy, + plan, + sku, + objectId, + friendlyName, + description, + hostPoolType, + personalDesktopAssignmentType, + customRdpProperty, + maxSessionLimit, + loadBalancerType, + ring, + isValidationEnvironment, + registrationInfo, + vmTemplate, + applicationGroupReferences?.ToList(), + appAttachPackageReferences?.ToList(), + ssoAdfsAuthority, + ssoClientId, + ssoClientSecretKeyVaultPath, + ssoSecretType, + preferredAppGroupType, + startVmOnConnect, + isCloudPCResource, + publicNetworkAccess, + agentUpdate, + privateEndpointConnections?.ToList(), + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, + managementType, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. - /// A new instance for mocking. - public static DesktopVirtualizationPrivateLinkResourceData DesktopVirtualizationPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + /// Resource properties. + /// A new instance for mocking. + public static DesktopVirtualizationPrivateEndpointConnection DesktopVirtualizationPrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PrivateEndpointConnectionProperties properties = null) { - requiredMembers ??= new List(); - requiredZoneNames ??= new List(); - - return new DesktopVirtualizationPrivateLinkResourceData( + return new DesktopVirtualizationPrivateEndpointConnection( id, name, resourceType, systemData, - groupId, - requiredMembers?.ToList(), - requiredZoneNames?.ToList(), + properties, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// A new instance for mocking. + public static PrivateEndpointConnectionProperties PrivateEndpointConnectionProperties(IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState = null, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = null) + { + groupIds ??= new List(); + + return new PrivateEndpointConnectionProperties(groupIds?.ToList(), privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, provisioningState, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -151,6 +239,12 @@ public static DesktopVirtualizationPrivateLinkResourceData DesktopVirtualization /// The systemData. /// The tags. /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. /// ObjectId of scaling plan. (internal use). /// Description of scaling plan. /// User friendly name of scaling plan. @@ -159,14 +253,8 @@ public static DesktopVirtualizationPrivateLinkResourceData DesktopVirtualization /// Exclusion tag for scaling plan. /// List of ScalingPlanPooledSchedule 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. - /// The resource model definition representing SKU. - /// Gets or sets the plan. /// 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) + public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, ETag? etag = null, string kind = null, string managedBy = null, ArmPlan plan = null, DesktopVirtualizationSku sku = null, string objectId = null, string description = null, string friendlyName = null, string timeZone = null, ScalingHostPoolType? scalingHostPoolType = null, string exclusionTag = null, IEnumerable schedules = null, IEnumerable hostPoolReferences = null) { tags ??= new Dictionary(); schedules ??= new List(); @@ -179,6 +267,12 @@ public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, stri systemData, tags, location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, description, friendlyName, @@ -187,288 +281,100 @@ public static ScalingPlanData ScalingPlanData(ResourceIdentifier id = null, stri exclusionTag, schedules?.ToList(), hostPoolReferences?.ToList(), - managedBy, - kind, - etag, - identity, - sku, - plan, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// 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. - 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) + /// The tags. + /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// ObjectId of Workspace. (internal use). + /// Description of Workspace. + /// Friendly name of Workspace. + /// List of applicationGroup resource Ids. + /// 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. + /// List of private endpoint connection associated with the specified 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, ManagedServiceIdentity identity = null, ETag? etag = null, string kind = null, string managedBy = null, ArmPlan plan = null, DesktopVirtualizationSku sku = null, string objectId = null, string description = null, string friendlyName = null, IEnumerable applicationGroupReferences = null, bool? isCloudPCResource = null, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess = null, IEnumerable privateEndpointConnections = null) { - daysOfWeek ??= new List(); + tags ??= new Dictionary(); + applicationGroupReferences ??= new List(); + privateEndpointConnections ??= new List(); - return new ScalingPlanPooledScheduleData( - id, - name, - resourceType, - systemData, - daysOfWeek?.ToList(), - rampUpStartTime, - rampUpLoadBalancingAlgorithm, - rampUpMinimumHostsPct, - rampUpCapacityThresholdPct, - peakStartTime, - peakLoadBalancingAlgorithm, - rampDownStartTime, - rampDownLoadBalancingAlgorithm, - rampDownMinimumHostsPct, - rampDownCapacityThresholdPct, - rampDownForceLogoffUsers, - rampDownStopHostsWhen, - rampDownWaitTimeMinutes, - rampDownNotificationMessage, - offPeakStartTime, - offPeakLoadBalancingAlgorithm, - 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. - 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) - { - daysOfWeek ??= new List(); - - return new ScalingPlanPooledSchedulePatch( - id, - name, - resourceType, - systemData, - daysOfWeek?.ToList(), - rampUpStartTime, - rampUpLoadBalancingAlgorithm, - rampUpMinimumHostsPct, - rampUpCapacityThresholdPct, - peakStartTime, - peakLoadBalancingAlgorithm, - rampDownStartTime, - rampDownLoadBalancingAlgorithm, - rampDownMinimumHostsPct, - rampDownCapacityThresholdPct, - rampDownForceLogoffUsers, - rampDownStopHostsWhen, - rampDownWaitTimeMinutes, - rampDownNotificationMessage, - offPeakStartTime, - offPeakLoadBalancingAlgorithm, - 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. - /// The desired startup behavior during the ramp up period for personal vms in the hostpool. - /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. - /// Action to be taken after a user disconnect during the ramp up period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. - /// Action to be taken after a logoff during the ramp up period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. - /// Starting time for peak period. - /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. - /// Action to be taken after a user disconnect during the peak period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. - /// Action to be taken after a logoff during the peak period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. - /// Starting time for ramp down period. - /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. - /// Action to be taken after a user disconnect during the ramp down period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. - /// Action to be taken after a logoff during the ramp down period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. - /// Starting time for off-peak period. - /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. - /// Action to be taken after a user disconnect during the off-peak period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. - /// Action to be taken after a logoff during the off-peak period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. - /// A new instance for mocking. - public static ScalingPlanPersonalScheduleData ScalingPlanPersonalScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable daysOfWeek = null, ScalingActionTime rampUpStartTime = null, StartupBehavior? rampUpAutoStartHosts = null, SetStartVmOnConnect? rampUpStartVmOnConnect = null, SessionHandlingOperation? rampUpActionOnDisconnect = null, int? rampUpMinutesToWaitOnDisconnect = null, SessionHandlingOperation? rampUpActionOnLogoff = null, int? rampUpMinutesToWaitOnLogoff = null, ScalingActionTime peakStartTime = null, SetStartVmOnConnect? peakStartVmOnConnect = null, SessionHandlingOperation? peakActionOnDisconnect = null, int? peakMinutesToWaitOnDisconnect = null, SessionHandlingOperation? peakActionOnLogoff = null, int? peakMinutesToWaitOnLogoff = null, ScalingActionTime rampDownStartTime = null, SetStartVmOnConnect? rampDownStartVmOnConnect = null, SessionHandlingOperation? rampDownActionOnDisconnect = null, int? rampDownMinutesToWaitOnDisconnect = null, SessionHandlingOperation? rampDownActionOnLogoff = null, int? rampDownMinutesToWaitOnLogoff = null, ScalingActionTime offPeakStartTime = null, SetStartVmOnConnect? offPeakStartVmOnConnect = null, SessionHandlingOperation? offPeakActionOnDisconnect = null, int? offPeakMinutesToWaitOnDisconnect = null, SessionHandlingOperation? offPeakActionOnLogoff = null, int? offPeakMinutesToWaitOnLogoff = null) - { - daysOfWeek ??= new List(); - - return new ScalingPlanPersonalScheduleData( - id, - name, - resourceType, - systemData, - daysOfWeek?.ToList(), - rampUpStartTime, - rampUpAutoStartHosts, - rampUpStartVmOnConnect, - rampUpActionOnDisconnect, - rampUpMinutesToWaitOnDisconnect, - rampUpActionOnLogoff, - rampUpMinutesToWaitOnLogoff, - peakStartTime, - peakStartVmOnConnect, - peakActionOnDisconnect, - peakMinutesToWaitOnDisconnect, - peakActionOnLogoff, - peakMinutesToWaitOnLogoff, - rampDownStartTime, - rampDownStartVmOnConnect, - rampDownActionOnDisconnect, - rampDownMinutesToWaitOnDisconnect, - rampDownActionOnLogoff, - rampDownMinutesToWaitOnLogoff, - offPeakStartTime, - offPeakStartVmOnConnect, - offPeakActionOnDisconnect, - offPeakMinutesToWaitOnDisconnect, - offPeakActionOnLogoff, - offPeakMinutesToWaitOnLogoff, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// ObjectId of ApplicationGroup. (internal use). - /// Description of ApplicationGroup. - /// Friendly name of ApplicationGroup. - /// HostPool arm path of ApplicationGroup. - /// Workspace arm path of ApplicationGroup. - /// Resource Type of ApplicationGroup. - /// Is cloud pc resource. - /// Boolean representing whether the applicationGroup is show in the feed. - /// 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. - 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) - { - tags ??= new Dictionary(); - - return new VirtualApplicationGroupData( + return new VirtualWorkspaceData( id, name, resourceType, systemData, tags, location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, description, friendlyName, - hostPoolId, - workspaceId, - applicationGroupType, + applicationGroupReferences?.ToList(), isCloudPCResource, - showInFeed, - managedBy, - kind, - etag, - identity, - sku, - plan, + publicNetworkAccess, + privateEndpointConnections?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// tags to be updated. - /// Description of ApplicationGroup. - /// Friendly name of ApplicationGroup. - /// Boolean representing whether the applicationGroup is show in the feed. - /// A new instance for mocking. - public static VirtualApplicationGroupPatch VirtualApplicationGroupPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, string description = null, string friendlyName = null, bool? showInFeed = null) + /// 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, IDictionary tags = null, AppAttachPackagePatchProperties properties = null) { tags ??= new Dictionary(); - return new VirtualApplicationGroupPatch( + return new AppAttachPackagePatch( id, name, resourceType, systemData, tags, - description, - friendlyName, - showInFeed, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Alias of StartMenuItem. - /// Path to the file of StartMenuItem. - /// Command line arguments for StartMenuItem. - /// Path to the icon. - /// Index of the icon. - /// A new instance for mocking. - public static DesktopVirtualizationStartMenuItem DesktopVirtualizationStartMenuItem(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string appAlias = null, string filePath = null, string commandLineArguments = null, string iconPath = null, int? iconIndex = null) + /// tags to be updated. + /// ApplicationGroup properties that can be patched. + /// A new instance for mocking. + public static VirtualApplicationGroupPatch VirtualApplicationGroupPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, ApplicationGroupPatchProperties properties = null) { - return new DesktopVirtualizationStartMenuItem( + tags ??= new Dictionary(); + + return new VirtualApplicationGroupPatch( id, name, resourceType, systemData, - appAlias, - filePath, - commandLineArguments, - iconPath, - iconIndex, + tags, + properties, serializedAdditionalRawData: null); } @@ -542,172 +448,372 @@ public static VirtualDesktopData VirtualDesktopData(ResourceIdentifier id = null serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// 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. - 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) + /// Detailed properties for StartMenuItem. + /// A new instance for mocking. + public static DesktopVirtualizationStartMenuItem DesktopVirtualizationStartMenuItem(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, StartMenuItemProperties properties = null) + { + return new DesktopVirtualizationStartMenuItem( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// tags to be updated. + /// HostPool properties that can be patched. + /// A new instance for mocking. + public static HostPoolPatch HostPoolPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, HostPoolPatchProperties properties = null) { tags ??= new Dictionary(); - applicationGroupReferences ??= new List(); - appAttachPackageReferences ??= new List(); - privateEndpointConnections ??= new List(); - return new HostPoolData( + return new HostPoolPatch( id, name, resourceType, systemData, tags, - location, - objectId, - friendlyName, - description, - hostPoolType, - personalDesktopAssignmentType, - customRdpProperty, - maxSessionLimit, - loadBalancerType, - ring, - isValidationEnvironment, - registrationInfo, - vmTemplate, - applicationGroupReferences?.ToList(), - appAttachPackageReferences?.ToList(), - ssoAdfsAuthority, - ssoClientId, - ssoClientSecretKeyVaultPath, - ssoSecretType, - preferredAppGroupType, - startVmOnConnect, - isCloudPCResource, - publicNetworkAccess, - agentUpdate, - privateEndpointConnections?.ToList(), - managedBy, - kind, - etag, - identity, - sku, - plan, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// 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. - 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) + /// 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 the 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, VirtualMachineDiskType? virtualMachineDiskType = null, Uri customConfigurationScriptUri = null, ImageInfoProperties imageInfo = null, DomainInfoProperties domainInfo = null, SecurityInfoProperties securityInfo = null, KeyVaultCredentialsProperties vmAdminCredentials = null, BootDiagnosticsInfoProperties bootDiagnosticsInfo = null) { - tags ??= new Dictionary(); + vmTags ??= new Dictionary(); + availabilityZones ??= new List(); - return new HostPoolPatch( + return new ActiveSessionHostConfigurationData( id, name, resourceType, systemData, - tags, + version, friendlyName, - description, - customRdpProperty, - maxSessionLimit, - personalDesktopAssignmentType, - loadBalancerType, - ring, - isValidationEnvironment, - registrationInfo, - vmTemplate, - ssoAdfsAuthority, - ssoClientId, - ssoClientSecretKeyVaultPath, - ssoSecretType, - preferredAppGroupType, - startVmOnConnect, - publicNetworkAccess, - agentUpdate, + vmTags, + vmLocation, + vmResourceGroup, + vmNamePrefix, + availabilityZones?.ToList(), + networkInfo, + vmSizeId, + virtualMachineDiskType.HasValue ? new DiskInfoProperties(virtualMachineDiskType.Value, serializedAdditionalRawData: null) : null, + customConfigurationScriptUri, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// ObjectId of user session. (internal use). - /// The user principal name. - /// Application type of application. - /// State of user session. - /// The active directory user name. - /// The timestamp of the user session create. - /// A new instance for mocking. - public static UserSessionData UserSessionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string objectId = null, string userPrincipalName = null, VirtualApplicationType? applicationType = null, UserSessionState? sessionState = null, string activeDirectoryUserName = null, DateTimeOffset? createOn = null) + /// Detailed properties for ExpandMsixImage. + /// A new instance for mocking. + public static ExpandMsixImage ExpandMsixImage(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ExpandMsixImageProperties properties = null) { - return new UserSessionData( + return new ExpandMsixImage( id, name, resourceType, systemData, - objectId, - userPrincipalName, - applicationType, - sessionState, - activeDirectoryUserName, - createOn, + properties, + 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. + /// The resourceType. + /// The systemData. + /// VHD/CIM image path on Network Share. + /// Package Name from appxmanifest.xml. + /// Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. + /// 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. + /// List of package applications. + /// A new instance for mocking. + public static MsixPackageData MsixPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string imagePath = null, string packageName = null, string packageFamilyName = null, string displayName = null, string packageRelativePath = null, bool? isRegularRegistration = null, bool? isActive = null, IEnumerable packageDependencies = null, string version = null, DateTimeOffset? lastUpdatedOn = null, IEnumerable packageApplications = null) + { + packageDependencies ??= new List(); + packageApplications ??= new List(); + + return new MsixPackageData( + id, + name, + resourceType, + systemData, + imagePath, + packageName, + packageFamilyName, + displayName, + packageRelativePath, + isRegularRegistration, + isActive, + packageDependencies?.ToList(), + version, + lastUpdatedOn, + packageApplications?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Detailed properties for MSIX Package. + /// A new instance for mocking. + public static MsixPackagePatch MsixPackagePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MsixPackagePatchProperties properties = null) + { + return new MsixPackagePatch( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// A new instance for mocking. + public static DesktopVirtualizationPrivateEndpointConnectionDataData DesktopVirtualizationPrivateEndpointConnectionDataData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable groupIds = null, ResourceIdentifier privateEndpointId = null, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState = null, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = null) + { + groupIds ??= new List(); + + return new DesktopVirtualizationPrivateEndpointConnectionDataData( + id, + name, + resourceType, + systemData, + groupIds?.ToList(), + privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, + connectionState, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource properties. + /// A new instance for mocking. + public static DesktopVirtualizationPrivateLinkResourceData DesktopVirtualizationPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DesktopVirtualizationPrivateLinkResourceProperties properties = null) + { + return new DesktopVirtualizationPrivateLinkResourceData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource Private link DNS zone name. + /// A new instance for mocking. + public static DesktopVirtualizationPrivateLinkResourceProperties DesktopVirtualizationPrivateLinkResourceProperties(string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + { + requiredMembers ??= new List(); + requiredZoneNames ??= new List(); + + return new DesktopVirtualizationPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), 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, VirtualMachineDiskType? virtualMachineDiskType = 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, + virtualMachineDiskType.HasValue ? new DiskInfoProperties(virtualMachineDiskType.Value, serializedAdditionalRawData: null) : null, + customConfigurationScriptUri, + imageInfo, + domainInfo, + securityInfo, + vmAdminCredentials, + bootDiagnosticsInfo, + 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. + /// 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) + { + return new SessionHostManagementData( + id, + name, + resourceType, + systemData, + scheduledDateTimeZone, + update, + 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 . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// 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. + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + /// Properties bag to hold custom RP properties for sessionHostManagement Update Statuses. + /// A new instance for mocking. + public static SessionHostManagementUpdateStatus SessionHostManagementUpdateStatus(ResourceIdentifier id = null, string name = null, double? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, ResponseError error = null, SessionHostManagementUpdateOperationStatus status = default, SessionHostManagementUpdateStatusProperties properties = null) + { + return new SessionHostManagementUpdateStatus( + id, + name, + percentComplete, + startOn, + endOn, + error, + status, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The 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 SessionHostManagementUpdateStatusProperties SessionHostManagementUpdateStatusProperties(string correlationId = null, SessionHostManagementOperationProgress progress = null, DateTimeOffset? scheduledOn = null, SessionHostManagementData sessionHostManagement = null) + { + return new SessionHostManagementUpdateStatusProperties(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); } @@ -716,6 +822,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 +841,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 +854,9 @@ public static SessionHostData SessionHostData(ResourceIdentifier id = null, stri name, resourceType, systemData, + activeSessions, + disconnectedSessions, + pendingSessions, objectId, lastHeartBeatOn, sessions, @@ -759,6 +873,8 @@ public static SessionHostData SessionHostData(ResourceIdentifier id = null, stri updateState, lastUpdatedOn, updateErrorMessage, + lastSessionHostUpdateOn, + sessionHostConfiguration, sessionHostHealthCheckResults?.ToList(), serializedAdditionalRawData: null); } @@ -788,189 +904,185 @@ public static SessionHostHealthCheckFailureDetails SessionHostHealthCheckFailure /// The name. /// The resourceType. /// The systemData. - /// Allow a new session. - /// User assigned to SessionHost. - /// Friendly name of SessionHost. + /// Detailed properties for SessionHost. /// A new instance for mocking. - public static SessionHostPatch SessionHostPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? allowNewSession = null, string assignedUser = null, string friendlyName = null) + public static SessionHostPatch SessionHostPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SessionHostPatchProperties properties = null) { return new SessionHostPatch( id, name, resourceType, systemData, - allowNewSession, - assignedUser, - friendlyName, + properties, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// VHD/CIM image path on Network Share. - /// Package Name from appxmanifest.xml. - /// Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - /// 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. - /// List of package applications. - /// A new instance for mocking. - public static MsixPackageData MsixPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string imagePath = null, string packageName = null, string packageFamilyName = null, string displayName = null, string packageRelativePath = null, bool? isRegularRegistration = null, bool? isActive = null, IEnumerable packageDependencies = null, string version = null, DateTimeOffset? lastUpdatedOn = null, IEnumerable packageApplications = null) - { - packageDependencies ??= new List(); - packageApplications ??= new List(); - - return new MsixPackageData( - id, - name, - resourceType, - systemData, - imagePath, - packageName, - packageFamilyName, - displayName, - packageRelativePath, - isRegularRegistration, - isActive, - packageDependencies?.ToList(), - version, - lastUpdatedOn, - packageApplications?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Set a version of the package to be active across hostpool. - /// Set Registration mode. Regular or Delayed. - /// Display name for MSIX Package. - /// A new instance for mocking. - public static MsixPackagePatch MsixPackagePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isActive = null, bool? isRegularRegistration = null, string displayName = null) + /// ObjectId of user session. (internal use). + /// The user principal name. + /// Application type of application. + /// State of user session. + /// The active directory user name. + /// The timestamp of the user session create. + /// A new instance for mocking. + public static UserSessionData UserSessionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string objectId = null, string userPrincipalName = null, VirtualApplicationType? applicationType = null, UserSessionState? sessionState = null, string activeDirectoryUserName = null, DateTimeOffset? createOn = null) { - return new MsixPackagePatch( + return new UserSessionData( id, name, resourceType, systemData, - isActive, - isRegularRegistration, - displayName, + objectId, + userPrincipalName, + applicationType, + sessionState, + activeDirectoryUserName, + createOn, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// Detailed properties for App Attach Package. - /// A new instance for mocking. - public static AppAttachPackageData AppAttachPackageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppAttachPackageProperties properties = null) + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// The desired startup behavior during the ramp up period for personal vms in the hostpool. + /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. + /// Action to be taken after a user disconnect during the ramp up period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. + /// Action to be taken after a logoff during the ramp up period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. + /// Starting time for peak period. + /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. + /// Action to be taken after a user disconnect during the peak period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. + /// Action to be taken after a logoff during the peak period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. + /// Starting time for ramp down period. + /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. + /// Action to be taken after a user disconnect during the ramp down period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. + /// Action to be taken after a logoff during the ramp down period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. + /// Starting time for off-peak period. + /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. + /// Action to be taken after a user disconnect during the off-peak period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. + /// Action to be taken after a logoff during the off-peak period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. + /// A new instance for mocking. + public static ScalingPlanPersonalScheduleData ScalingPlanPersonalScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable daysOfWeek = null, ScalingActionTime rampUpStartTime = null, StartupBehavior? rampUpAutoStartHosts = null, SetStartVmOnConnect? rampUpStartVmOnConnect = null, SessionHandlingOperation? rampUpActionOnDisconnect = null, int? rampUpMinutesToWaitOnDisconnect = null, SessionHandlingOperation? rampUpActionOnLogoff = null, int? rampUpMinutesToWaitOnLogoff = null, ScalingActionTime peakStartTime = null, SetStartVmOnConnect? peakStartVmOnConnect = null, SessionHandlingOperation? peakActionOnDisconnect = null, int? peakMinutesToWaitOnDisconnect = null, SessionHandlingOperation? peakActionOnLogoff = null, int? peakMinutesToWaitOnLogoff = null, ScalingActionTime rampDownStartTime = null, SetStartVmOnConnect? rampDownStartVmOnConnect = null, SessionHandlingOperation? rampDownActionOnDisconnect = null, int? rampDownMinutesToWaitOnDisconnect = null, SessionHandlingOperation? rampDownActionOnLogoff = null, int? rampDownMinutesToWaitOnLogoff = null, ScalingActionTime offPeakStartTime = null, SetStartVmOnConnect? offPeakStartVmOnConnect = null, SessionHandlingOperation? offPeakActionOnDisconnect = null, int? offPeakMinutesToWaitOnDisconnect = null, SessionHandlingOperation? offPeakActionOnLogoff = null, int? offPeakMinutesToWaitOnLogoff = null) { - tags ??= new Dictionary(); + daysOfWeek ??= new List(); - return new AppAttachPackageData( + return new ScalingPlanPersonalScheduleData( id, name, resourceType, systemData, - tags, - location, - properties, - serializedAdditionalRawData: null); - } - - /// 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. - public static AppAttachPackageProperties AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState = null, AppAttachPackageInfoProperties image = null, IEnumerable hostPoolReferences = null, Uri keyVaultUri = null, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = null) - { - hostPoolReferences ??= new List(); - - return new AppAttachPackageProperties( - provisioningState, - image, - hostPoolReferences?.ToList(), - keyVaultUri, - failHealthCheckOnStagingFailure, + daysOfWeek?.ToList(), + rampUpStartTime, + rampUpAutoStartHosts, + rampUpStartVmOnConnect, + rampUpActionOnDisconnect, + rampUpMinutesToWaitOnDisconnect, + rampUpActionOnLogoff, + rampUpMinutesToWaitOnLogoff, + peakStartTime, + peakStartVmOnConnect, + peakActionOnDisconnect, + peakMinutesToWaitOnDisconnect, + peakActionOnLogoff, + peakMinutesToWaitOnLogoff, + rampDownStartTime, + rampDownStartVmOnConnect, + rampDownActionOnDisconnect, + rampDownMinutesToWaitOnDisconnect, + rampDownActionOnLogoff, + rampDownMinutesToWaitOnLogoff, + offPeakStartTime, + offPeakStartVmOnConnect, + offPeakActionOnDisconnect, + offPeakMinutesToWaitOnDisconnect, + offPeakActionOnLogoff, + offPeakMinutesToWaitOnLogoff, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// Alias of MSIX Package. - /// VHD/CIM 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. - /// 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. - /// List of package applications. - /// Certificate name found in the appxmanifest.xml. - /// Date certificate expires, found in the appxmanifest.xml. - /// A new instance for mocking. - public static ExpandMsixImage ExpandMsixImage(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string packageAlias = null, string imagePath = null, string packageName = null, string packageFamilyName = null, string packageFullName = null, string displayName = null, string packageRelativePath = null, bool? isRegularRegistration = null, bool? isActive = null, IEnumerable packageDependencies = null, string version = null, DateTimeOffset? lastUpdatedOn = null, IEnumerable packageApplications = null, string certificateName = null, DateTimeOffset? certificateExpiry = null) + /// 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. + /// 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. + public static ScalingPlanPooledScheduleData ScalingPlanPooledScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string namePropertiesName = null, IEnumerable daysOfWeek = null, ScalingMethodType? 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) { - packageDependencies ??= new List(); - packageApplications ??= new List(); + daysOfWeek ??= new List(); - return new ExpandMsixImage( + return new ScalingPlanPooledScheduleData( id, name, resourceType, systemData, - packageAlias, - imagePath, - packageName, - packageFamilyName, - packageFullName, - displayName, - packageRelativePath, - isRegularRegistration, - isActive, - packageDependencies?.ToList(), - version, - lastUpdatedOn, - packageApplications?.ToList(), - certificateName, - certificateExpiry, + namePropertiesName, + daysOfWeek?.ToList(), + scalingMethod, + createDelete, + rampUpStartTime, + rampUpLoadBalancingAlgorithm, + rampUpMinimumHostsPct, + rampUpCapacityThresholdPct, + peakStartTime, + peakLoadBalancingAlgorithm, + rampDownStartTime, + rampDownLoadBalancingAlgorithm, + rampDownMinimumHostsPct, + rampDownCapacityThresholdPct, + rampDownForceLogoffUsers, + rampDownStopHostsWhen, + rampDownWaitTimeMinutes, + rampDownNotificationMessage, + offPeakStartTime, + offPeakLoadBalancingAlgorithm, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// 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) + /// Detailed properties for ScalingPlanPooledSchedule. + /// A new instance for mocking. + public static ScalingPlanPooledSchedulePatch ScalingPlanPooledSchedulePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ScalingPlanPooledSchedulePatchProperties properties = null) { - return new AppAttachPackagePatch( + return new ScalingPlanPooledSchedulePatch( id, name, resourceType, @@ -979,151 +1091,125 @@ public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id serializedAdditionalRawData: null); } - /// 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. - /// 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. - /// The session host configuration for updating agent, monitoring agent, and stack component. - /// 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. - [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); - } - - /// Initializes a new instance of HostPoolPatch. - /// 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. - /// The session host configuration for updating agent, monitoring agent, and stack component. - [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) + /// 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. + /// 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. + public static ScalingPlanPooledSchedulePatchProperties ScalingPlanPooledSchedulePatchProperties(string name = null, IEnumerable daysOfWeek = null, ScalingMethodType? 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) { - 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); - } + daysOfWeek ??= new List(); - /// Initializes a new instance of VirtualApplicationGroupData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// ObjectId of ApplicationGroup. (internal use). - /// Description of ApplicationGroup. - /// Friendly name of ApplicationGroup. - /// HostPool arm path of ApplicationGroup. - /// Workspace arm path of ApplicationGroup. - /// Resource Type of ApplicationGroup. - /// Is cloud pc 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. - [EditorBrowsable(EditorBrowsableState.Never)] - public static VirtualApplicationGroupData 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, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan) - { - return VirtualApplicationGroupData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, description: description, friendlyName: friendlyName, hostPoolId: hostPoolId, workspaceId: workspaceId, applicationGroupType: applicationGroupType, isCloudPCResource: isCloudPCResource, showInFeed: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); + return new ScalingPlanPooledSchedulePatchProperties( + name, + daysOfWeek?.ToList(), + scalingMethod, + createDelete, + rampUpStartTime, + rampUpLoadBalancingAlgorithm, + rampUpMinimumHostsPct, + rampUpCapacityThresholdPct, + peakStartTime, + peakLoadBalancingAlgorithm, + rampDownStartTime, + rampDownLoadBalancingAlgorithm, + rampDownMinimumHostsPct, + rampDownCapacityThresholdPct, + rampDownForceLogoffUsers, + rampDownStopHostsWhen, + rampDownWaitTimeMinutes, + rampDownNotificationMessage, + offPeakStartTime, + offPeakLoadBalancingAlgorithm, + serializedAdditionalRawData: null); } - /// Initializes a new instance of VirtualApplicationGroupPatch. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// tags to be updated. - /// Description of ApplicationGroup. - /// Friendly name of ApplicationGroup. + /// 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 VirtualApplicationGroupPatch VirtualApplicationGroupPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string description, string friendlyName) + 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 VirtualApplicationGroupPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, description: description, friendlyName: friendlyName, showInFeed: default); + 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 VirtualWorkspaceData. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// ObjectId of Workspace. (internal use). - /// Description of Workspace. - /// Friendly name of Workspace. - /// List of applicationGroup resource Ids. - /// Is cloud pc 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. + /// 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 VirtualWorkspaceData VirtualWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string objectId, string description, string friendlyName, IEnumerable applicationGroupReferences, bool? isCloudPCResource, ResourceIdentifier managedBy, string kind, ETag? etag, ManagedServiceIdentity identity, DesktopVirtualizationSku sku, ArmPlan plan) + 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 VirtualWorkspaceData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, objectId: objectId, description: description, friendlyName: friendlyName, applicationGroupReferences: applicationGroupReferences, isCloudPCResource: isCloudPCResource, publicNetworkAccess: default, privateEndpointConnections: default, managedBy: managedBy, kind: kind, etag: etag, identity: identity, sku: sku, plan: plan); + 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 DesktopVirtualizationPrivateEndpointConnection. + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The resource of private end point. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. - /// A new instance for mocking. + /// Detailed properties for App Attach Package. + /// A new instance for mocking. [EditorBrowsable(EditorBrowsableState.Never)] - public static DesktopVirtualizationPrivateEndpointConnection DesktopVirtualizationPrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier privateEndpointId, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState) + public static AppAttachPackagePatch AppAttachPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AppAttachPackagePatchProperties properties) { - return DesktopVirtualizationPrivateEndpointConnection(id: id, name: name, resourceType: resourceType, systemData: systemData, groupIds: default, privateEndpointId: privateEndpointId, connectionState: connectionState, provisioningState: provisioningState); + return AppAttachPackagePatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: default, properties: properties); } /// Initializes a new instance of DesktopVirtualizationPrivateEndpointConnectionDataData. @@ -1140,73 +1226,5 @@ public static DesktopVirtualizationPrivateEndpointConnectionDataData DesktopVirt { return DesktopVirtualizationPrivateEndpointConnectionDataData(id: id, name: name, resourceType: resourceType, systemData: systemData, groupIds: default, privateEndpointId: privateEndpointId, connectionState: connectionState, provisioningState: provisioningState); } - - /// Initializes a new instance of HostPoolData. - /// 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. - /// 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, 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); - } - - /// Initializes a new instance of ExpandMsixImage. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Alias of MSIX Package. - /// VHD/CIM 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. - /// 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. - /// List of package applications. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static ExpandMsixImage ExpandMsixImage(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string packageAlias, string imagePath, string packageName, string packageFamilyName, string packageFullName, string displayName, string packageRelativePath, bool? isRegularRegistration, bool? isActive, IEnumerable packageDependencies, string version, DateTimeOffset? lastUpdatedOn, IEnumerable packageApplications) - { - return ExpandMsixImage(id: id, name: name, resourceType: resourceType, systemData: systemData, packageAlias: packageAlias, imagePath: imagePath, packageName: packageName, packageFamilyName: packageFamilyName, packageFullName: packageFullName, displayName: displayName, packageRelativePath: packageRelativePath, isRegularRegistration: isRegularRegistration, isActive: isActive, packageDependencies: packageDependencies, version: version, lastUpdatedOn: lastUpdatedOn, packageApplications: packageApplications, certificateName: default, certificateExpiry: default); - } } } 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..b2ada7bccabb 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs @@ -33,60 +33,60 @@ private static MockableDesktopVirtualizationSubscriptionResource GetMockableDesk } /// - /// 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. + /// 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. + /// 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 VirtualWorkspaceResource GetVirtualWorkspaceResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static AppAttachPackageResource GetAppAttachPackageResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetVirtualWorkspaceResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetAppAttachPackageResource(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. + /// 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. + /// 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 WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VirtualApplicationGroupResource GetVirtualApplicationGroupResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetWorkspacePrivateEndpointConnectionResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationGroupResource(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. + /// 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. + /// 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 HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static HostPoolResource GetHostPoolResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolPrivateEndpointConnectionResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolResource(id); } /// @@ -109,136 +109,174 @@ public static ScalingPlanResource GetScalingPlanResource(this ArmClient client, } /// - /// 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. + /// 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. + /// 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 ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VirtualWorkspaceResource GetVirtualWorkspaceResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPooledScheduleResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualWorkspaceResource(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. + /// 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. + /// 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 ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VirtualApplicationResource GetVirtualApplicationResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPersonalScheduleResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationResource(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. + /// 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. + /// 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 VirtualApplicationGroupResource GetVirtualApplicationGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VirtualDesktopResource GetVirtualDesktopResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationGroupResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetVirtualDesktopResource(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. + /// 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. + /// 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 VirtualApplicationResource GetVirtualApplicationResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ActiveSessionHostConfigurationResource GetActiveSessionHostConfigurationResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetVirtualApplicationResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetActiveSessionHostConfigurationResource(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. + /// 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. + /// 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 VirtualDesktopResource GetVirtualDesktopResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static MsixPackageResource GetMsixPackageResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetVirtualDesktopResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetMsixPackageResource(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. + /// 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. + /// 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 HostPoolResource GetHostPoolResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetHostPoolPrivateEndpointConnectionResource(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. + /// 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. + /// 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 UserSessionResource GetUserSessionResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetUserSessionResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetWorkspacePrivateEndpointConnectionResource(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 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); } /// @@ -261,755 +299,776 @@ public static SessionHostResource GetSessionHostResource(this ArmClient client, } /// - /// 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. + /// 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. + /// 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 MsixPackageResource GetMsixPackageResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static UserSessionResource GetUserSessionResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetMsixPackageResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetUserSessionResource(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. + /// 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. + /// 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 AppAttachPackageResource GetAppAttachPackageResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableDesktopVirtualizationArmClient(client).GetAppAttachPackageResource(id); + return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPersonalScheduleResource(id); } /// - /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. + /// 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. + /// 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 ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDesktopVirtualizationArmClient(client).GetScalingPlanPooledScheduleResource(id); + } + + /// + /// Gets a collection of AppAttachPackageResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. - public static VirtualWorkspaceCollection GetVirtualWorkspaces(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of AppAttachPackageResources and their operations over a AppAttachPackageResource. + public static AppAttachPackageCollection GetAppAttachPackages(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaces(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackages(); } /// - /// Get a workspace. + /// Get an app attach package. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} /// /// /// Operation Id - /// Workspaces_Get + /// AppAttachPackage_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the workspace. + /// The name of the App Attach package. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetVirtualWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + public static async Task> GetAppAttachPackageAsync(this ResourceGroupResource resourceGroupResource, string appAttachPackageName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackageAsync(appAttachPackageName, cancellationToken).ConfigureAwait(false); } /// - /// Get a workspace. + /// Get an app attach package. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} /// /// /// Operation Id - /// Workspaces_Get + /// AppAttachPackage_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the workspace. + /// The name of the App Attach package. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetVirtualWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + public static Response GetAppAttachPackage(this ResourceGroupResource resourceGroupResource, string appAttachPackageName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspace(workspaceName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackage(appAttachPackageName, cancellationToken); } /// - /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. + /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. - public static ScalingPlanCollection GetScalingPlans(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. + public static VirtualApplicationGroupCollection GetVirtualApplicationGroups(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlans(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroups(); } /// - /// Get a scaling plan. + /// Get an application group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} /// /// /// Operation Id - /// ScalingPlans_Get + /// ApplicationGroups_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the scaling plan. + /// The name of the application group. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetScalingPlanAsync(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) + public static async Task> GetVirtualApplicationGroupAsync(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlanAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroupAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Get a scaling plan. + /// Get an application group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} /// /// /// Operation Id - /// ScalingPlans_Get + /// ApplicationGroups_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the scaling plan. + /// The name of the application group. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetScalingPlan(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) + public static Response GetVirtualApplicationGroup(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlan(scalingPlanName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroup(applicationGroupName, cancellationToken); } /// - /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. + /// Gets a collection of HostPoolResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. - public static VirtualApplicationGroupCollection GetVirtualApplicationGroups(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. + public static HostPoolCollection GetHostPools(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroups(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPools(); } /// - /// Get an application group. + /// Get a host pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} /// /// /// Operation Id - /// ApplicationGroups_Get + /// HostPools_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the application group. + /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetVirtualApplicationGroupAsync(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) + public static async Task> GetHostPoolAsync(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroupAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPoolAsync(hostPoolName, cancellationToken).ConfigureAwait(false); } /// - /// Get an application group. + /// Get a host pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} /// /// /// Operation Id - /// ApplicationGroups_Get + /// HostPools_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the application group. + /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetVirtualApplicationGroup(this ResourceGroupResource resourceGroupResource, string applicationGroupName, CancellationToken cancellationToken = default) + public static Response GetHostPool(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualApplicationGroup(applicationGroupName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPool(hostPoolName, cancellationToken); } /// - /// Gets a collection of HostPoolResources in the ResourceGroupResource. + /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. - public static HostPoolCollection GetHostPools(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. + public static ScalingPlanCollection GetScalingPlans(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPools(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlans(); } /// - /// Get a host pool. + /// Get a scaling plan. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} /// /// /// Operation Id - /// HostPools_Get + /// ScalingPlans_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the host pool within the specified resource group. + /// The name of the scaling plan. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetHostPoolAsync(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) + public static async Task> GetScalingPlanAsync(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPoolAsync(hostPoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlanAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); } /// - /// Get a host pool. + /// Get a scaling plan. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} /// /// /// Operation Id - /// HostPools_Get + /// ScalingPlans_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the host pool within the specified resource group. + /// The name of the scaling plan. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetHostPool(this ResourceGroupResource resourceGroupResource, string hostPoolName, CancellationToken cancellationToken = default) + public static Response GetScalingPlan(this ResourceGroupResource resourceGroupResource, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetHostPool(hostPoolName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetScalingPlan(scalingPlanName, cancellationToken); } /// - /// Gets a collection of AppAttachPackageResources in the ResourceGroupResource. + /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of AppAttachPackageResources and their operations over a AppAttachPackageResource. - public static AppAttachPackageCollection GetAppAttachPackages(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. + public static VirtualWorkspaceCollection GetVirtualWorkspaces(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackages(); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaces(); } /// - /// Get an app attach package. + /// Get a workspace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} /// /// /// Operation Id - /// AppAttachPackage_Get + /// Workspaces_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the App Attach package. + /// The name of the workspace. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetAppAttachPackageAsync(this ResourceGroupResource resourceGroupResource, string appAttachPackageName, CancellationToken cancellationToken = default) + public static async Task> GetVirtualWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackageAsync(appAttachPackageName, cancellationToken).ConfigureAwait(false); + return await GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// - /// Get an app attach package. + /// Get a workspace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} /// /// /// Operation Id - /// AppAttachPackage_Get + /// Workspaces_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the App Attach package. + /// The name of the workspace. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetAppAttachPackage(this ResourceGroupResource resourceGroupResource, string appAttachPackageName, CancellationToken cancellationToken = default) + public static Response GetVirtualWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetAppAttachPackage(appAttachPackageName, cancellationToken); + return GetMockableDesktopVirtualizationResourceGroupResource(resourceGroupResource).GetVirtualWorkspace(workspaceName, cancellationToken); } /// - /// List workspaces in subscription. + /// List App Attach packages in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages /// /// /// Operation Id - /// Workspaces_ListBySubscription + /// AppAttachPackage_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetVirtualWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAppAttachPackagesAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspacesAsync(cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetAppAttachPackagesAsync(filter, cancellationToken); } /// - /// List workspaces in subscription. + /// List App Attach packages in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages /// /// /// Operation Id - /// Workspaces_ListBySubscription + /// AppAttachPackage_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetVirtualWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAppAttachPackages(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspaces(cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetAppAttachPackages(filter, cancellationToken); } /// - /// List scaling plans in subscription. + /// List applicationGroups in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups /// /// /// Operation Id - /// ScalingPlans_ListBySubscription + /// ApplicationGroups_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetScalingPlansAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVirtualApplicationGroupsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlansAsync(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroupsAsync(filter, cancellationToken); } /// - /// List scaling plans in subscription. + /// List applicationGroups in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups /// /// /// Operation Id - /// ScalingPlans_ListBySubscription + /// ApplicationGroups_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetScalingPlans(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVirtualApplicationGroups(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlans(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroups(filter, cancellationToken); } /// - /// List applicationGroups in subscription. + /// List hostPools in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools /// /// /// Operation Id - /// ApplicationGroups_ListBySubscription + /// HostPools_List /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetVirtualApplicationGroupsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetHostPoolsAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroupsAsync(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPoolsAsync(pageSize, isDescending, initialSkip, cancellationToken); } /// - /// List applicationGroups in subscription. + /// List hostPools in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools /// /// /// Operation Id - /// ApplicationGroups_ListBySubscription + /// HostPools_List /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetVirtualApplicationGroups(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetHostPools(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualApplicationGroups(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPools(pageSize, isDescending, initialSkip, cancellationToken); } /// - /// List hostPools in subscription. + /// List scaling plans in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans /// /// /// Operation Id - /// HostPools_List + /// ScalingPlans_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -1018,37 +1077,37 @@ public static Pageable GetVirtualApplicationGro /// Initial number of items to skip. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetHostPoolsAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetScalingPlansAsync(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPoolsAsync(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlansAsync(pageSize, isDescending, initialSkip, cancellationToken); } /// - /// List hostPools in subscription. + /// List scaling plans in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans /// /// /// Operation Id - /// HostPools_List + /// ScalingPlans_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -1057,86 +1116,84 @@ public static AsyncPageable GetHostPoolsAsync(this Subscriptio /// Initial number of items to skip. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetHostPools(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetScalingPlans(this SubscriptionResource subscriptionResource, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetHostPools(pageSize, isDescending, initialSkip, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetScalingPlans(pageSize, isDescending, initialSkip, cancellationToken); } /// - /// List App Attach packages in subscription. + /// List workspaces in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces /// /// /// Operation Id - /// AppAttachPackage_ListBySubscription + /// Workspaces_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetAppAttachPackagesAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVirtualWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetAppAttachPackagesAsync(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspacesAsync(cancellationToken); } /// - /// List App Attach packages in subscription. + /// List workspaces in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces /// /// /// Operation Id - /// AppAttachPackage_ListBySubscription + /// Workspaces_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetAppAttachPackages(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVirtualWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetAppAttachPackages(filter, cancellationToken); + return GetMockableDesktopVirtualizationSubscriptionResource(subscriptionResource).GetVirtualWorkspaces(cancellationToken); } } } 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..46d59533e2b6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.cs @@ -35,39 +35,39 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// 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. + /// 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 VirtualWorkspaceResource GetVirtualWorkspaceResource(ResourceIdentifier id) + /// Returns a object. + public virtual AppAttachPackageResource GetAppAttachPackageResource(ResourceIdentifier id) { - VirtualWorkspaceResource.ValidateResourceId(id); - return new VirtualWorkspaceResource(Client, id); + AppAttachPackageResource.ValidateResourceId(id); + return new AppAttachPackageResource(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. + /// 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 WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(ResourceIdentifier id) + /// Returns a object. + public virtual VirtualApplicationGroupResource GetVirtualApplicationGroupResource(ResourceIdentifier id) { - WorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); - return new WorkspacePrivateEndpointConnectionResource(Client, id); + VirtualApplicationGroupResource.ValidateResourceId(id); + return new VirtualApplicationGroupResource(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. + /// 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 HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(ResourceIdentifier id) + /// Returns a object. + public virtual HostPoolResource GetHostPoolResource(ResourceIdentifier id) { - HostPoolPrivateEndpointConnectionResource.ValidateResourceId(id); - return new HostPoolPrivateEndpointConnectionResource(Client, id); + HostPoolResource.ValidateResourceId(id); + return new HostPoolResource(Client, id); } /// @@ -83,39 +83,15 @@ public virtual ScalingPlanResource GetScalingPlanResource(ResourceIdentifier 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 ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(ResourceIdentifier id) - { - ScalingPlanPooledScheduleResource.ValidateResourceId(id); - return new ScalingPlanPooledScheduleResource(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 ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(ResourceIdentifier id) - { - ScalingPlanPersonalScheduleResource.ValidateResourceId(id); - return new ScalingPlanPersonalScheduleResource(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. + /// 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 VirtualApplicationGroupResource GetVirtualApplicationGroupResource(ResourceIdentifier id) + /// Returns a object. + public virtual VirtualWorkspaceResource GetVirtualWorkspaceResource(ResourceIdentifier id) { - VirtualApplicationGroupResource.ValidateResourceId(id); - return new VirtualApplicationGroupResource(Client, id); + VirtualWorkspaceResource.ValidateResourceId(id); + return new VirtualWorkspaceResource(Client, id); } /// @@ -143,27 +119,75 @@ public virtual VirtualDesktopResource GetVirtualDesktopResource(ResourceIdentifi } /// - /// 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. + /// 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 HostPoolResource GetHostPoolResource(ResourceIdentifier id) + /// Returns a object. + public virtual ActiveSessionHostConfigurationResource GetActiveSessionHostConfigurationResource(ResourceIdentifier id) { - HostPoolResource.ValidateResourceId(id); - return new HostPoolResource(Client, 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. + /// 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 UserSessionResource GetUserSessionResource(ResourceIdentifier id) + /// Returns a object. + public virtual MsixPackageResource GetMsixPackageResource(ResourceIdentifier id) { - UserSessionResource.ValidateResourceId(id); - return new UserSessionResource(Client, id); + MsixPackageResource.ValidateResourceId(id); + return new MsixPackageResource(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 HostPoolPrivateEndpointConnectionResource GetHostPoolPrivateEndpointConnectionResource(ResourceIdentifier id) + { + HostPoolPrivateEndpointConnectionResource.ValidateResourceId(id); + return new HostPoolPrivateEndpointConnectionResource(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 WorkspacePrivateEndpointConnectionResource GetWorkspacePrivateEndpointConnectionResource(ResourceIdentifier id) + { + WorkspacePrivateEndpointConnectionResource.ValidateResourceId(id); + return new WorkspacePrivateEndpointConnectionResource(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 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); } /// @@ -179,27 +203,39 @@ public virtual SessionHostResource GetSessionHostResource(ResourceIdentifier 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. + /// 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 MsixPackageResource GetMsixPackageResource(ResourceIdentifier id) + /// Returns a object. + public virtual UserSessionResource GetUserSessionResource(ResourceIdentifier id) { - MsixPackageResource.ValidateResourceId(id); - return new MsixPackageResource(Client, id); + UserSessionResource.ValidateResourceId(id); + return new UserSessionResource(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. + /// 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 AppAttachPackageResource GetAppAttachPackageResource(ResourceIdentifier id) + /// Returns a object. + public virtual ScalingPlanPersonalScheduleResource GetScalingPlanPersonalScheduleResource(ResourceIdentifier id) { - AppAttachPackageResource.ValidateResourceId(id); - return new AppAttachPackageResource(Client, id); + ScalingPlanPersonalScheduleResource.ValidateResourceId(id); + return new ScalingPlanPersonalScheduleResource(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 ScalingPlanPooledScheduleResource GetScalingPlanPooledScheduleResource(ResourceIdentifier id) + { + ScalingPlanPooledScheduleResource.ValidateResourceId(id); + return new ScalingPlanPooledScheduleResource(Client, id); } } } 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..1198010bbaae 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationResourceGroupResource.cs @@ -33,349 +33,349 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. - /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. - public virtual VirtualWorkspaceCollection GetVirtualWorkspaces() + /// Gets a collection of AppAttachPackageResources in the ResourceGroupResource. + /// An object representing collection of AppAttachPackageResources and their operations over a AppAttachPackageResource. + public virtual AppAttachPackageCollection GetAppAttachPackages() { - return GetCachedClient(client => new VirtualWorkspaceCollection(client, Id)); + return GetCachedClient(client => new AppAttachPackageCollection(client, Id)); } /// - /// Get a workspace. + /// Get an app attach package. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} /// /// /// Operation Id - /// Workspaces_Get + /// AppAttachPackage_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the workspace. + /// The name of the App Attach package. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetVirtualWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + public virtual async Task> GetAppAttachPackageAsync(string appAttachPackageName, CancellationToken cancellationToken = default) { - return await GetVirtualWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + return await GetAppAttachPackages().GetAsync(appAttachPackageName, cancellationToken).ConfigureAwait(false); } /// - /// Get a workspace. + /// Get an app attach package. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} /// /// /// Operation Id - /// Workspaces_Get + /// AppAttachPackage_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the workspace. + /// The name of the App Attach package. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetVirtualWorkspace(string workspaceName, CancellationToken cancellationToken = default) + public virtual Response GetAppAttachPackage(string appAttachPackageName, CancellationToken cancellationToken = default) { - return GetVirtualWorkspaces().Get(workspaceName, cancellationToken); + return GetAppAttachPackages().Get(appAttachPackageName, cancellationToken); } - /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. - /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. - public virtual ScalingPlanCollection GetScalingPlans() + /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. + /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. + public virtual VirtualApplicationGroupCollection GetVirtualApplicationGroups() { - return GetCachedClient(client => new ScalingPlanCollection(client, Id)); + return GetCachedClient(client => new VirtualApplicationGroupCollection(client, Id)); } /// - /// Get a scaling plan. + /// Get an application group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} /// /// /// Operation Id - /// ScalingPlans_Get + /// ApplicationGroups_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the scaling plan. + /// The name of the application group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetScalingPlanAsync(string scalingPlanName, CancellationToken cancellationToken = default) + public virtual async Task> GetVirtualApplicationGroupAsync(string applicationGroupName, CancellationToken cancellationToken = default) { - return await GetScalingPlans().GetAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); + return await GetVirtualApplicationGroups().GetAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); } /// - /// Get a scaling plan. + /// Get an application group. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} /// /// /// Operation Id - /// ScalingPlans_Get + /// ApplicationGroups_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the scaling plan. + /// The name of the application group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetScalingPlan(string scalingPlanName, CancellationToken cancellationToken = default) + public virtual Response GetVirtualApplicationGroup(string applicationGroupName, CancellationToken cancellationToken = default) { - return GetScalingPlans().Get(scalingPlanName, cancellationToken); + return GetVirtualApplicationGroups().Get(applicationGroupName, cancellationToken); } - /// Gets a collection of VirtualApplicationGroupResources in the ResourceGroupResource. - /// An object representing collection of VirtualApplicationGroupResources and their operations over a VirtualApplicationGroupResource. - public virtual VirtualApplicationGroupCollection GetVirtualApplicationGroups() + /// Gets a collection of HostPoolResources in the ResourceGroupResource. + /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. + public virtual HostPoolCollection GetHostPools() { - return GetCachedClient(client => new VirtualApplicationGroupCollection(client, Id)); + return GetCachedClient(client => new HostPoolCollection(client, Id)); } /// - /// Get an application group. + /// Get a host pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} /// /// /// Operation Id - /// ApplicationGroups_Get + /// HostPools_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the application group. + /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetVirtualApplicationGroupAsync(string applicationGroupName, CancellationToken cancellationToken = default) + public virtual async Task> GetHostPoolAsync(string hostPoolName, CancellationToken cancellationToken = default) { - return await GetVirtualApplicationGroups().GetAsync(applicationGroupName, cancellationToken).ConfigureAwait(false); + return await GetHostPools().GetAsync(hostPoolName, cancellationToken).ConfigureAwait(false); } /// - /// Get an application group. + /// Get a host pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} /// /// /// Operation Id - /// ApplicationGroups_Get + /// HostPools_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the application group. + /// The name of the host pool within the specified resource group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetVirtualApplicationGroup(string applicationGroupName, CancellationToken cancellationToken = default) + public virtual Response GetHostPool(string hostPoolName, CancellationToken cancellationToken = default) { - return GetVirtualApplicationGroups().Get(applicationGroupName, cancellationToken); + return GetHostPools().Get(hostPoolName, cancellationToken); } - /// Gets a collection of HostPoolResources in the ResourceGroupResource. - /// An object representing collection of HostPoolResources and their operations over a HostPoolResource. - public virtual HostPoolCollection GetHostPools() + /// Gets a collection of ScalingPlanResources in the ResourceGroupResource. + /// An object representing collection of ScalingPlanResources and their operations over a ScalingPlanResource. + public virtual ScalingPlanCollection GetScalingPlans() { - return GetCachedClient(client => new HostPoolCollection(client, Id)); + return GetCachedClient(client => new ScalingPlanCollection(client, Id)); } /// - /// Get a host pool. + /// Get a scaling plan. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} /// /// /// Operation Id - /// HostPools_Get + /// ScalingPlans_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the host pool within the specified resource group. + /// The name of the scaling plan. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetHostPoolAsync(string hostPoolName, CancellationToken cancellationToken = default) + public virtual async Task> GetScalingPlanAsync(string scalingPlanName, CancellationToken cancellationToken = default) { - return await GetHostPools().GetAsync(hostPoolName, cancellationToken).ConfigureAwait(false); + return await GetScalingPlans().GetAsync(scalingPlanName, cancellationToken).ConfigureAwait(false); } /// - /// Get a host pool. + /// Get a scaling plan. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName} /// /// /// Operation Id - /// HostPools_Get + /// ScalingPlans_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the host pool within the specified resource group. + /// The name of the scaling plan. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetHostPool(string hostPoolName, CancellationToken cancellationToken = default) + public virtual Response GetScalingPlan(string scalingPlanName, CancellationToken cancellationToken = default) { - return GetHostPools().Get(hostPoolName, cancellationToken); + return GetScalingPlans().Get(scalingPlanName, cancellationToken); } - /// Gets a collection of AppAttachPackageResources in the ResourceGroupResource. - /// An object representing collection of AppAttachPackageResources and their operations over a AppAttachPackageResource. - public virtual AppAttachPackageCollection GetAppAttachPackages() + /// Gets a collection of VirtualWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of VirtualWorkspaceResources and their operations over a VirtualWorkspaceResource. + public virtual VirtualWorkspaceCollection GetVirtualWorkspaces() { - return GetCachedClient(client => new AppAttachPackageCollection(client, Id)); + return GetCachedClient(client => new VirtualWorkspaceCollection(client, Id)); } /// - /// Get an app attach package. + /// Get a workspace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} /// /// /// Operation Id - /// AppAttachPackage_Get + /// Workspaces_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the App Attach package. + /// The name of the workspace. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetAppAttachPackageAsync(string appAttachPackageName, CancellationToken cancellationToken = default) + public virtual async Task> GetVirtualWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) { - return await GetAppAttachPackages().GetAsync(appAttachPackageName, cancellationToken).ConfigureAwait(false); + return await GetVirtualWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); } /// - /// Get an app attach package. + /// Get a workspace. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/appAttachPackages/{appAttachPackageName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName} /// /// /// Operation Id - /// AppAttachPackage_Get + /// Workspaces_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the App Attach package. + /// The name of the workspace. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetAppAttachPackage(string appAttachPackageName, CancellationToken cancellationToken = default) + public virtual Response GetVirtualWorkspace(string workspaceName, CancellationToken cancellationToken = default) { - return GetAppAttachPackages().Get(appAttachPackageName, cancellationToken); + return GetVirtualWorkspaces().Get(workspaceName, cancellationToken); } } } 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..3c5b4db2e197 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationSubscriptionResource.cs @@ -15,16 +15,16 @@ namespace Azure.ResourceManager.DesktopVirtualization.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableDesktopVirtualizationSubscriptionResource : ArmResource { - private ClientDiagnostics _virtualWorkspaceWorkspacesClientDiagnostics; - private WorkspacesRestOperations _virtualWorkspaceWorkspacesRestClient; - private ClientDiagnostics _scalingPlanClientDiagnostics; - private ScalingPlansRestOperations _scalingPlanRestClient; + private ClientDiagnostics _appAttachPackageClientDiagnostics; + private AppAttachPackageRestOperations _appAttachPackageRestClient; private ClientDiagnostics _virtualApplicationGroupApplicationGroupsClientDiagnostics; private ApplicationGroupsRestOperations _virtualApplicationGroupApplicationGroupsRestClient; private ClientDiagnostics _hostPoolClientDiagnostics; private HostPoolsRestOperations _hostPoolRestClient; - private ClientDiagnostics _appAttachPackageClientDiagnostics; - private AppAttachPackageRestOperations _appAttachPackageRestClient; + private ClientDiagnostics _scalingPlanClientDiagnostics; + private ScalingPlansRestOperations _scalingPlanRestClient; + private ClientDiagnostics _virtualWorkspaceWorkspacesClientDiagnostics; + private WorkspacesRestOperations _virtualWorkspaceWorkspacesRestClient; /// Initializes a new instance of the class for mocking. protected MockableDesktopVirtualizationSubscriptionResource() @@ -38,16 +38,16 @@ internal MockableDesktopVirtualizationSubscriptionResource(ArmClient client, Res { } - private ClientDiagnostics VirtualWorkspaceWorkspacesClientDiagnostics => _virtualWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualWorkspaceResource.ResourceType.Namespace, Diagnostics); - private WorkspacesRestOperations VirtualWorkspaceWorkspacesRestClient => _virtualWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWorkspaceResource.ResourceType)); - private ClientDiagnostics ScalingPlanClientDiagnostics => _scalingPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ScalingPlanResource.ResourceType.Namespace, Diagnostics); - private ScalingPlansRestOperations ScalingPlanRestClient => _scalingPlanRestClient ??= new ScalingPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScalingPlanResource.ResourceType)); + private ClientDiagnostics AppAttachPackageClientDiagnostics => _appAttachPackageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", AppAttachPackageResource.ResourceType.Namespace, Diagnostics); + private AppAttachPackageRestOperations AppAttachPackageRestClient => _appAttachPackageRestClient ??= new AppAttachPackageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppAttachPackageResource.ResourceType)); private ClientDiagnostics VirtualApplicationGroupApplicationGroupsClientDiagnostics => _virtualApplicationGroupApplicationGroupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualApplicationGroupResource.ResourceType.Namespace, Diagnostics); private ApplicationGroupsRestOperations VirtualApplicationGroupApplicationGroupsRestClient => _virtualApplicationGroupApplicationGroupsRestClient ??= new ApplicationGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualApplicationGroupResource.ResourceType)); private ClientDiagnostics HostPoolClientDiagnostics => _hostPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", HostPoolResource.ResourceType.Namespace, Diagnostics); private HostPoolsRestOperations HostPoolRestClient => _hostPoolRestClient ??= new HostPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(HostPoolResource.ResourceType)); - private ClientDiagnostics AppAttachPackageClientDiagnostics => _appAttachPackageClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", AppAttachPackageResource.ResourceType.Namespace, Diagnostics); - private AppAttachPackageRestOperations AppAttachPackageRestClient => _appAttachPackageRestClient ??= new AppAttachPackageRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppAttachPackageResource.ResourceType)); + private ClientDiagnostics ScalingPlanClientDiagnostics => _scalingPlanClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ScalingPlanResource.ResourceType.Namespace, Diagnostics); + private ScalingPlansRestOperations ScalingPlanRestClient => _scalingPlanRestClient ??= new ScalingPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScalingPlanResource.ResourceType)); + private ClientDiagnostics VirtualWorkspaceWorkspacesClientDiagnostics => _virtualWorkspaceWorkspacesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", VirtualWorkspaceResource.ResourceType.Namespace, Diagnostics); + private WorkspacesRestOperations VirtualWorkspaceWorkspacesRestClient => _virtualWorkspaceWorkspacesRestClient ??= new WorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualWorkspaceResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -56,211 +56,213 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// List workspaces in subscription. + /// List App Attach packages in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages /// /// /// Operation Id - /// Workspaces_ListBySubscription + /// AppAttachPackage_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// + /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualWorkspacesAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAppAttachPackagesAsync(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => AppAttachPackageRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppAttachPackageRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppAttachPackageResource(Client, AppAttachPackageData.DeserializeAppAttachPackageData(e)), AppAttachPackageClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetAppAttachPackages", "value", "nextLink", cancellationToken); } /// - /// List workspaces in subscription. + /// List App Attach packages in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages /// /// /// Operation Id - /// Workspaces_ListBySubscription + /// AppAttachPackage_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// + /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualWorkspaces(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAppAttachPackages(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => AppAttachPackageRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppAttachPackageRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppAttachPackageResource(Client, AppAttachPackageData.DeserializeAppAttachPackageData(e)), AppAttachPackageClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetAppAttachPackages", "value", "nextLink", cancellationToken); } /// - /// List scaling plans in subscription. + /// List applicationGroups in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups /// /// /// Operation Id - /// ScalingPlans_ListBySubscription + /// ApplicationGroups_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualApplicationGroupsAsync(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); } /// - /// List scaling plans in subscription. + /// List applicationGroups in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups /// /// /// Operation Id - /// ScalingPlans_ListBySubscription + /// ApplicationGroups_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualApplicationGroups(string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); } /// - /// List applicationGroups in subscription. + /// List hostPools in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools /// /// /// Operation Id - /// ApplicationGroups_ListBySubscription + /// HostPools_List /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualApplicationGroupsAsync(string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); } /// - /// List applicationGroups in subscription. + /// List hostPools in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools /// /// /// Operation Id - /// ApplicationGroups_ListBySubscription + /// HostPools_List /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualApplicationGroups(string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetHostPools(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualApplicationGroupApplicationGroupsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualApplicationGroupResource(Client, VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(e)), VirtualApplicationGroupApplicationGroupsClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualApplicationGroups", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); } /// - /// List hostPools in subscription. + /// List scaling plans in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans /// /// /// Operation Id - /// HostPools_List + /// ScalingPlans_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -268,32 +270,32 @@ public virtual Pageable GetVirtualApplicationGr /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); } /// - /// List hostPools in subscription. + /// List scaling plans in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans /// /// /// Operation Id - /// HostPools_List + /// ScalingPlans_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -301,74 +303,72 @@ public virtual AsyncPageable GetHostPoolsAsync(int? pageSize = /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetHostPools(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => HostPoolRestClient.CreateListRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => HostPoolRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HostPoolResource(Client, HostPoolData.DeserializeHostPoolData(e)), HostPoolClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetHostPools", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => ScalingPlanRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ScalingPlanRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), ScalingPlanClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetScalingPlans", "value", "nextLink", cancellationToken); } /// - /// List App Attach packages in subscription. + /// List workspaces in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces /// /// /// Operation Id - /// AppAttachPackage_ListBySubscription + /// Workspaces_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// 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) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualWorkspacesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppAttachPackageRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppAttachPackageRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AppAttachPackageResource(Client, AppAttachPackageData.DeserializeAppAttachPackageData(e)), AppAttachPackageClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetAppAttachPackages", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); } /// - /// List App Attach packages in subscription. + /// List workspaces in subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/appAttachPackages + /// /subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces /// /// /// Operation Id - /// AppAttachPackage_ListBySubscription + /// Workspaces_ListBySubscription /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are package name, host pool, and resource group. /// 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) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualWorkspaces(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => AppAttachPackageRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AppAttachPackageRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppAttachPackageResource(Client, AppAttachPackageData.DeserializeAppAttachPackageData(e)), AppAttachPackageClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetAppAttachPackages", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VirtualWorkspaceWorkspacesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualWorkspaceResource(Client, VirtualWorkspaceData.DeserializeVirtualWorkspaceData(e)), VirtualWorkspaceWorkspacesClientDiagnostics, Pipeline, "MockableDesktopVirtualizationSubscriptionResource.GetVirtualWorkspaces", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolCollection.cs index 76c4a8cdf508..46e136a86945 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-04-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAsync(Wa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string hostPoolNa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string hostPoolName, CancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = null, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? isD /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string hostPoolName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string hostPoolName, CancellationToken canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExistsAsync(s /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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 4722e4f0cb5d..76791b475c99 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.Serialization.cs @@ -39,36 +39,37 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ManagedBy)) - { - writer.WritePropertyName("managedBy"u8); - writer.WriteStringValue(ManagedBy); - } - if (Optional.IsDefined(Kind)) + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Kind)) { - writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); } - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(ManagedBy)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); + writer.WritePropertyName("managedBy"u8); + writer.WriteStringValue(ManagedBy); } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); JsonSerializer.Serialize(writer, Plan); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ObjectId)) @@ -90,15 +91,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStringValue(HostPoolType.ToString()); if (Optional.IsDefined(PersonalDesktopAssignmentType)) { - if (PersonalDesktopAssignmentType != null) - { - writer.WritePropertyName("personalDesktopAssignmentType"u8); - writer.WriteStringValue(PersonalDesktopAssignmentType.Value.ToString()); - } - else - { - writer.WriteNull("personalDesktopAssignmentType"); - } + writer.WritePropertyName("personalDesktopAssignmentType"u8); + writer.WriteStringValue(PersonalDesktopAssignmentType.Value.ToString()); } if (Optional.IsDefined(CustomRdpProperty)) { @@ -107,53 +101,25 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsDefined(MaxSessionLimit)) { - if (MaxSessionLimit != null) - { - writer.WritePropertyName("maxSessionLimit"u8); - writer.WriteNumberValue(MaxSessionLimit.Value); - } - else - { - writer.WriteNull("maxSessionLimit"); - } + writer.WritePropertyName("maxSessionLimit"u8); + writer.WriteNumberValue(MaxSessionLimit.Value); } writer.WritePropertyName("loadBalancerType"u8); writer.WriteStringValue(LoadBalancerType.ToString()); if (Optional.IsDefined(Ring)) { - if (Ring != null) - { - writer.WritePropertyName("ring"u8); - writer.WriteNumberValue(Ring.Value); - } - else - { - writer.WriteNull("ring"); - } + writer.WritePropertyName("ring"u8); + writer.WriteNumberValue(Ring.Value); } if (Optional.IsDefined(IsValidationEnvironment)) { - if (IsValidationEnvironment != null) - { - writer.WritePropertyName("validationEnvironment"u8); - writer.WriteBooleanValue(IsValidationEnvironment.Value); - } - else - { - writer.WriteNull("validationEnvironment"); - } + writer.WritePropertyName("validationEnvironment"u8); + writer.WriteBooleanValue(IsValidationEnvironment.Value); } if (Optional.IsDefined(RegistrationInfo)) { - if (RegistrationInfo != null) - { - writer.WritePropertyName("registrationInfo"u8); - writer.WriteObjectValue(RegistrationInfo, options); - } - else - { - writer.WriteNull("registrationInfo"); - } + writer.WritePropertyName("registrationInfo"u8); + writer.WriteObjectValue(RegistrationInfo, options); } if (Optional.IsDefined(VmTemplate)) { @@ -162,20 +128,13 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (options.Format != "W" && Optional.IsCollectionDefined(ApplicationGroupReferences)) { - if (ApplicationGroupReferences != null) - { - writer.WritePropertyName("applicationGroupReferences"u8); - writer.WriteStartArray(); - foreach (var item in ApplicationGroupReferences) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - else + writer.WritePropertyName("applicationGroupReferences"u8); + writer.WriteStartArray(); + foreach (var item in ApplicationGroupReferences) { - writer.WriteNull("applicationGroupReferences"); + writer.WriteStringValue(item); } + writer.WriteEndArray(); } if (options.Format != "W" && Optional.IsCollectionDefined(AppAttachPackageReferences)) { @@ -204,82 +163,65 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsDefined(SsoSecretType)) { - if (SsoSecretType != null) - { - writer.WritePropertyName("ssoSecretType"u8); - writer.WriteStringValue(SsoSecretType.Value.ToString()); - } - else - { - writer.WriteNull("ssoSecretType"); - } + writer.WritePropertyName("ssoSecretType"u8); + writer.WriteStringValue(SsoSecretType.Value.ToString()); } writer.WritePropertyName("preferredAppGroupType"u8); writer.WriteStringValue(PreferredAppGroupType.ToString()); if (Optional.IsDefined(StartVmOnConnect)) { - if (StartVmOnConnect != null) - { - writer.WritePropertyName("startVMOnConnect"u8); - writer.WriteBooleanValue(StartVmOnConnect.Value); - } - else - { - writer.WriteNull("startVMOnConnect"); - } + writer.WritePropertyName("startVMOnConnect"u8); + writer.WriteBooleanValue(StartVmOnConnect.Value); } if (options.Format != "W" && Optional.IsDefined(IsCloudPCResource)) { - if (IsCloudPCResource != null) - { - writer.WritePropertyName("cloudPcResource"u8); - writer.WriteBooleanValue(IsCloudPCResource.Value); - } - else - { - writer.WriteNull("cloudPcResource"); - } + writer.WritePropertyName("cloudPcResource"u8); + writer.WriteBooleanValue(IsCloudPCResource.Value); } if (Optional.IsDefined(PublicNetworkAccess)) { - if (PublicNetworkAccess != null) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - else - { - writer.WriteNull("publicNetworkAccess"); - } + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } 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 (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()); + } + if (Optional.IsDefined(ManagementType)) + { + writer.WritePropertyName("managementType"u8); + writer.WriteStringValue(ManagementType.Value.ToString()); } writer.WriteEndObject(); } @@ -304,12 +246,12 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { return null; } - ResourceIdentifier managedBy = default; - string kind = default; - ETag? etag = default; ManagedServiceIdentity identity = default; - DesktopVirtualizationSku sku = default; + ETag? etag = default; + string kind = default; + string managedBy = default; ArmPlan plan = default; + DesktopVirtualizationSku sku = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -340,22 +282,23 @@ 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; + ManagementType? managementType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("managedBy"u8)) + if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - managedBy = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("etag"u8)) @@ -367,31 +310,32 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR etag = new ETag(property.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (property.NameEquals("kind"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + kind = property.Value.GetString(); continue; } - if (property.NameEquals("sku"u8)) + if (property.NameEquals("managedBy"u8)) + { + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("plan"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); + plan = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("plan"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - plan = JsonSerializer.Deserialize(property.Value.GetRawText()); + sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -470,7 +414,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - personalDesktopAssignmentType = null; continue; } personalDesktopAssignmentType = new PersonalDesktopAssignmentType(property0.Value.GetString()); @@ -485,7 +428,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - maxSessionLimit = null; continue; } maxSessionLimit = property0.Value.GetInt32(); @@ -500,7 +442,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - ring = null; continue; } ring = property0.Value.GetInt32(); @@ -510,7 +451,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - validationEnvironment = null; continue; } validationEnvironment = property0.Value.GetBoolean(); @@ -520,7 +460,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - registrationInfo = null; continue; } registrationInfo = HostPoolRegistrationInfo.DeserializeHostPoolRegistrationInfo(property0.Value, options); @@ -535,7 +474,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - applicationGroupReferences = null; continue; } List array = new List(); @@ -579,7 +517,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - ssoSecretType = null; continue; } ssoSecretType = new HostPoolSsoSecretType(property0.Value.GetString()); @@ -594,7 +531,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - startVmOnConnect = null; continue; } startVmOnConnect = property0.Value.GetBoolean(); @@ -604,7 +540,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - cloudPCResource = null; continue; } cloudPCResource = property0.Value.GetBoolean(); @@ -614,7 +549,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - publicNetworkAccess = null; continue; } publicNetworkAccess = new HostPoolPublicNetworkAccess(property0.Value.GetString()); @@ -624,7 +558,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - agentUpdate = null; continue; } agentUpdate = SessionHostAgentUpdateProperties.DeserializeSessionHostAgentUpdateProperties(property0.Value, options); @@ -634,7 +567,6 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR { if (property0.Value.ValueKind == JsonValueKind.Null) { - privateEndpointConnections = null; continue; } List array = new List(); @@ -645,6 +577,51 @@ 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; + } + if (property0.NameEquals("managementType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managementType = new ManagementType(property0.Value.GetString()); + continue; + } } continue; } @@ -661,6 +638,12 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR systemData, tags ?? new ChangeTrackingDictionary(), location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, friendlyName, description, @@ -685,12 +668,11 @@ internal static HostPoolData DeserializeHostPoolData(JsonElement element, ModelR publicNetworkAccess, agentUpdate, privateEndpointConnections ?? new ChangeTrackingList(), - managedBy, - kind, - etag, - identity, - sku, - plan, + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, + managementType, serializedAdditionalRawData); } @@ -777,18 +759,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" managedBy: "); + builder.Append(" identity: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ManagedBy)) + if (Optional.IsDefined(Identity)) { - builder.Append(" managedBy: "); - builder.AppendLine($"'{ManagedBy.ToString()}'"); + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); } } @@ -815,33 +812,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" etag: "); + builder.Append(" managedBy: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ETag)) + if (Optional.IsDefined(ManagedBy)) { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); + builder.Append(" managedBy: "); + if (ManagedBy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ManagedBy}'''"); + } + else + { + builder.AppendLine($"'{ManagedBy}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" identity: "); + builder.Append(" plan: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Plan)) { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + builder.Append(" plan: "); + BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); } } @@ -860,21 +865,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" plan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Plan)) - { - builder.Append(" plan: "); - BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); - } - } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { @@ -1375,6 +1365,81 @@ 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()}'"); + } + } + + 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()}'"); + } + } + 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..a516ef04820e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolData.cs @@ -73,6 +73,12 @@ public HostPoolData(AzureLocation location, HostPoolType hostPoolType, HostPoolL /// The systemData. /// The tags. /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. /// ObjectId of HostPool. (internal use). /// Friendly name of HostPool. /// Description of HostPool. @@ -97,15 +103,20 @@ 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. - /// 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. + /// 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 type of management for this hostpool, Automated or Standard. The default value is Automated. /// 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, ManagedServiceIdentity identity, ETag? etag, string kind, string managedBy, ArmPlan plan, DesktopVirtualizationSku sku, 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, ManagedPrivateUDP? managedPrivateUDP, DirectUDP? directUDP, PublicUDP? publicUDP, RelayUDP? relayUDP, ManagementType? managementType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Identity = identity; + ETag = etag; + Kind = kind; + ManagedBy = managedBy; + Plan = plan; + Sku = sku; ObjectId = objectId; FriendlyName = friendlyName; Description = description; @@ -130,12 +141,11 @@ internal HostPoolData(ResourceIdentifier id, string name, ResourceType resourceT PublicNetworkAccess = publicNetworkAccess; AgentUpdate = agentUpdate; PrivateEndpointConnections = privateEndpointConnections; - ManagedBy = managedBy; - Kind = kind; - ETag = etag; - Identity = identity; - Sku = sku; - Plan = plan; + ManagedPrivateUDP = managedPrivateUDP; + DirectUDP = directUDP; + PublicUDP = publicUDP; + RelayUDP = relayUDP; + ManagementType = managementType; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -144,6 +154,24 @@ internal HostPoolData() { } + /// The managed service identities assigned to this resource. + [WirePath("identity")] + public ManagedServiceIdentity Identity { get; set; } + /// If etag is provided in the response body, it may 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; } + /// 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. + [WirePath("kind")] + public string Kind { 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 string ManagedBy { get; set; } + /// Details of the resource plan. + [WirePath("plan")] + public ArmPlan Plan { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + [WirePath("sku")] + public DesktopVirtualizationSku Sku { get; set; } /// ObjectId of HostPool. (internal use). [WirePath("properties.objectId")] public string ObjectId { get; } @@ -216,23 +244,20 @@ internal HostPoolData() /// List of private endpoint connection associated with the specified resource. [WirePath("properties.privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } - /// 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; } - /// 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. - [WirePath("kind")] - public string Kind { get; set; } - /// 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. - [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. - [WirePath("plan")] - public ArmPlan Plan { 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; } + /// The type of management for this hostpool, Automated or Standard. The default value is Automated. + [WirePath("properties.managementType")] + public ManagementType? ManagementType { 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..0e4cd12549ad 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionCollection.cs @@ -14,7 +14,6 @@ using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DesktopVirtualization.Models; namespace Azure.ResourceManager.DesktopVirtualization { @@ -65,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -74,22 +73,22 @@ 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HostPoolPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection, cancellationToken).ConfigureAwait(false); - var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection); + var response = await _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); + var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new HostPoolPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -116,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -125,22 +124,22 @@ public virtual async Task /// /// 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HostPoolPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection, cancellationToken); - var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection); + var response = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); + var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new HostPoolPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -155,7 +154,7 @@ public virtual ArmOperation CreateOrU } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -167,7 +166,7 @@ public virtual ArmOperation CreateOrU /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -175,7 +174,7 @@ public virtual ArmOperation CreateOrU /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -200,7 +199,7 @@ public virtual async Task> G } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -212,7 +211,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -220,7 +219,7 @@ public virtual async Task> G /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -257,7 +256,7 @@ public virtual Response Get(string pr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -290,7 +289,7 @@ public virtual AsyncPageable GetAllAs /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -323,7 +322,7 @@ public virtual Pageable GetAll(int? p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -331,7 +330,7 @@ public virtual Pageable GetAll(int? p /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -366,7 +365,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -374,7 +373,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -409,7 +408,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -417,7 +416,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -454,7 +453,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -462,7 +461,7 @@ public virtual async Task /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// 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/HostPoolPrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs index 306816ca5eaf..bde5e51b87a5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolPrivateEndpointConnectionResource.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DesktopVirtualization.Models; namespace Azure.ResourceManager.DesktopVirtualization { @@ -90,7 +89,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -102,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -130,7 +129,7 @@ public virtual async Task> G } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -142,7 +141,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -170,7 +169,7 @@ public virtual Response Get(Cancellat } /// - /// Remove a connection. + /// Delete a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -182,7 +181,7 @@ public virtual Response Get(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -214,7 +213,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Remove a connection. + /// Delete a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -226,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -270,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -279,19 +278,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// 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 the updated connection. + /// Resource create parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HostPoolPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = await _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection, cancellationToken).ConfigureAwait(false); - var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection); + var response = await _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPoolAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new HostPoolPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -318,7 +317,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -327,19 +326,19 @@ public virtual async Task /// /// 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 the updated connection. + /// Resource create parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("HostPoolPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection, cancellationToken); - var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection); + var response = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByHostPool(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _hostPoolPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByHostPoolRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new HostPoolPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs index 97f440be1dc0..3317a7dd209b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs @@ -38,16 +38,16 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _hostPoolClientDiagnostics; private readonly HostPoolsRestOperations _hostPoolRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; private readonly ClientDiagnostics _scalingPlanClientDiagnostics; private readonly ScalingPlansRestOperations _scalingPlanRestClient; - private readonly ClientDiagnostics _userSessionClientDiagnostics; - private readonly UserSessionsRestOperations _userSessionRestClient; - private readonly ClientDiagnostics _appAttachPackageInfoClientDiagnostics; - private readonly AppAttachPackageInfoRestOperations _appAttachPackageInfoRestClient; private readonly ClientDiagnostics _msixImagesClientDiagnostics; private readonly MsixImagesRestOperations _msixImagesRestClient; + private readonly ClientDiagnostics _appAttachPackageInfoClientDiagnostics; + private readonly AppAttachPackageInfoRestOperations _appAttachPackageInfoRestClient; + private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; + private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; + private readonly ClientDiagnostics _userSessionClientDiagnostics; + private readonly UserSessionsRestOperations _userSessionRestClient; private readonly HostPoolData _data; /// Gets the resource type for the operations. @@ -75,18 +75,18 @@ internal HostPoolResource(ArmClient client, ResourceIdentifier id) : base(client _hostPoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string hostPoolApiVersion); _hostPoolRestClient = new HostPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, hostPoolApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _scalingPlanClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ScalingPlanResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(ScalingPlanResource.ResourceType, out string scalingPlanApiVersion); _scalingPlanRestClient = new ScalingPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, scalingPlanApiVersion); + _msixImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _msixImagesRestClient = new MsixImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _appAttachPackageInfoClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _appAttachPackageInfoRestClient = new AppAttachPackageInfoRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _userSessionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", UserSessionResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(UserSessionResource.ResourceType, out string userSessionApiVersion); _userSessionRestClient = new UserSessionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, userSessionApiVersion); - _appAttachPackageInfoClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _appAttachPackageInfoRestClient = new AppAttachPackageInfoRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _msixImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _msixImagesRestClient = new MsixImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -113,211 +113,232 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of HostPoolPrivateEndpointConnectionResources in the HostPool. - /// An object representing collection of HostPoolPrivateEndpointConnectionResources and their operations over a HostPoolPrivateEndpointConnectionResource. - public virtual HostPoolPrivateEndpointConnectionCollection GetHostPoolPrivateEndpointConnections() + /// 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 GetCachedClient(client => new HostPoolPrivateEndpointConnectionCollection(client, Id)); + return new ActiveSessionHostConfigurationResource(Client, Id.AppendChildResource("activeSessionHostConfigurations", "default")); + } + + /// Gets a collection of MsixPackageResources in the HostPool. + /// An object representing collection of MsixPackageResources and their operations over a MsixPackageResource. + public virtual MsixPackageCollection GetMsixPackages() + { + return GetCachedClient(client => new MsixPackageCollection(client, Id)); } /// - /// Get a private endpoint connection. + /// Get a msixpackage. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id - /// PrivateEndpointConnections_GetByHostPool + /// MSIXPackages_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The version specific package full name of the MSIX package within specified hostpool. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetHostPoolPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual async Task> GetMsixPackageAsync(string msixPackageFullName, CancellationToken cancellationToken = default) { - return await GetHostPoolPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + return await GetMsixPackages().GetAsync(msixPackageFullName, cancellationToken).ConfigureAwait(false); } /// - /// Get a private endpoint connection. + /// Get a msixpackage. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id - /// PrivateEndpointConnections_GetByHostPool + /// MSIXPackages_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The version specific package full name of the MSIX package within specified hostpool. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetHostPoolPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + public virtual Response GetMsixPackage(string msixPackageFullName, CancellationToken cancellationToken = default) { - return GetHostPoolPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + return GetMsixPackages().Get(msixPackageFullName, cancellationToken); } - /// Gets a collection of SessionHostResources in the HostPool. - /// An object representing collection of SessionHostResources and their operations over a SessionHostResource. - public virtual SessionHostCollection GetSessionHosts() + /// Gets a collection of HostPoolPrivateEndpointConnectionResources in the HostPool. + /// An object representing collection of HostPoolPrivateEndpointConnectionResources and their operations over a HostPoolPrivateEndpointConnectionResource. + public virtual HostPoolPrivateEndpointConnectionCollection GetHostPoolPrivateEndpointConnections() { - return GetCachedClient(client => new SessionHostCollection(client, Id)); + return GetCachedClient(client => new HostPoolPrivateEndpointConnectionCollection(client, Id)); } /// - /// Get a session host. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// SessionHosts_Get + /// PrivateEndpointConnections_GetByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the session host within the specified host pool. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetSessionHostAsync(string sessionHostName, CancellationToken cancellationToken = default) + public virtual async Task> GetHostPoolPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return await GetSessionHosts().GetAsync(sessionHostName, cancellationToken).ConfigureAwait(false); + return await GetHostPoolPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// - /// Get a session host. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// SessionHosts_Get + /// PrivateEndpointConnections_GetByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The name of the session host within the specified host pool. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetSessionHost(string sessionHostName, CancellationToken cancellationToken = default) + public virtual Response GetHostPoolPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return GetSessionHosts().Get(sessionHostName, cancellationToken); + return GetHostPoolPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } - /// Gets a collection of MsixPackageResources in the HostPool. - /// An object representing collection of MsixPackageResources and their operations over a MsixPackageResource. - public virtual MsixPackageCollection GetMsixPackages() + /// 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 GetCachedClient(client => new MsixPackageCollection(client, Id)); + return new SessionHostConfigurationResource(Client, Id.AppendChildResource("sessionHostConfigurations", "default")); + } + + /// 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 a collection of SessionHostResources in the HostPool. + /// An object representing collection of SessionHostResources and their operations over a SessionHostResource. + public virtual SessionHostCollection GetSessionHosts() + { + return GetCachedClient(client => new SessionHostCollection(client, Id)); } /// - /// Get a msixpackage. + /// Get a session host. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} /// /// /// Operation Id - /// MSIXPackages_Get + /// SessionHosts_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The version specific package full name of the MSIX package within specified hostpool. + /// The name of the session host within the specified host pool. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetMsixPackageAsync(string msixPackageFullName, CancellationToken cancellationToken = default) + public virtual async Task> GetSessionHostAsync(string sessionHostName, CancellationToken cancellationToken = default) { - return await GetMsixPackages().GetAsync(msixPackageFullName, cancellationToken).ConfigureAwait(false); + return await GetSessionHosts().GetAsync(sessionHostName, cancellationToken).ConfigureAwait(false); } /// - /// Get a msixpackage. + /// Get a session host. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName} /// /// /// Operation Id - /// MSIXPackages_Get + /// SessionHosts_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// The version specific package full name of the MSIX package within specified hostpool. + /// The name of the session host within the specified host pool. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetMsixPackage(string msixPackageFullName, CancellationToken cancellationToken = default) + public virtual Response GetSessionHost(string sessionHostName, CancellationToken cancellationToken = default) { - return GetMsixPackages().Get(msixPackageFullName, cancellationToken); + return GetSessionHosts().Get(sessionHostName, cancellationToken); } /// @@ -333,7 +354,7 @@ public virtual Response GetMsixPackage(string msixPackageFu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -373,7 +394,7 @@ public virtual async Task> GetAsync(CancellationToken /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -413,7 +434,7 @@ public virtual Response Get(CancellationToken cancellationToke /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -458,7 +479,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -503,7 +524,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -511,7 +532,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// - /// Object containing HostPool definitions. + /// The properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(HostPoolPatch patch, CancellationToken cancellationToken = default) @@ -545,7 +566,7 @@ public virtual async Task> UpdateAsync(HostPoolPatch /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -553,7 +574,7 @@ public virtual async Task> UpdateAsync(HostPoolPatch /// /// /// - /// Object containing HostPool definitions. + /// The properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(HostPoolPatch patch, CancellationToken cancellationToken = default) @@ -575,127 +596,61 @@ public virtual Response Update(HostPoolPatch patch, Cancellati } /// - /// List the private link resources available for this hostpool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByHostPool - /// - /// - /// Default Api Version - /// 2024-04-03 - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateLinkResourcesRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DesktopVirtualizationPrivateLinkResourceData.DeserializeDesktopVirtualizationPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "HostPoolResource.GetPrivateLinkResources", "value", "nextLink", cancellationToken); - } - - /// - /// List the private link resources available for this hostpool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByHostPool - /// - /// - /// Default Api Version - /// 2024-04-03 - /// - /// - /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResources(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateLinkResourcesRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DesktopVirtualizationPrivateLinkResourceData.DeserializeDesktopVirtualizationPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "HostPoolResource.GetPrivateLinkResources", "value", "nextLink", cancellationToken); - } - - /// - /// List scaling plan associated with hostpool. + /// Operation to list the RegistrationTokens associated with the HostPool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/listRegistrationTokens /// /// /// Operation Id - /// ScalingPlans_ListByHostPool + /// HostPools_ListRegistrationTokens /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRegistrationTokensAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _scalingPlanRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scalingPlanRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), _scalingPlanClientDiagnostics, Pipeline, "HostPoolResource.GetScalingPlans", "value", "nextLink", cancellationToken); + 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); } /// - /// List scaling plan associated with hostpool. + /// Operation to list the RegistrationTokens associated with the HostPool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/listRegistrationTokens /// /// /// Operation Id - /// ScalingPlans_ListByHostPool + /// HostPools_ListRegistrationTokens /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRegistrationTokens(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _scalingPlanRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scalingPlanRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), _scalingPlanClientDiagnostics, Pipeline, "HostPoolResource.GetScalingPlans", "value", "nextLink", cancellationToken); + 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); } /// @@ -711,7 +666,7 @@ public virtual Pageable GetScalingPlans(int? pageSize = nul /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -749,7 +704,7 @@ public virtual async Task> RetrieveRegistrati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -775,71 +730,131 @@ public virtual Response RetrieveRegistrationToken(Canc } /// - /// List userSessions. + /// List scaling plan associated with hostpool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans /// /// /// Operation Id - /// UserSessions_ListByHostPool + /// ScalingPlans_ListByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUserSessionsAsync(string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScalingPlansAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _userSessionRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userSessionRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UserSessionResource(Client, UserSessionData.DeserializeUserSessionData(e)), _userSessionClientDiagnostics, Pipeline, "HostPoolResource.GetUserSessions", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _scalingPlanRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scalingPlanRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), _scalingPlanClientDiagnostics, Pipeline, "HostPoolResource.GetScalingPlans", "value", "nextLink", cancellationToken); } /// - /// List userSessions. + /// List scaling plan associated with hostpool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans /// /// /// Operation Id - /// UserSessions_ListByHostPool + /// ScalingPlans_ListByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUserSessions(string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScalingPlans(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _userSessionRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userSessionRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UserSessionResource(Client, UserSessionData.DeserializeUserSessionData(e)), _userSessionClientDiagnostics, Pipeline, "HostPoolResource.GetUserSessions", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _scalingPlanRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _scalingPlanRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ScalingPlanResource(Client, ScalingPlanData.DeserializeScalingPlanData(e)), _scalingPlanClientDiagnostics, Pipeline, "HostPoolResource.GetScalingPlans", "value", "nextLink", cancellationToken); + } + + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage + /// + /// + /// Operation Id + /// MsixImages_Expand + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// + /// Represents URI referring to MSIX Image. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ExpandMsixImagesAsync(MsixImageUri msixImageUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(msixImageUri, nameof(msixImageUri)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _msixImagesRestClient.CreateExpandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _msixImagesRestClient.CreateExpandNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ExpandMsixImage.DeserializeExpandMsixImage(e), _msixImagesClientDiagnostics, Pipeline, "HostPoolResource.ExpandMsixImages", "value", "nextLink", cancellationToken); + } + + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage + /// + /// + /// Operation Id + /// MsixImages_Expand + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// + /// Represents URI referring to MSIX Image. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ExpandMsixImages(MsixImageUri msixImageUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(msixImageUri, nameof(msixImageUri)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _msixImagesRestClient.CreateExpandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _msixImagesRestClient.CreateExpandNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ExpandMsixImage.DeserializeExpandMsixImage(e), _msixImagesClientDiagnostics, Pipeline, "HostPoolResource.ExpandMsixImages", "value", "nextLink", cancellationToken); } /// @@ -855,11 +870,11 @@ public virtual Pageable GetUserSessions(string filter = nul /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// - /// Object containing URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// is null. /// An async collection of that may take multiple service requests to iterate over. @@ -885,11 +900,11 @@ public virtual AsyncPageable ImportAppAttachPackageInf /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// - /// Object containing URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. @@ -903,63 +918,129 @@ public virtual Pageable ImportAppAttachPackageInfos(Im } /// - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// List the private link resources available for this hostpool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources /// /// /// Operation Id - /// MsixImages_Expand + /// PrivateLinkResources_ListByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// - /// Object containing URI to MSIX Image. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ExpandMsixImagesAsync(MsixImageUri msixImageUri, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateLinkResourcesAsync(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(msixImageUri, nameof(msixImageUri)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateLinkResourcesRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DesktopVirtualizationPrivateLinkResourceData.DeserializeDesktopVirtualizationPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "HostPoolResource.GetPrivateLinkResources", "value", "nextLink", cancellationToken); + } - HttpMessage FirstPageRequest(int? pageSizeHint) => _msixImagesRestClient.CreateExpandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _msixImagesRestClient.CreateExpandNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ExpandMsixImage.DeserializeExpandMsixImage(e), _msixImagesClientDiagnostics, Pipeline, "HostPoolResource.ExpandMsixImages", "value", "nextLink", cancellationToken); + /// + /// List the private link resources available for this hostpool. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_ListByHostPool + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateLinkResources(int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateLinkResourcesRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DesktopVirtualizationPrivateLinkResourceData.DeserializeDesktopVirtualizationPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "HostPoolResource.GetPrivateLinkResources", "value", "nextLink", cancellationToken); } /// - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// A synchronous resource action. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions /// /// /// Operation Id - /// MsixImages_Expand + /// UserSessions_ListByHostPool /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview + /// + /// + /// Resource + /// /// /// /// - /// Object containing URI to MSIX Image. + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ExpandMsixImages(MsixImageUri msixImageUri, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUserSessionsAsync(string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(msixImageUri, nameof(msixImageUri)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _userSessionRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userSessionRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UserSessionResource(Client, UserSessionData.DeserializeUserSessionData(e)), _userSessionClientDiagnostics, Pipeline, "HostPoolResource.GetUserSessions", "value", "nextLink", cancellationToken); + } - HttpMessage FirstPageRequest(int? pageSizeHint) => _msixImagesRestClient.CreateExpandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _msixImagesRestClient.CreateExpandNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, msixImageUri); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ExpandMsixImage.DeserializeExpandMsixImage(e), _msixImagesClientDiagnostics, Pipeline, "HostPoolResource.ExpandMsixImages", "value", "nextLink", cancellationToken); + /// + /// A synchronous resource action. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions + /// + /// + /// Operation Id + /// UserSessions_ListByHostPool + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUserSessions(string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _userSessionRestClient.CreateListByHostPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userSessionRestClient.CreateListByHostPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, pageSizeHint, isDescending, initialSkip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UserSessionResource(Client, UserSessionData.DeserializeUserSessionData(e)), _userSessionClientDiagnostics, Pipeline, "HostPoolResource.GetUserSessions", "value", "nextLink", cancellationToken); } /// @@ -975,7 +1056,7 @@ public virtual Pageable ExpandMsixImages(MsixImageUri msixImage /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -1037,7 +1118,7 @@ public virtual async Task> AddTagAsync(string key, st /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -1099,7 +1180,7 @@ public virtual Response AddTag(string key, string value, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -1156,7 +1237,7 @@ public virtual async Task> SetTagsAsync(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -1213,7 +1294,7 @@ public virtual Response SetTags(IDictionary ta /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -1273,7 +1354,7 @@ public virtual async Task> RemoveTagAsync(string key, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..6acb3ad55c16 --- /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); + return new SessionHostConfigurationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + 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..9161f15495df --- /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); + 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..1bf091a9eea3 --- /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); + 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..c27c097eaed0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.Serialization.cs @@ -0,0 +1,208 @@ +// 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."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.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 + } + } + } + + 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; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + 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)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActiveSessionHostConfigurationList(value, 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: "); + builder.AppendLine($"'{NextLink.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); + 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..c8dacb8a3170 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ActiveSessionHostConfigurationList.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +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 . + /// The ActiveSessionHostConfiguration items on this page. + /// is null. + internal ActiveSessionHostConfigurationList(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ActiveSessionHostConfiguration items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ActiveSessionHostConfigurationList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ActiveSessionHostConfigurationList() + { + } + + /// The ActiveSessionHostConfiguration items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageArchitecture.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageArchitecture.cs index 2a4512952f60..b06f2b8444a7 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageArchitecture.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageArchitecture.cs @@ -30,19 +30,19 @@ public AppAttachPackageArchitecture(string value) private const string X86A64Value = "x86a64"; private const string AllValue = "ALL"; - /// ARM. + /// ARM 32-bit. public static AppAttachPackageArchitecture Arm { get; } = new AppAttachPackageArchitecture(ArmValue); - /// ARM64. + /// ARM 64-bit. public static AppAttachPackageArchitecture Arm64 { get; } = new AppAttachPackageArchitecture(Arm64Value); - /// x86. + /// 32-bit x86. public static AppAttachPackageArchitecture X86 { get; } = new AppAttachPackageArchitecture(X86Value); - /// x64. + /// 64-bit. public static AppAttachPackageArchitecture X64 { get; } = new AppAttachPackageArchitecture(X64Value); - /// Neutral. + /// Any architecture can be used. public static AppAttachPackageArchitecture Neutral { get; } = new AppAttachPackageArchitecture(NeutralValue); - /// x86a64. + /// X86 Compiled Hybrid Portable Executable for ARM64. public static AppAttachPackageArchitecture X86A64 { get; } = new AppAttachPackageArchitecture(X86A64Value); - /// ALL. + /// Select all listed applications, no filters. public static AppAttachPackageArchitecture All { get; } = new AppAttachPackageArchitecture(AllValue); /// Determines if two values are the same. public static bool operator ==(AppAttachPackageArchitecture left, AppAttachPackageArchitecture right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.Serialization.cs index f3381221967c..36295ee273e3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.Serialization.cs @@ -63,15 +63,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsDefined(DisplayName)) { - if (DisplayName != null) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - else - { - writer.WriteNull("displayName"); - } + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); } if (Optional.IsDefined(PackageRelativePath)) { @@ -90,20 +83,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsCollectionDefined(PackageDependencies)) { - if (PackageDependencies != null) - { - writer.WritePropertyName("packageDependencies"u8); - writer.WriteStartArray(); - foreach (var item in PackageDependencies) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else + writer.WritePropertyName("packageDependencies"u8); + writer.WriteStartArray(); + foreach (var item in PackageDependencies) { - writer.WriteNull("packageDependencies"); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); } if (Optional.IsDefined(Version)) { @@ -127,39 +113,18 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsDefined(CertificateName)) { - if (CertificateName != null) - { - writer.WritePropertyName("certificateName"u8); - writer.WriteStringValue(CertificateName); - } - else - { - writer.WriteNull("certificateName"); - } + writer.WritePropertyName("certificateName"u8); + writer.WriteStringValue(CertificateName); } if (Optional.IsDefined(CertificateExpireOn)) { - if (CertificateExpireOn != null) - { - writer.WritePropertyName("certificateExpiry"u8); - writer.WriteStringValue(CertificateExpireOn.Value, "O"); - } - else - { - writer.WriteNull("certificateExpiry"); - } + writer.WritePropertyName("certificateExpiry"u8); + writer.WriteStringValue(CertificateExpireOn.Value, "O"); } if (Optional.IsDefined(IsPackageTimestamped)) { - if (IsPackageTimestamped != null) - { - writer.WritePropertyName("isPackageTimestamped"u8); - writer.WriteStringValue(IsPackageTimestamped.Value.ToString()); - } - else - { - writer.WriteNull("isPackageTimestamped"); - } + writer.WritePropertyName("isPackageTimestamped"u8); + writer.WriteStringValue(IsPackageTimestamped.Value.ToString()); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -245,11 +210,6 @@ internal static AppAttachPackageInfoProperties DeserializeAppAttachPackageInfoPr } if (property.NameEquals("displayName"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - displayName = null; - continue; - } displayName = property.Value.GetString(); continue; } @@ -280,7 +240,6 @@ internal static AppAttachPackageInfoProperties DeserializeAppAttachPackageInfoPr { if (property.Value.ValueKind == JsonValueKind.Null) { - packageDependencies = null; continue; } List array = new List(); @@ -321,11 +280,6 @@ internal static AppAttachPackageInfoProperties DeserializeAppAttachPackageInfoPr } if (property.NameEquals("certificateName"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - certificateName = null; - continue; - } certificateName = property.Value.GetString(); continue; } @@ -333,7 +287,6 @@ internal static AppAttachPackageInfoProperties DeserializeAppAttachPackageInfoPr { if (property.Value.ValueKind == JsonValueKind.Null) { - certificateExpiry = null; continue; } certificateExpiry = property.Value.GetDateTimeOffset("O"); @@ -343,7 +296,6 @@ internal static AppAttachPackageInfoProperties DeserializeAppAttachPackageInfoPr { if (property.Value.ValueKind == JsonValueKind.Null) { - isPackageTimestamped = null; continue; } isPackageTimestamped = new PackageTimestamped(property.Value.GetString()); 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..dc95cec7671d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageInfoProperties.cs @@ -120,7 +120,7 @@ internal AppAttachPackageInfoProperties(string packageAlias, string imagePath, s public bool? IsActive { get; set; } /// List of package dependencies. [WirePath("packageDependencies")] - public IList PackageDependencies { get; set; } + public IList PackageDependencies { get; } /// Package version found in the appxmanifest.xml. [WirePath("version")] public string Version { get; set; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.Serialization.cs index 2a58766e0baf..5c6fe7372737 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(AppAttachPackageList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static AppAttachPackageList DeserializeAppAttachPackageList(JsonElement return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static AppAttachPackageList DeserializeAppAttachPackageList(JsonElement } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static AppAttachPackageList DeserializeAppAttachPackageList(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new AppAttachPackageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new AppAttachPackageList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.cs index 992faa379ea6..cdd503ae81bd 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class AppAttachPackageList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal AppAttachPackageList() + /// The AppAttachPackage items on this page. + /// is null. + internal AppAttachPackageList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of App Attach Package definitions. - /// Link to the next page of results. + /// The AppAttachPackage items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal AppAttachPackageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal AppAttachPackageList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of App Attach Package definitions. + /// Initializes a new instance of for deserialization. + internal AppAttachPackageList() + { + } + + /// The AppAttachPackage items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } 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 cd94595f0dd8..e5456f830d61 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..ff2d54b11347 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatch.cs @@ -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 16950f8b7d45..130ebf15f6e3 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..ee39c265e0c5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackagePatchProperties.cs @@ -57,13 +57,17 @@ public AppAttachPackagePatchProperties() /// 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. + /// 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 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; } @@ -79,5 +83,11 @@ internal AppAttachPackagePatchProperties(AppAttachPackageInfoProperties image, I /// 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, 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/AppAttachPackageProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs deleted file mode 100644 index 5ed2b98f68d7..000000000000 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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 -{ - /// Schema for App Attach Package properties. - public partial class AppAttachPackageProperties - { - /// - /// 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 AppAttachPackageProperties() - { - HostPoolReferences = new ChangeTrackingList(); - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal AppAttachPackageProperties(AppAttachPackageProvisioningState? provisioningState, AppAttachPackageInfoProperties image, IList hostPoolReferences, Uri keyVaultUri, FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure, IDictionary serializedAdditionalRawData) - { - ProvisioningState = provisioningState; - Image = image; - HostPoolReferences = hostPoolReferences; - KeyVaultUri = keyVaultUri; - FailHealthCheckOnStagingFailure = failHealthCheckOnStagingFailure; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The provisioning state of the App Attach Package. - [WirePath("provisioningState")] - public AppAttachPackageProvisioningState? ProvisioningState { get; } - /// Detailed properties for App Attach Package. - [WirePath("image")] - public AppAttachPackageInfoProperties Image { get; set; } - /// List of Hostpool resource Ids. - [WirePath("hostPoolReferences")] - public IList HostPoolReferences { get; } - /// URL path to certificate name located in keyVault. - [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; } - } -} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProvisioningState.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProvisioningState.cs index 4250c04e7b4e..926a88691a64 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProvisioningState.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProvisioningState.cs @@ -27,13 +27,13 @@ public AppAttachPackageProvisioningState(string value) private const string FailedValue = "Failed"; private const string CanceledValue = "Canceled"; - /// Succeeded. + /// Provisioning Successful. public static AppAttachPackageProvisioningState Succeeded { get; } = new AppAttachPackageProvisioningState(SucceededValue); - /// Provisioning. + /// Provisioning in Progress. public static AppAttachPackageProvisioningState Provisioning { get; } = new AppAttachPackageProvisioningState(ProvisioningValue); - /// Failed. + /// Provisioning Failed. public static AppAttachPackageProvisioningState Failed { get; } = new AppAttachPackageProvisioningState(FailedValue); - /// Canceled. + /// Provisioning was Canceled. public static AppAttachPackageProvisioningState Canceled { get; } = new AppAttachPackageProvisioningState(CanceledValue); /// Determines if two values are the same. public static bool operator ==(AppAttachPackageProvisioningState left, AppAttachPackageProvisioningState right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.Serialization.cs index 0e170793ca14..759a7370cf67 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ApplicationGroupList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ApplicationGroupList DeserializeApplicationGroupList(JsonElement return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ApplicationGroupList DeserializeApplicationGroupList(JsonElement } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ApplicationGroupList DeserializeApplicationGroupList(JsonElement } } serializedAdditionalRawData = rawDataDictionary; - return new ApplicationGroupList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ApplicationGroupList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.cs index 9b78439b0da4..fae16a9ca334 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ApplicationGroupList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ApplicationGroupList() + /// The ApplicationGroup items on this page. + /// is null. + internal ApplicationGroupList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of ApplicationGroup definitions. - /// Link to the next page of results. + /// The ApplicationGroup items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ApplicationGroupList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ApplicationGroupList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of ApplicationGroup definitions. + /// Initializes a new instance of for deserialization. + internal ApplicationGroupList() + { + } + + /// The ApplicationGroup items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.Serialization.cs new file mode 100644 index 000000000000..29f992ab033b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.Serialization.cs @@ -0,0 +1,235 @@ +// 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 ApplicationGroupPatchProperties : 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(ApplicationGroupPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsDefined(ShowInFeed)) + { + writer.WritePropertyName("showInFeed"u8); + writer.WriteBooleanValue(ShowInFeed.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 + } + } + } + + ApplicationGroupPatchProperties 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(ApplicationGroupPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationGroupPatchProperties(document.RootElement, options); + } + + internal static ApplicationGroupPatchProperties DeserializeApplicationGroupPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string friendlyName = default; + bool? showInFeed = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("showInFeed"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + showInFeed = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ApplicationGroupPatchProperties(description, friendlyName, showInFeed, 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(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + 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(ShowInFeed), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" showInFeed: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ShowInFeed)) + { + builder.Append(" showInFeed: "); + var boolValue = ShowInFeed.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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ApplicationGroupPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ApplicationGroupPatchProperties 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 DeserializeApplicationGroupPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ApplicationGroupPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.cs new file mode 100644 index 000000000000..d9e6580b4438 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationGroupPatchProperties.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 +{ + /// ApplicationGroup properties that can be patched. + public partial class ApplicationGroupPatchProperties + { + /// + /// 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 ApplicationGroupPatchProperties() + { + } + + /// Initializes a new instance of . + /// Description of ApplicationGroup. + /// Friendly name of ApplicationGroup. + /// Boolean representing whether the applicationGroup is show in the feed. + /// Keeps track of any properties unknown to the library. + internal ApplicationGroupPatchProperties(string description, string friendlyName, bool? showInFeed, IDictionary serializedAdditionalRawData) + { + Description = description; + FriendlyName = friendlyName; + ShowInFeed = showInFeed; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of ApplicationGroup. + [WirePath("description")] + public string Description { get; set; } + /// Friendly name of ApplicationGroup. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + /// Boolean representing whether the applicationGroup is show in the feed. + [WirePath("showInFeed")] + public bool? ShowInFeed { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.Serialization.cs index 972b6b7106cc..20f7e73fd852 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ApplicationList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ApplicationList DeserializeApplicationList(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ApplicationList DeserializeApplicationList(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ApplicationList DeserializeApplicationList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ApplicationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ApplicationList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.cs index 1d53408984e9..5b66d7e7175c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ApplicationList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ApplicationList() + /// The Application items on this page. + /// is null. + internal ApplicationList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of Application definitions. - /// Link to the next page of results. + /// The Application items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ApplicationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ApplicationList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of Application definitions. + /// Initializes a new instance of for deserialization. + internal ApplicationList() + { + } + + /// The Application items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.Serialization.cs new file mode 100644 index 000000000000..72a36cb20ca4 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.Serialization.cs @@ -0,0 +1,267 @@ +// 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 ApplicationPatchProperties : 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(ApplicationPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsDefined(FilePath)) + { + writer.WritePropertyName("filePath"u8); + writer.WriteStringValue(FilePath); + } + if (Optional.IsDefined(CommandLineSetting)) + { + writer.WritePropertyName("commandLineSetting"u8); + writer.WriteStringValue(CommandLineSetting.Value.ToString()); + } + if (Optional.IsDefined(CommandLineArguments)) + { + writer.WritePropertyName("commandLineArguments"u8); + writer.WriteStringValue(CommandLineArguments); + } + if (Optional.IsDefined(ShowInPortal)) + { + writer.WritePropertyName("showInPortal"u8); + writer.WriteBooleanValue(ShowInPortal.Value); + } + if (Optional.IsDefined(IconPath)) + { + writer.WritePropertyName("iconPath"u8); + writer.WriteStringValue(IconPath); + } + if (Optional.IsDefined(IconIndex)) + { + writer.WritePropertyName("iconIndex"u8); + writer.WriteNumberValue(IconIndex.Value); + } + if (Optional.IsDefined(MsixPackageFamilyName)) + { + writer.WritePropertyName("msixPackageFamilyName"u8); + writer.WriteStringValue(MsixPackageFamilyName); + } + if (Optional.IsDefined(MsixPackageApplicationId)) + { + writer.WritePropertyName("msixPackageApplicationId"u8); + writer.WriteStringValue(MsixPackageApplicationId); + } + if (Optional.IsDefined(ApplicationType)) + { + writer.WritePropertyName("applicationType"u8); + writer.WriteStringValue(ApplicationType.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 + } + } + } + + ApplicationPatchProperties 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(ApplicationPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeApplicationPatchProperties(document.RootElement, options); + } + + internal static ApplicationPatchProperties DeserializeApplicationPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string friendlyName = default; + string filePath = default; + VirtualApplicationCommandLineSetting? commandLineSetting = default; + string commandLineArguments = default; + bool? showInPortal = default; + string iconPath = default; + int? iconIndex = default; + string msixPackageFamilyName = default; + string msixPackageApplicationId = default; + RemoteApplicationType? applicationType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("filePath"u8)) + { + filePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("commandLineSetting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + commandLineSetting = new VirtualApplicationCommandLineSetting(property.Value.GetString()); + continue; + } + if (property.NameEquals("commandLineArguments"u8)) + { + commandLineArguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("showInPortal"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + showInPortal = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("iconPath"u8)) + { + iconPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("iconIndex"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + iconIndex = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("msixPackageFamilyName"u8)) + { + msixPackageFamilyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("msixPackageApplicationId"u8)) + { + msixPackageApplicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("applicationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationType = new RemoteApplicationType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ApplicationPatchProperties( + description, + friendlyName, + filePath, + commandLineSetting, + commandLineArguments, + showInPortal, + iconPath, + iconIndex, + msixPackageFamilyName, + msixPackageApplicationId, + applicationType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ApplicationPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ApplicationPatchProperties 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 DeserializeApplicationPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ApplicationPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.cs new file mode 100644 index 000000000000..044889ef725d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ApplicationPatchProperties.cs @@ -0,0 +1,116 @@ +// 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 +{ + /// Application properties that can be patched. + public partial class ApplicationPatchProperties + { + /// + /// 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 ApplicationPatchProperties() + { + } + + /// Initializes a new instance of . + /// Description of Application. + /// Friendly name of Application. + /// Specifies a path for the executable file for the application. + /// Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. + /// Command Line Arguments for Application. + /// Specifies whether to show the RemoteApp program in the RD Web Access server. + /// Path to icon. + /// Index of the icon. + /// Specifies the package family name for MSIX applications. + /// Specifies the package application Id for MSIX applications. + /// Resource Type of Application. + /// Keeps track of any properties unknown to the library. + internal ApplicationPatchProperties(string description, string friendlyName, string filePath, VirtualApplicationCommandLineSetting? commandLineSetting, string commandLineArguments, bool? showInPortal, string iconPath, int? iconIndex, string msixPackageFamilyName, string msixPackageApplicationId, RemoteApplicationType? applicationType, IDictionary serializedAdditionalRawData) + { + Description = description; + FriendlyName = friendlyName; + FilePath = filePath; + CommandLineSetting = commandLineSetting; + CommandLineArguments = commandLineArguments; + ShowInPortal = showInPortal; + IconPath = iconPath; + IconIndex = iconIndex; + MsixPackageFamilyName = msixPackageFamilyName; + MsixPackageApplicationId = msixPackageApplicationId; + ApplicationType = applicationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of Application. + [WirePath("description")] + public string Description { get; set; } + /// Friendly name of Application. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + /// Specifies a path for the executable file for the application. + [WirePath("filePath")] + public string FilePath { get; set; } + /// Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. + [WirePath("commandLineSetting")] + public VirtualApplicationCommandLineSetting? CommandLineSetting { get; set; } + /// Command Line Arguments for Application. + [WirePath("commandLineArguments")] + public string CommandLineArguments { get; set; } + /// Specifies whether to show the RemoteApp program in the RD Web Access server. + [WirePath("showInPortal")] + public bool? ShowInPortal { get; set; } + /// Path to icon. + [WirePath("iconPath")] + public string IconPath { get; set; } + /// Index of the icon. + [WirePath("iconIndex")] + public int? IconIndex { get; set; } + /// Specifies the package family name for MSIX applications. + [WirePath("msixPackageFamilyName")] + public string MsixPackageFamilyName { get; set; } + /// Specifies the package application Id for MSIX applications. + [WirePath("msixPackageApplicationId")] + public string MsixPackageApplicationId { get; set; } + /// Resource Type of Application. + [WirePath("applicationType")] + public RemoteApplicationType? ApplicationType { 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..11eb542e9803 --- /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); + 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..ca17b858983c --- /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); + 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..12a7da087ed2 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/BootDiagnosticsInfoProperties.Serialization.cs @@ -0,0 +1,197 @@ +// 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)) + { + 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 + } + } + } + + 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) + { + 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); + 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/CreateDeleteProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/CreateDeleteProperties.Serialization.cs new file mode 100644 index 000000000000..fe143ba334aa --- /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); + 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..016a72785d3f --- /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); + 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..d5060e56c08a --- /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 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 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..9332645cb5fb --- /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); + 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..f6dd411bc010 --- /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 image. + /// is null. + public CustomInfoProperties(ResourceIdentifier resourceId) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ResourceId = resourceId; + } + + /// Initializes a new instance of . + /// The resource ID of the 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 image. + [WirePath("resourceId")] + public ResourceIdentifier ResourceId { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.Serialization.cs index 59d7c44d022a..9c6bd85e0984 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(DesktopList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static DesktopList DeserializeDesktopList(JsonElement element, ModelRea return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static DesktopList DeserializeDesktopList(JsonElement element, ModelRea } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static DesktopList DeserializeDesktopList(JsonElement element, ModelRea } } serializedAdditionalRawData = rawDataDictionary; - return new DesktopList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new DesktopList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.cs index ea20e1f23c47..84b5238c2b03 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class DesktopList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal DesktopList() + /// The Desktop items on this page. + /// is null. + internal DesktopList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of Desktop definitions. - /// Link to the next page of results. + /// The Desktop items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal DesktopList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal DesktopList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of Desktop definitions. + /// Initializes a new instance of for deserialization. + internal DesktopList() + { + } + + /// The Desktop items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.Serialization.cs new file mode 100644 index 000000000000..9afd91ec4b4e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.Serialization.cs @@ -0,0 +1,140 @@ +// 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 DesktopPatchProperties : 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(DesktopPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + 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 + } + } + } + + DesktopPatchProperties 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(DesktopPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDesktopPatchProperties(document.RootElement, options); + } + + internal static DesktopPatchProperties DeserializeDesktopPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string friendlyName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DesktopPatchProperties(description, friendlyName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DesktopPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + DesktopPatchProperties 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 DeserializeDesktopPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DesktopPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.cs new file mode 100644 index 000000000000..5366d386505b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopPatchProperties.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 +{ + /// Desktop properties that can be patched. + public partial class DesktopPatchProperties + { + /// + /// 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 DesktopPatchProperties() + { + } + + /// Initializes a new instance of . + /// Description of Desktop. + /// Friendly name of Desktop. + /// Keeps track of any properties unknown to the library. + internal DesktopPatchProperties(string description, string friendlyName, IDictionary serializedAdditionalRawData) + { + Description = description; + FriendlyName = friendlyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of Desktop. + [WirePath("description")] + public string Description { get; set; } + /// Friendly name of Desktop. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationDayOfWeek.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationDayOfWeek.cs index 546d3bbee293..78d6367fbcf3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationDayOfWeek.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationDayOfWeek.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Day of the week. + /// Day of the week. Modeled as string. public enum DesktopVirtualizationDayOfWeek { /// Monday. diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.Serialization.cs index 87773c63a48f..6588cbc70cc2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.Serialization.cs @@ -8,12 +8,10 @@ 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.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -39,34 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsCollectionDefined(GroupIds)) - { - writer.WritePropertyName("groupIds"u8); - writer.WriteStartArray(); - foreach (var item in GroupIds) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(PrivateEndpoint)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("privateEndpoint"u8); - JsonSerializer.Serialize(writer, PrivateEndpoint); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); } DesktopVirtualizationPrivateEndpointConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -89,18 +64,24 @@ internal static DesktopVirtualizationPrivateEndpointConnection DeserializeDeskto { return null; } + PrivateEndpointConnectionProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IReadOnlyList groupIds = default; - SubResource privateEndpoint = default; - DesktopVirtualizationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; - DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = 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) + { + continue; + } + properties = PrivateEndpointConnectionProperties.DeserializePrivateEndpointConnectionProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -125,59 +106,6 @@ internal static DesktopVirtualizationPrivateEndpointConnection DeserializeDeskto 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("groupIds"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - groupIds = array; - continue; - } - if (property0.NameEquals("privateEndpoint"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpoint = JsonSerializer.Deserialize(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = DesktopVirtualizationPrivateLinkServiceConnectionState.DeserializeDesktopVirtualizationPrivateLinkServiceConnectionState(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -189,10 +117,7 @@ internal static DesktopVirtualizationPrivateEndpointConnection DeserializeDeskto name, type, systemData, - groupIds ?? new ChangeTrackingList(), - privateEndpoint, - privateLinkServiceConnectionState, - provisioningState, + properties, serializedAdditionalRawData); } @@ -230,125 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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(GroupIds), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupIds: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(GroupIds)) - { - if (GroupIds.Any()) - { - builder.Append(" groupIds: "); - builder.AppendLine("["); - foreach (var item in GroupIds) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); } else { - if (Optional.IsDefined(PrivateEndpoint)) + if (Optional.IsDefined(Properties)) { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" privateLinkServiceConnectionState: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ConnectionState)) + if (Optional.IsDefined(Id)) { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, ConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" provisioningState: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.cs index 1e3d56544a43..2755f4683d6d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnection.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,12 +45,11 @@ public partial class DesktopVirtualizationPrivateEndpointConnection : ResourceDa /// /// /// - private protected IDictionary _serializedAdditionalRawData; + private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . public DesktopVirtualizationPrivateEndpointConnection() { - GroupIds = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -59,37 +57,16 @@ public DesktopVirtualizationPrivateEndpointConnection() /// The name. /// The resourceType. /// The systemData. - /// The group ids for the private endpoint resource. - /// The private endpoint resource. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. + /// Resource properties. /// Keeps track of any properties unknown to the library. - internal DesktopVirtualizationPrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList groupIds, SubResource privateEndpoint, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DesktopVirtualizationPrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateEndpointConnectionProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - GroupIds = groupIds; - PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; - ProvisioningState = provisioningState; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The group ids for the private endpoint resource. - [WirePath("properties.groupIds")] - public IReadOnlyList GroupIds { get; } - /// The private endpoint resource. - internal SubResource PrivateEndpoint { get; set; } - /// Gets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; - } - - /// A collection of information about the state of the connection between service consumer and provider. - [WirePath("properties.privateLinkServiceConnectionState")] - public DesktopVirtualizationPrivateLinkServiceConnectionState ConnectionState { get; set; } - /// The provisioning state of the private endpoint connection resource. - [WirePath("properties.provisioningState")] - public DesktopVirtualizationPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + /// Resource properties. + [WirePath("properties")] + public PrivateEndpointConnectionProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnectionProvisioningState.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnectionProvisioningState.cs index d74964c083df..c15ae7180495 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnectionProvisioningState.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointConnectionProvisioningState.cs @@ -27,13 +27,13 @@ public DesktopVirtualizationPrivateEndpointConnectionProvisioningState(string va private const string DeletingValue = "Deleting"; private const string FailedValue = "Failed"; - /// Succeeded. + /// Provisioning was successful. public static DesktopVirtualizationPrivateEndpointConnectionProvisioningState Succeeded { get; } = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(SucceededValue); - /// Creating. + /// A PrivateEndpointConnection is being created. public static DesktopVirtualizationPrivateEndpointConnectionProvisioningState Creating { get; } = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(CreatingValue); - /// Deleting. + /// A PrivateEndpointConnection is being deleted. public static DesktopVirtualizationPrivateEndpointConnectionProvisioningState Deleting { get; } = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. + /// Provisioning failed. public static DesktopVirtualizationPrivateEndpointConnectionProvisioningState Failed { get; } = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(FailedValue); /// Determines if two values are the same. public static bool operator ==(DesktopVirtualizationPrivateEndpointConnectionProvisioningState left, DesktopVirtualizationPrivateEndpointConnectionProvisioningState right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointServiceConnectionStatus.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointServiceConnectionStatus.cs index d09c1048ca5b..47bdc979aa5d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointServiceConnectionStatus.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateEndpointServiceConnectionStatus.cs @@ -26,11 +26,11 @@ public DesktopVirtualizationPrivateEndpointServiceConnectionStatus(string value) private const string ApprovedValue = "Approved"; private const string RejectedValue = "Rejected"; - /// Pending. + /// Connection is Pending. public static DesktopVirtualizationPrivateEndpointServiceConnectionStatus Pending { get; } = new DesktopVirtualizationPrivateEndpointServiceConnectionStatus(PendingValue); - /// Approved. + /// Connection was Approved. public static DesktopVirtualizationPrivateEndpointServiceConnectionStatus Approved { get; } = new DesktopVirtualizationPrivateEndpointServiceConnectionStatus(ApprovedValue); - /// Rejected. + /// Connection was rejected. public static DesktopVirtualizationPrivateEndpointServiceConnectionStatus Rejected { get; } = new DesktopVirtualizationPrivateEndpointServiceConnectionStatus(RejectedValue); /// Determines if two values are the same. public static bool operator ==(DesktopVirtualizationPrivateEndpointServiceConnectionStatus left, DesktopVirtualizationPrivateEndpointServiceConnectionStatus right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.Serialization.cs index 5ae6ac777dc5..84ddc77ff75e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -38,34 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); - } - if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RequiredZoneNames)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("requiredZoneNames"u8); - writer.WriteStartArray(); - foreach (var item in RequiredZoneNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } DesktopVirtualizationPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -88,17 +64,24 @@ internal static DesktopVirtualizationPrivateLinkResourceData DeserializeDesktopV { return null; } + DesktopVirtualizationPrivateLinkResourceProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string groupId = default; - IReadOnlyList requiredMembers = default; - IList requiredZoneNames = 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) + { + continue; + } + properties = DesktopVirtualizationPrivateLinkResourceProperties.DeserializeDesktopVirtualizationPrivateLinkResourceProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -123,51 +106,6 @@ internal static DesktopVirtualizationPrivateLinkResourceData DeserializeDesktopV 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("groupId"u8)) - { - groupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("requiredMembers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property0.NameEquals("requiredZoneNames"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredZoneNames = array; - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -179,9 +117,7 @@ internal static DesktopVirtualizationPrivateLinkResourceData DeserializeDesktopV name, type, systemData, - groupId, - requiredMembers ?? new ChangeTrackingList(), - requiredZoneNames ?? new ChangeTrackingList(), + properties, serializedAdditionalRawData); } @@ -219,134 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Properties)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GroupId)) - { - builder.Append(" groupId: "); - if (GroupId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GroupId}'''"); - } - else - { - builder.AppendLine($"'{GroupId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" requiredMembers: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(RequiredMembers)) + if (Optional.IsDefined(Id)) { - if (RequiredMembers.Any()) - { - builder.Append(" requiredMembers: "); - builder.AppendLine("["); - foreach (var item in RequiredMembers) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" requiredZoneNames: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(RequiredZoneNames)) + if (Optional.IsDefined(SystemData)) { - if (RequiredZoneNames.Any()) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine("["); - foreach (var item in RequiredZoneNames) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.cs index c550b9fff826..5c8dcf4bb11c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceData.cs @@ -50,8 +50,6 @@ public partial class DesktopVirtualizationPrivateLinkResourceData : ResourceData /// Initializes a new instance of . public DesktopVirtualizationPrivateLinkResourceData() { - RequiredMembers = new ChangeTrackingList(); - RequiredZoneNames = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -59,26 +57,16 @@ public DesktopVirtualizationPrivateLinkResourceData() /// The name. /// The resourceType. /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. + /// Resource properties. /// Keeps track of any properties unknown to the library. - internal DesktopVirtualizationPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DesktopVirtualizationPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DesktopVirtualizationPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - GroupId = groupId; - RequiredMembers = requiredMembers; - RequiredZoneNames = requiredZoneNames; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The private link resource group id. - [WirePath("properties.groupId")] - public string GroupId { get; } - /// The private link resource required member names. - [WirePath("properties.requiredMembers")] - public IReadOnlyList RequiredMembers { get; } - /// The private link resource Private link DNS zone name. - [WirePath("properties.requiredZoneNames")] - public IList RequiredZoneNames { get; } + /// Resource properties. + [WirePath("properties")] + public DesktopVirtualizationPrivateLinkResourceProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.Serialization.cs index 9d5a043d9b66..2115f46334dc 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(DesktopVirtualizationPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static DesktopVirtualizationPrivateLinkResourceListResult DeserializeDe return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static DesktopVirtualizationPrivateLinkResourceListResult DeserializeDe } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static DesktopVirtualizationPrivateLinkResourceListResult DeserializeDe } } serializedAdditionalRawData = rawDataDictionary; - return new DesktopVirtualizationPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new DesktopVirtualizationPrivateLinkResourceListResult(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.cs index 18f54da31da2..20360e32a641 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceListResult.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class DesktopVirtualizationPrivateLinkResourceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal DesktopVirtualizationPrivateLinkResourceListResult() + /// The PrivateLinkResource items on this page. + /// is null. + internal DesktopVirtualizationPrivateLinkResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private link resources. - /// Link to the next page of results. + /// The PrivateLinkResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal DesktopVirtualizationPrivateLinkResourceListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal DesktopVirtualizationPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private link resources. + /// Initializes a new instance of for deserialization. + internal DesktopVirtualizationPrivateLinkResourceListResult() + { + } + + /// The PrivateLinkResource items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..7b15b37926b8 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.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.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class DesktopVirtualizationPrivateLinkResourceProperties : 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(DesktopVirtualizationPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (var item in RequiredMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + 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 + } + } + } + + DesktopVirtualizationPrivateLinkResourceProperties 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(DesktopVirtualizationPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDesktopVirtualizationPrivateLinkResourceProperties(document.RootElement, options); + } + + internal static DesktopVirtualizationPrivateLinkResourceProperties DeserializeDesktopVirtualizationPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupId = default; + IReadOnlyList requiredMembers = default; + IList requiredZoneNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredMembers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + if (property.NameEquals("requiredZoneNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DesktopVirtualizationPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), 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(GroupId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" groupId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GroupId)) + { + builder.Append(" groupId: "); + if (GroupId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{GroupId}'''"); + } + else + { + builder.AppendLine($"'{GroupId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requiredMembers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(RequiredMembers)) + { + if (RequiredMembers.Any()) + { + builder.Append(" requiredMembers: "); + builder.AppendLine("["); + foreach (var item in RequiredMembers) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requiredZoneNames: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + if (RequiredZoneNames.Any()) + { + builder.Append(" requiredZoneNames: "); + builder.AppendLine("["); + foreach (var item in RequiredZoneNames) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DesktopVirtualizationPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DesktopVirtualizationPrivateLinkResourceProperties 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 DeserializeDesktopVirtualizationPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DesktopVirtualizationPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..4a4422eedb8b --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPrivateLinkResourceProperties.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 +{ + /// Properties of a private link resource. + public partial class DesktopVirtualizationPrivateLinkResourceProperties + { + /// + /// 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 DesktopVirtualizationPrivateLinkResourceProperties() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource Private link DNS zone name. + /// Keeps track of any properties unknown to the library. + internal DesktopVirtualizationPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The private link resource group id. + [WirePath("groupId")] + public string GroupId { get; } + /// The private link resource required member names. + [WirePath("requiredMembers")] + public IReadOnlyList RequiredMembers { get; } + /// The private link resource Private link DNS zone name. + [WirePath("requiredZoneNames")] + public IList RequiredZoneNames { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPublicNetworkAccess.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPublicNetworkAccess.cs index 1f6b28b6422d..69c3e0d34011 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPublicNetworkAccess.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationPublicNetworkAccess.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. + /// Enabled to allow this resource to be access from the public network. public readonly partial struct DesktopVirtualizationPublicNetworkAccess : IEquatable { private readonly string _value; @@ -25,9 +25,9 @@ public DesktopVirtualizationPublicNetworkAccess(string value) private const string EnabledValue = "Enabled"; private const string DisabledValue = "Disabled"; - /// Enabled. + /// This resource is accessible from the public network. public static DesktopVirtualizationPublicNetworkAccess Enabled { get; } = new DesktopVirtualizationPublicNetworkAccess(EnabledValue); - /// Disabled. + /// This resource is not accessible from the public network. public static DesktopVirtualizationPublicNetworkAccess Disabled { get; } = new DesktopVirtualizationPublicNetworkAccess(DisabledValue); /// Determines if two values are the same. public static bool operator ==(DesktopVirtualizationPublicNetworkAccess left, DesktopVirtualizationPublicNetworkAccess right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.Serialization.cs index 76d7d3903137..bc9058936210 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.Serialization.cs @@ -37,34 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(AppAlias)) - { - writer.WritePropertyName("appAlias"u8); - writer.WriteStringValue(AppAlias); - } - if (Optional.IsDefined(FilePath)) - { - writer.WritePropertyName("filePath"u8); - writer.WriteStringValue(FilePath); - } - if (Optional.IsDefined(CommandLineArguments)) - { - writer.WritePropertyName("commandLineArguments"u8); - writer.WriteStringValue(CommandLineArguments); - } - if (Optional.IsDefined(IconPath)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("iconPath"u8); - writer.WriteStringValue(IconPath); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(IconIndex)) - { - writer.WritePropertyName("iconIndex"u8); - writer.WriteNumberValue(IconIndex.Value); - } - writer.WriteEndObject(); } DesktopVirtualizationStartMenuItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -87,19 +64,24 @@ internal static DesktopVirtualizationStartMenuItem DeserializeDesktopVirtualizat { return null; } + StartMenuItemProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string appAlias = default; - string filePath = default; - string commandLineArguments = default; - string iconPath = default; - int? iconIndex = 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) + { + continue; + } + properties = StartMenuItemProperties.DeserializeStartMenuItemProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -124,47 +106,6 @@ internal static DesktopVirtualizationStartMenuItem DeserializeDesktopVirtualizat 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("appAlias"u8)) - { - appAlias = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("filePath"u8)) - { - filePath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("commandLineArguments"u8)) - { - commandLineArguments = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("iconPath"u8)) - { - iconPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("iconIndex"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - iconIndex = property0.Value.GetInt32(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -176,11 +117,7 @@ internal static DesktopVirtualizationStartMenuItem DeserializeDesktopVirtualizat name, type, systemData, - appAlias, - filePath, - commandLineArguments, - iconPath, - iconIndex, + properties, serializedAdditionalRawData); } @@ -218,146 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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(AppAlias), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" appAlias: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AppAlias)) - { - builder.Append(" appAlias: "); - if (AppAlias.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AppAlias}'''"); - } - else - { - builder.AppendLine($"'{AppAlias}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FilePath), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" filePath: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FilePath)) - { - builder.Append(" filePath: "); - if (FilePath.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{FilePath}'''"); - } - else - { - builder.AppendLine($"'{FilePath}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CommandLineArguments), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" commandLineArguments: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(CommandLineArguments)) + if (Optional.IsDefined(Properties)) { - builder.Append(" commandLineArguments: "); - if (CommandLineArguments.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CommandLineArguments}'''"); - } - else - { - builder.AppendLine($"'{CommandLineArguments}'"); - } + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IconPath), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" iconPath: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IconPath)) + if (Optional.IsDefined(Id)) { - builder.Append(" iconPath: "); - if (IconPath.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{IconPath}'''"); - } - else - { - builder.AppendLine($"'{IconPath}'"); - } + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IconIndex), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" iconIndex: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IconIndex)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" iconIndex: "); - builder.AppendLine($"{IconIndex.Value}"); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.cs index a3ea291ae9e8..c773da4413a5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStartMenuItem.cs @@ -57,36 +57,16 @@ public DesktopVirtualizationStartMenuItem() /// The name. /// The resourceType. /// The systemData. - /// Alias of StartMenuItem. - /// Path to the file of StartMenuItem. - /// Command line arguments for StartMenuItem. - /// Path to the icon. - /// Index of the icon. + /// Detailed properties for StartMenuItem. /// Keeps track of any properties unknown to the library. - internal DesktopVirtualizationStartMenuItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string appAlias, string filePath, string commandLineArguments, string iconPath, int? iconIndex, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DesktopVirtualizationStartMenuItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StartMenuItemProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - AppAlias = appAlias; - FilePath = filePath; - CommandLineArguments = commandLineArguments; - IconPath = iconPath; - IconIndex = iconIndex; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Alias of StartMenuItem. - [WirePath("properties.appAlias")] - public string AppAlias { get; set; } - /// Path to the file of StartMenuItem. - [WirePath("properties.filePath")] - public string FilePath { get; set; } - /// Command line arguments for StartMenuItem. - [WirePath("properties.commandLineArguments")] - public string CommandLineArguments { get; set; } - /// Path to the icon. - [WirePath("properties.iconPath")] - public string IconPath { get; set; } - /// Index of the icon. - [WirePath("properties.iconIndex")] - public int? IconIndex { get; set; } + /// Detailed properties for StartMenuItem. + [WirePath("properties")] + public StartMenuItemProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStopHostsWhen.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStopHostsWhen.cs index 30403fc88e2c..06709e4fc432 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStopHostsWhen.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DesktopVirtualizationStopHostsWhen.cs @@ -25,9 +25,9 @@ public DesktopVirtualizationStopHostsWhen(string value) private const string ZeroSessionsValue = "ZeroSessions"; private const string ZeroActiveSessionsValue = "ZeroActiveSessions"; - /// ZeroSessions. + /// Zero Total Sessions. public static DesktopVirtualizationStopHostsWhen ZeroSessions { get; } = new DesktopVirtualizationStopHostsWhen(ZeroSessionsValue); - /// ZeroActiveSessions. + /// Zero Active Sessions. public static DesktopVirtualizationStopHostsWhen ZeroActiveSessions { get; } = new DesktopVirtualizationStopHostsWhen(ZeroActiveSessionsValue); /// Determines if two values are the same. public static bool operator ==(DesktopVirtualizationStopHostsWhen left, DesktopVirtualizationStopHostsWhen right) => left.Equals(right); 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..5dbbb76b3dc6 --- /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 +{ + /// Direct UDP Connection Settings. + 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"; + + /// AVD-wide settings are used to determine connection availability. + public static DirectUDP Default { get; } = new DirectUDP(DefaultValue); + /// UDP will attempt this connection type when making connections. + public static DirectUDP Enabled { get; } = new DirectUDP(EnabledValue); + /// UDP will not attempt this connection type when making connections. + 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/DiskInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..58578ba3e0ff --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoPatchProperties.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 DiskInfoPatchProperties : 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(DiskInfoPatchProperties)} 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 + } + } + } + + DiskInfoPatchProperties 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(DiskInfoPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiskInfoPatchProperties(document.RootElement, options); + } + + internal static DiskInfoPatchProperties DeserializeDiskInfoPatchProperties(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 DiskInfoPatchProperties(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiskInfoPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + DiskInfoPatchProperties 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 DeserializeDiskInfoPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiskInfoPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoPatchProperties.cs new file mode 100644 index 000000000000..d4557c206166 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoPatchProperties.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 +{ + /// Disk information. + internal partial class DiskInfoPatchProperties + { + /// + /// 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 DiskInfoPatchProperties() + { + } + + /// 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 DiskInfoPatchProperties(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/DiskInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.Serialization.cs new file mode 100644 index 000000000000..82bb0d19c93e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.Serialization.cs @@ -0,0 +1,156 @@ +// 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."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(VirtualMachineDiskType.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 + } + } + } + + 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; + } + VirtualMachineDiskType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new VirtualMachineDiskType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiskInfoProperties(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 + { + builder.Append(" type: "); + builder.AppendLine($"'{VirtualMachineDiskType.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); + 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..7d1f9ef5f8b6 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DiskInfoProperties.cs @@ -0,0 +1,73 @@ +// 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 . + /// The disk type used by virtual machine in hostpool session host. + public DiskInfoProperties(VirtualMachineDiskType virtualMachineDiskType) + { + VirtualMachineDiskType = virtualMachineDiskType; + } + + /// 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 DiskInfoProperties(VirtualMachineDiskType virtualMachineDiskType, IDictionary serializedAdditionalRawData) + { + VirtualMachineDiskType = virtualMachineDiskType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskInfoProperties() + { + } + + /// 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/DomainInfoPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/DomainInfoPatchProperties.Serialization.cs new file mode 100644 index 000000000000..accf001084c3 --- /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); + 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..2bdd05f09bc6 --- /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); + 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.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.Serialization.cs index be31d37dc164..fabdc38bd2da 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -38,122 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(PackageAlias)) - { - writer.WritePropertyName("packageAlias"u8); - writer.WriteStringValue(PackageAlias); - } - if (Optional.IsDefined(ImagePath)) - { - writer.WritePropertyName("imagePath"u8); - writer.WriteStringValue(ImagePath); - } - if (Optional.IsDefined(PackageName)) - { - writer.WritePropertyName("packageName"u8); - writer.WriteStringValue(PackageName); - } - if (Optional.IsDefined(PackageFamilyName)) - { - writer.WritePropertyName("packageFamilyName"u8); - writer.WriteStringValue(PackageFamilyName); - } - if (Optional.IsDefined(PackageFullName)) - { - writer.WritePropertyName("packageFullName"u8); - writer.WriteStringValue(PackageFullName); - } - if (Optional.IsDefined(DisplayName)) - { - if (DisplayName != null) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - else - { - writer.WriteNull("displayName"); - } - } - if (Optional.IsDefined(PackageRelativePath)) - { - writer.WritePropertyName("packageRelativePath"u8); - writer.WriteStringValue(PackageRelativePath); - } - if (Optional.IsDefined(IsRegularRegistration)) - { - writer.WritePropertyName("isRegularRegistration"u8); - writer.WriteBooleanValue(IsRegularRegistration.Value); - } - if (Optional.IsDefined(IsActive)) - { - writer.WritePropertyName("isActive"u8); - writer.WriteBooleanValue(IsActive.Value); - } - if (Optional.IsCollectionDefined(PackageDependencies)) - { - if (PackageDependencies != null) - { - writer.WritePropertyName("packageDependencies"u8); - writer.WriteStartArray(); - foreach (var item in PackageDependencies) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("packageDependencies"); - } - } - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(LastUpdatedOn)) - { - writer.WritePropertyName("lastUpdated"u8); - writer.WriteStringValue(LastUpdatedOn.Value, "O"); - } - if (Optional.IsCollectionDefined(PackageApplications)) - { - writer.WritePropertyName("packageApplications"u8); - writer.WriteStartArray(); - foreach (var item in PackageApplications) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(CertificateName)) - { - if (CertificateName != null) - { - writer.WritePropertyName("certificateName"u8); - writer.WriteStringValue(CertificateName); - } - else - { - writer.WriteNull("certificateName"); - } - } - if (Optional.IsDefined(CertificateExpiry)) + if (Optional.IsDefined(Properties)) { - if (CertificateExpiry != null) - { - writer.WritePropertyName("certificateExpiry"u8); - writer.WriteStringValue(CertificateExpiry.Value, "O"); - } - else - { - writer.WriteNull("certificateExpiry"); - } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } ExpandMsixImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -176,29 +64,24 @@ internal static ExpandMsixImage DeserializeExpandMsixImage(JsonElement element, { return null; } + ExpandMsixImageProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string packageAlias = default; - string imagePath = default; - string packageName = default; - string packageFamilyName = default; - string packageFullName = default; - string displayName = default; - string packageRelativePath = default; - bool? isRegularRegistration = default; - bool? isActive = default; - IList packageDependencies = default; - string version = default; - DateTimeOffset? lastUpdated = default; - IList packageApplications = default; - string certificateName = default; - DateTimeOffset? certificateExpiry = 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) + { + continue; + } + properties = ExpandMsixImageProperties.DeserializeExpandMsixImageProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -223,139 +106,6 @@ internal static ExpandMsixImage DeserializeExpandMsixImage(JsonElement element, 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("packageAlias"u8)) - { - packageAlias = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("imagePath"u8)) - { - imagePath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("packageName"u8)) - { - packageName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("packageFamilyName"u8)) - { - packageFamilyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("packageFullName"u8)) - { - packageFullName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - displayName = null; - continue; - } - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("packageRelativePath"u8)) - { - packageRelativePath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isRegularRegistration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isRegularRegistration = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("isActive"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isActive = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("packageDependencies"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - packageDependencies = null; - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(MsixPackageDependencies.DeserializeMsixPackageDependencies(item, options)); - } - packageDependencies = array; - continue; - } - if (property0.NameEquals("version"u8)) - { - version = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("lastUpdated"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastUpdated = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("packageApplications"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(MsixPackageApplications.DeserializeMsixPackageApplications(item, options)); - } - packageApplications = array; - continue; - } - if (property0.NameEquals("certificateName"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - certificateName = null; - continue; - } - certificateName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("certificateExpiry"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - certificateExpiry = null; - continue; - } - certificateExpiry = property0.Value.GetDateTimeOffset("O"); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -367,21 +117,7 @@ internal static ExpandMsixImage DeserializeExpandMsixImage(JsonElement element, name, type, systemData, - packageAlias, - imagePath, - packageName, - packageFamilyName, - packageFullName, - displayName, - packageRelativePath, - isRegularRegistration, - isActive, - packageDependencies ?? new ChangeTrackingList(), - version, - lastUpdated, - packageApplications ?? new ChangeTrackingList(), - certificateName, - certificateExpiry, + properties, serializedAdditionalRawData); } @@ -419,356 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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(PackageAlias), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageAlias: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PackageAlias)) - { - builder.Append(" packageAlias: "); - if (PackageAlias.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PackageAlias}'''"); - } - else - { - builder.AppendLine($"'{PackageAlias}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImagePath), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" imagePath: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ImagePath)) - { - builder.Append(" imagePath: "); - if (ImagePath.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ImagePath}'''"); - } - else - { - builder.AppendLine($"'{ImagePath}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PackageName)) - { - builder.Append(" packageName: "); - if (PackageName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PackageName}'''"); - } - else - { - builder.AppendLine($"'{PackageName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageFamilyName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageFamilyName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PackageFamilyName)) - { - builder.Append(" packageFamilyName: "); - if (PackageFamilyName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PackageFamilyName}'''"); - } - else - { - builder.AppendLine($"'{PackageFamilyName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageFullName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageFullName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PackageFullName)) - { - builder.Append(" packageFullName: "); - if (PackageFullName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PackageFullName}'''"); - } - else - { - builder.AppendLine($"'{PackageFullName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" displayName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DisplayName)) - { - builder.Append(" displayName: "); - if (DisplayName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DisplayName}'''"); - } - else - { - builder.AppendLine($"'{DisplayName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageRelativePath), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageRelativePath: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PackageRelativePath)) - { - builder.Append(" packageRelativePath: "); - if (PackageRelativePath.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PackageRelativePath}'''"); - } - else - { - builder.AppendLine($"'{PackageRelativePath}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRegularRegistration), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" isRegularRegistration: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IsRegularRegistration)) + if (Optional.IsDefined(Properties)) { - builder.Append(" isRegularRegistration: "); - var boolValue = IsRegularRegistration.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsActive), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isActive: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsActive)) - { - builder.Append(" isActive: "); - var boolValue = IsActive.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageDependencies), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageDependencies: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PackageDependencies)) - { - if (PackageDependencies.Any()) - { - builder.Append(" packageDependencies: "); - builder.AppendLine("["); - foreach (var item in PackageDependencies) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " packageDependencies: "); - } - 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: "); - if (Version.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Version}'''"); - } - else - { - builder.AppendLine($"'{Version}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastUpdatedOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" lastUpdated: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LastUpdatedOn)) - { - builder.Append(" lastUpdated: "); - var formattedDateTimeString = TypeFormatters.ToString(LastUpdatedOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageApplications), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" packageApplications: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PackageApplications)) - { - if (PackageApplications.Any()) - { - builder.Append(" packageApplications: "); - builder.AppendLine("["); - foreach (var item in PackageApplications) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " packageApplications: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertificateName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" certificateName: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(CertificateName)) + if (Optional.IsDefined(Id)) { - builder.Append(" certificateName: "); - if (CertificateName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CertificateName}'''"); - } - else - { - builder.AppendLine($"'{CertificateName}'"); - } + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertificateExpiry), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" certificateExpiry: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(CertificateExpiry)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" certificateExpiry: "); - var formattedDateTimeString = TypeFormatters.ToString(CertificateExpiry.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } 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..6fe618f4527f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImage.cs @@ -50,8 +50,6 @@ public partial class ExpandMsixImage : ResourceData /// Initializes a new instance of . public ExpandMsixImage() { - PackageDependencies = new ChangeTrackingList(); - PackageApplications = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -59,86 +57,16 @@ public ExpandMsixImage() /// The name. /// The resourceType. /// The systemData. - /// Alias of MSIX Package. - /// VHD/CIM 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. - /// 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. - /// List of package applications. - /// Certificate name found in the appxmanifest.xml. - /// Date certificate expires, found in the appxmanifest.xml. + /// Detailed properties for ExpandMsixImage. /// Keeps track of any properties unknown to the library. - internal ExpandMsixImage(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string packageAlias, string imagePath, string packageName, string packageFamilyName, string packageFullName, string displayName, string packageRelativePath, bool? isRegularRegistration, bool? isActive, IList packageDependencies, string version, DateTimeOffset? lastUpdatedOn, IList packageApplications, string certificateName, DateTimeOffset? certificateExpiry, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ExpandMsixImage(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ExpandMsixImageProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - PackageAlias = packageAlias; - ImagePath = imagePath; - PackageName = packageName; - PackageFamilyName = packageFamilyName; - PackageFullName = packageFullName; - DisplayName = displayName; - PackageRelativePath = packageRelativePath; - IsRegularRegistration = isRegularRegistration; - IsActive = isActive; - PackageDependencies = packageDependencies; - Version = version; - LastUpdatedOn = lastUpdatedOn; - PackageApplications = packageApplications; - CertificateName = certificateName; - CertificateExpiry = certificateExpiry; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Alias of MSIX Package. - [WirePath("properties.packageAlias")] - public string PackageAlias { get; set; } - /// VHD/CIM image path on Network Share. - [WirePath("properties.imagePath")] - public string ImagePath { get; set; } - /// Package Name from appxmanifest.xml. - [WirePath("properties.packageName")] - public string PackageName { get; set; } - /// Package Family Name from appxmanifest.xml. Contains Package Name and Publisher name. - [WirePath("properties.packageFamilyName")] - public string PackageFamilyName { get; set; } - /// Package Full Name from appxmanifest.xml. - [WirePath("properties.packageFullName")] - public string PackageFullName { get; set; } - /// User friendly Name to be displayed in the portal. - [WirePath("properties.displayName")] - public string DisplayName { get; set; } - /// Relative Path to the package inside the image. - [WirePath("properties.packageRelativePath")] - public string PackageRelativePath { get; set; } - /// Specifies how to register Package in feed. - [WirePath("properties.isRegularRegistration")] - public bool? IsRegularRegistration { get; set; } - /// Make this version of the package the active one across the hostpool. - [WirePath("properties.isActive")] - public bool? IsActive { get; set; } - /// List of package dependencies. - [WirePath("properties.packageDependencies")] - public IList PackageDependencies { get; set; } - /// 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. - [WirePath("properties.lastUpdated")] - public DateTimeOffset? LastUpdatedOn { get; set; } - /// List of package applications. - [WirePath("properties.packageApplications")] - public IList PackageApplications { get; } - /// Certificate name found in the appxmanifest.xml. - [WirePath("properties.certificateName")] - public string CertificateName { get; set; } - /// Date certificate expires, found in the appxmanifest.xml. - [WirePath("properties.certificateExpiry")] - public DateTimeOffset? CertificateExpiry { get; set; } + /// Detailed properties for ExpandMsixImage. + [WirePath("properties")] + public ExpandMsixImageProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.Serialization.cs index 3127656f103e..3352865dac3a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ExpandMsixImageList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ExpandMsixImageList DeserializeExpandMsixImageList(JsonElement e return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ExpandMsixImageList DeserializeExpandMsixImageList(JsonElement e } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ExpandMsixImageList DeserializeExpandMsixImageList(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new ExpandMsixImageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ExpandMsixImageList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.cs index 75530822bf18..609cb6674f11 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ExpandMsixImageList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ExpandMsixImageList() + /// The ExpandMsixImage items on this page. + /// is null. + internal ExpandMsixImageList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of MSIX package properties from give MSIX Image. - /// Link to the next page of results. + /// The ExpandMsixImage items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ExpandMsixImageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ExpandMsixImageList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of MSIX package properties from give MSIX Image. + /// Initializes a new instance of for deserialization. + internal ExpandMsixImageList() + { + } + + /// The ExpandMsixImage items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.Serialization.cs new file mode 100644 index 000000000000..e9a3fcf46ce4 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.Serialization.cs @@ -0,0 +1,679 @@ +// 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 +{ + public partial class ExpandMsixImageProperties : 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(ExpandMsixImageProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(PackageAlias)) + { + writer.WritePropertyName("packageAlias"u8); + writer.WriteStringValue(PackageAlias); + } + if (Optional.IsDefined(ImagePath)) + { + writer.WritePropertyName("imagePath"u8); + writer.WriteStringValue(ImagePath); + } + if (Optional.IsDefined(PackageName)) + { + writer.WritePropertyName("packageName"u8); + writer.WriteStringValue(PackageName); + } + if (Optional.IsDefined(PackageFamilyName)) + { + writer.WritePropertyName("packageFamilyName"u8); + writer.WriteStringValue(PackageFamilyName); + } + if (Optional.IsDefined(PackageFullName)) + { + writer.WritePropertyName("packageFullName"u8); + writer.WriteStringValue(PackageFullName); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(PackageRelativePath)) + { + writer.WritePropertyName("packageRelativePath"u8); + writer.WriteStringValue(PackageRelativePath); + } + if (Optional.IsDefined(IsRegularRegistration)) + { + writer.WritePropertyName("isRegularRegistration"u8); + writer.WriteBooleanValue(IsRegularRegistration.Value); + } + if (Optional.IsDefined(IsActive)) + { + writer.WritePropertyName("isActive"u8); + writer.WriteBooleanValue(IsActive.Value); + } + if (Optional.IsCollectionDefined(PackageDependencies)) + { + writer.WritePropertyName("packageDependencies"u8); + writer.WriteStartArray(); + foreach (var item in PackageDependencies) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(LastUpdated)) + { + writer.WritePropertyName("lastUpdated"u8); + writer.WriteStringValue(LastUpdated.Value, "O"); + } + if (Optional.IsCollectionDefined(PackageApplications)) + { + writer.WritePropertyName("packageApplications"u8); + writer.WriteStartArray(); + foreach (var item in PackageApplications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CertificateName)) + { + writer.WritePropertyName("certificateName"u8); + writer.WriteStringValue(CertificateName); + } + if (Optional.IsDefined(CertificateExpiry)) + { + writer.WritePropertyName("certificateExpiry"u8); + writer.WriteStringValue(CertificateExpiry.Value, "O"); + } + 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 + } + } + } + + ExpandMsixImageProperties 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(ExpandMsixImageProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpandMsixImageProperties(document.RootElement, options); + } + + internal static ExpandMsixImageProperties DeserializeExpandMsixImageProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string packageAlias = default; + string imagePath = default; + string packageName = default; + string packageFamilyName = default; + string packageFullName = default; + string displayName = default; + string packageRelativePath = default; + bool? isRegularRegistration = default; + bool? isActive = default; + IList packageDependencies = default; + string version = default; + DateTimeOffset? lastUpdated = default; + IList packageApplications = default; + string certificateName = default; + DateTimeOffset? certificateExpiry = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("packageAlias"u8)) + { + packageAlias = property.Value.GetString(); + continue; + } + if (property.NameEquals("imagePath"u8)) + { + imagePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("packageName"u8)) + { + packageName = property.Value.GetString(); + continue; + } + if (property.NameEquals("packageFamilyName"u8)) + { + packageFamilyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("packageFullName"u8)) + { + packageFullName = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("packageRelativePath"u8)) + { + packageRelativePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("isRegularRegistration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRegularRegistration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("isActive"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isActive = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("packageDependencies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MsixPackageDependencies.DeserializeMsixPackageDependencies(item, options)); + } + packageDependencies = array; + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastUpdated"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastUpdated = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("packageApplications"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MsixPackageApplications.DeserializeMsixPackageApplications(item, options)); + } + packageApplications = array; + continue; + } + if (property.NameEquals("certificateName"u8)) + { + certificateName = property.Value.GetString(); + continue; + } + if (property.NameEquals("certificateExpiry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateExpiry = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpandMsixImageProperties( + packageAlias, + imagePath, + packageName, + packageFamilyName, + packageFullName, + displayName, + packageRelativePath, + isRegularRegistration, + isActive, + packageDependencies ?? new ChangeTrackingList(), + version, + lastUpdated, + packageApplications ?? new ChangeTrackingList(), + certificateName, + certificateExpiry, + 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(PackageAlias), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageAlias: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageAlias)) + { + builder.Append(" packageAlias: "); + if (PackageAlias.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageAlias}'''"); + } + else + { + builder.AppendLine($"'{PackageAlias}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImagePath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" imagePath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ImagePath)) + { + builder.Append(" imagePath: "); + if (ImagePath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ImagePath}'''"); + } + else + { + builder.AppendLine($"'{ImagePath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageName)) + { + builder.Append(" packageName: "); + if (PackageName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageName}'''"); + } + else + { + builder.AppendLine($"'{PackageName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageFamilyName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageFamilyName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageFamilyName)) + { + builder.Append(" packageFamilyName: "); + if (PackageFamilyName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageFamilyName}'''"); + } + else + { + builder.AppendLine($"'{PackageFamilyName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageFullName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageFullName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageFullName)) + { + builder.Append(" packageFullName: "); + if (PackageFullName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageFullName}'''"); + } + else + { + builder.AppendLine($"'{PackageFullName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" displayName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisplayName)) + { + builder.Append(" displayName: "); + if (DisplayName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DisplayName}'''"); + } + else + { + builder.AppendLine($"'{DisplayName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageRelativePath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageRelativePath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PackageRelativePath)) + { + builder.Append(" packageRelativePath: "); + if (PackageRelativePath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PackageRelativePath}'''"); + } + else + { + builder.AppendLine($"'{PackageRelativePath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRegularRegistration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isRegularRegistration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsRegularRegistration)) + { + builder.Append(" isRegularRegistration: "); + var boolValue = IsRegularRegistration.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsActive), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isActive: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsActive)) + { + builder.Append(" isActive: "); + var boolValue = IsActive.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageDependencies), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageDependencies: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(PackageDependencies)) + { + if (PackageDependencies.Any()) + { + builder.Append(" packageDependencies: "); + builder.AppendLine("["); + foreach (var item in PackageDependencies) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " packageDependencies: "); + } + 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: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastUpdated), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastUpdated: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastUpdated)) + { + builder.Append(" lastUpdated: "); + var formattedDateTimeString = TypeFormatters.ToString(LastUpdated.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PackageApplications), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" packageApplications: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(PackageApplications)) + { + if (PackageApplications.Any()) + { + builder.Append(" packageApplications: "); + builder.AppendLine("["); + foreach (var item in PackageApplications) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " packageApplications: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertificateName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" certificateName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CertificateName)) + { + builder.Append(" certificateName: "); + if (CertificateName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CertificateName}'''"); + } + else + { + builder.AppendLine($"'{CertificateName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertificateExpiry), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" certificateExpiry: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CertificateExpiry)) + { + builder.Append(" certificateExpiry: "); + var formattedDateTimeString = TypeFormatters.ToString(CertificateExpiry.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ExpandMsixImageProperties)} does not support writing '{options.Format}' format."); + } + } + + ExpandMsixImageProperties 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 DeserializeExpandMsixImageProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpandMsixImageProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.cs new file mode 100644 index 000000000000..16e77468f2e0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ExpandMsixImageProperties.cs @@ -0,0 +1,138 @@ +// 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 +{ + /// Schema for Expand MSIX Image properties. + public partial class ExpandMsixImageProperties + { + /// + /// 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 ExpandMsixImageProperties() + { + PackageDependencies = new ChangeTrackingList(); + PackageApplications = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Alias of MSIX Package. + /// VHD/CIM 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. + /// 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. + /// List of package applications. + /// Certificate name found in the appxmanifest.xml. + /// Date certificate expires, found in the appxmanifest.xml. + /// Keeps track of any properties unknown to the library. + internal ExpandMsixImageProperties(string packageAlias, string imagePath, string packageName, string packageFamilyName, string packageFullName, string displayName, string packageRelativePath, bool? isRegularRegistration, bool? isActive, IList packageDependencies, string version, DateTimeOffset? lastUpdated, IList packageApplications, string certificateName, DateTimeOffset? certificateExpiry, IDictionary serializedAdditionalRawData) + { + PackageAlias = packageAlias; + ImagePath = imagePath; + PackageName = packageName; + PackageFamilyName = packageFamilyName; + PackageFullName = packageFullName; + DisplayName = displayName; + PackageRelativePath = packageRelativePath; + IsRegularRegistration = isRegularRegistration; + IsActive = isActive; + PackageDependencies = packageDependencies; + Version = version; + LastUpdated = lastUpdated; + PackageApplications = packageApplications; + CertificateName = certificateName; + CertificateExpiry = certificateExpiry; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Alias of MSIX Package. + [WirePath("packageAlias")] + public string PackageAlias { get; set; } + /// VHD/CIM 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. + [WirePath("packageFamilyName")] + public string PackageFamilyName { get; set; } + /// Package Full Name from appxmanifest.xml. + [WirePath("packageFullName")] + public string PackageFullName { get; set; } + /// User friendly Name to be displayed in the portal. + [WirePath("displayName")] + public string DisplayName { get; set; } + /// Relative Path to the package inside the image. + [WirePath("packageRelativePath")] + public string PackageRelativePath { get; set; } + /// Specifies how to register Package in feed. + [WirePath("isRegularRegistration")] + public bool? IsRegularRegistration { get; set; } + /// Make this version of the package the active one across the hostpool. + [WirePath("isActive")] + public bool? IsActive { get; set; } + /// List of package dependencies. + [WirePath("packageDependencies")] + public IList PackageDependencies { get; } + /// Package version found in the appxmanifest.xml. + [WirePath("version")] + public string Version { get; set; } + /// Date Package was last updated, found in the appxmanifest.xml. + [WirePath("lastUpdated")] + public DateTimeOffset? LastUpdated { get; set; } + /// List of package applications. + [WirePath("packageApplications")] + public IList PackageApplications { get; } + /// Certificate name found in the appxmanifest.xml. + [WirePath("certificateName")] + public string CertificateName { get; set; } + /// Date certificate expires, found in the appxmanifest.xml. + [WirePath("certificateExpiry")] + public DateTimeOffset? CertificateExpiry { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailHealthCheckOnStagingFailure.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailHealthCheckOnStagingFailure.cs index bf0ec15544e3..2c783518cc5c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailHealthCheckOnStagingFailure.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/FailHealthCheckOnStagingFailure.cs @@ -26,11 +26,11 @@ public FailHealthCheckOnStagingFailure(string value) private const string NeedsAssistanceValue = "NeedsAssistance"; private const string DoNotFailValue = "DoNotFail"; - /// Unhealthy. + /// Health Check will report unhealthy. public static FailHealthCheckOnStagingFailure Unhealthy { get; } = new FailHealthCheckOnStagingFailure(UnhealthyValue); - /// NeedsAssistance. + /// Health Check will report NeedsAssistance. public static FailHealthCheckOnStagingFailure NeedsAssistance { get; } = new FailHealthCheckOnStagingFailure(NeedsAssistanceValue); - /// DoNotFail. + /// Health Check will not report failure. public static FailHealthCheckOnStagingFailure DoNotFail { get; } = new FailHealthCheckOnStagingFailure(DoNotFailValue); /// Determines if two values are the same. public static bool operator ==(FailHealthCheckOnStagingFailure left, FailHealthCheckOnStagingFailure right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.Serialization.cs index 50c9f6fd2d07..1b92aa8fe81f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(HostPoolList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static HostPoolList DeserializeHostPoolList(JsonElement element, ModelR return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static HostPoolList DeserializeHostPoolList(JsonElement element, ModelR } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static HostPoolList DeserializeHostPoolList(JsonElement element, ModelR } } serializedAdditionalRawData = rawDataDictionary; - return new HostPoolList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new HostPoolList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.cs index 934c45c87c80..a63ff74330b8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class HostPoolList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal HostPoolList() + /// The HostPool items on this page. + /// is null. + internal HostPoolList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of HostPool definitions. - /// Link to the next page of results. + /// The HostPool items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal HostPoolList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal HostPoolList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of HostPool definitions. + /// Initializes a new instance of for deserialization. + internal HostPoolList() + { + } + + /// The HostPool items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } 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..d5fc27fb76d7 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolLoadBalancerType.cs @@ -25,13 +25,16 @@ 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. + /// Uses BreadthFirst algorithm for load balancing. public static HostPoolLoadBalancerType BreadthFirst { get; } = new HostPoolLoadBalancerType(BreadthFirstValue); - /// DepthFirst. + /// Uses DepthFirst algorithm for load balancing. public static HostPoolLoadBalancerType DepthFirst { get; } = new HostPoolLoadBalancerType(DepthFirstValue); - /// Persistent. + /// Maintains persistent connections. public static HostPoolLoadBalancerType Persistent { get; } = new HostPoolLoadBalancerType(PersistentValue); + /// Maintains multiple persistents connections. + 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 a310b8da26cb..48adaf06fbda 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 @@ -40,178 +40,20 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); if (Optional.IsCollectionDefined(Tags)) { - if (Tags != null) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); - } - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(CustomRdpProperty)) - { - writer.WritePropertyName("customRdpProperty"u8); - writer.WriteStringValue(CustomRdpProperty); - } - if (Optional.IsDefined(MaxSessionLimit)) - { - if (MaxSessionLimit != null) - { - writer.WritePropertyName("maxSessionLimit"u8); - writer.WriteNumberValue(MaxSessionLimit.Value); - } - else - { - writer.WriteNull("maxSessionLimit"); - } - } - if (Optional.IsDefined(PersonalDesktopAssignmentType)) - { - if (PersonalDesktopAssignmentType != null) - { - writer.WritePropertyName("personalDesktopAssignmentType"u8); - writer.WriteStringValue(PersonalDesktopAssignmentType.Value.ToString()); - } - else - { - writer.WriteNull("personalDesktopAssignmentType"); - } - } - if (Optional.IsDefined(LoadBalancerType)) - { - writer.WritePropertyName("loadBalancerType"u8); - writer.WriteStringValue(LoadBalancerType.Value.ToString()); - } - if (Optional.IsDefined(Ring)) - { - if (Ring != null) - { - writer.WritePropertyName("ring"u8); - writer.WriteNumberValue(Ring.Value); - } - else - { - writer.WriteNull("ring"); + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); } + writer.WriteEndObject(); } - if (Optional.IsDefined(IsValidationEnvironment)) + if (Optional.IsDefined(Properties)) { - if (IsValidationEnvironment != null) - { - writer.WritePropertyName("validationEnvironment"u8); - writer.WriteBooleanValue(IsValidationEnvironment.Value); - } - else - { - writer.WriteNull("validationEnvironment"); - } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(RegistrationInfo)) - { - if (RegistrationInfo != null) - { - writer.WritePropertyName("registrationInfo"u8); - writer.WriteObjectValue(RegistrationInfo, options); - } - else - { - writer.WriteNull("registrationInfo"); - } - } - if (Optional.IsDefined(VmTemplate)) - { - writer.WritePropertyName("vmTemplate"u8); - writer.WriteStringValue(VmTemplate); - } - if (Optional.IsDefined(SsoAdfsAuthority)) - { - writer.WritePropertyName("ssoadfsAuthority"u8); - writer.WriteStringValue(SsoAdfsAuthority); - } - if (Optional.IsDefined(SsoClientId)) - { - writer.WritePropertyName("ssoClientId"u8); - writer.WriteStringValue(SsoClientId); - } - if (Optional.IsDefined(SsoClientSecretKeyVaultPath)) - { - writer.WritePropertyName("ssoClientSecretKeyVaultPath"u8); - writer.WriteStringValue(SsoClientSecretKeyVaultPath); - } - if (Optional.IsDefined(SsoSecretType)) - { - if (SsoSecretType != null) - { - writer.WritePropertyName("ssoSecretType"u8); - writer.WriteStringValue(SsoSecretType.Value.ToString()); - } - else - { - writer.WriteNull("ssoSecretType"); - } - } - if (Optional.IsDefined(PreferredAppGroupType)) - { - writer.WritePropertyName("preferredAppGroupType"u8); - writer.WriteStringValue(PreferredAppGroupType.Value.ToString()); - } - if (Optional.IsDefined(StartVmOnConnect)) - { - if (StartVmOnConnect != null) - { - writer.WritePropertyName("startVMOnConnect"u8); - writer.WriteBooleanValue(StartVmOnConnect.Value); - } - else - { - writer.WriteNull("startVMOnConnect"); - } - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - if (PublicNetworkAccess != null) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - else - { - writer.WriteNull("publicNetworkAccess"); - } - } - if (Optional.IsDefined(AgentUpdate)) - { - if (AgentUpdate != null) - { - writer.WritePropertyName("agentUpdate"u8); - writer.WriteObjectValue(AgentUpdate, options); - } - else - { - writer.WriteNull("agentUpdate"); - } - } - writer.WriteEndObject(); } HostPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -235,28 +77,11 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode return null; } IDictionary tags = default; + HostPoolPatchProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string friendlyName = default; - string description = default; - string customRdpProperty = default; - int? maxSessionLimit = default; - PersonalDesktopAssignmentType? personalDesktopAssignmentType = default; - HostPoolLoadBalancerType? loadBalancerType = default; - int? ring = default; - bool? validationEnvironment = default; - HostPoolRegistrationInfoPatch registrationInfo = default; - string vmTemplate = default; - string ssoadfsAuthority = default; - string ssoClientId = default; - string ssoClientSecretKeyVaultPath = default; - HostPoolSsoSecretType? ssoSecretType = default; - PreferredAppGroupType? preferredAppGroupType = default; - bool? startVmOnConnect = default; - HostPoolPublicNetworkAccess? publicNetworkAccess = default; - SessionHostAgentUpdatePatchProperties agentUpdate = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -265,7 +90,6 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode { if (property.Value.ValueKind == JsonValueKind.Null) { - tags = null; continue; } Dictionary dictionary = new Dictionary(); @@ -276,6 +100,15 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode tags = dictionary; continue; } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = HostPoolPatchProperties.DeserializeHostPoolPatchProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -300,161 +133,6 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode 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("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("customRdpProperty"u8)) - { - customRdpProperty = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("maxSessionLimit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - maxSessionLimit = null; - continue; - } - maxSessionLimit = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("personalDesktopAssignmentType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - personalDesktopAssignmentType = null; - continue; - } - personalDesktopAssignmentType = new PersonalDesktopAssignmentType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("loadBalancerType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loadBalancerType = new HostPoolLoadBalancerType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("ring"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - ring = null; - continue; - } - ring = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("validationEnvironment"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - validationEnvironment = null; - continue; - } - validationEnvironment = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("registrationInfo"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - registrationInfo = null; - continue; - } - registrationInfo = HostPoolRegistrationInfoPatch.DeserializeHostPoolRegistrationInfoPatch(property0.Value, options); - continue; - } - if (property0.NameEquals("vmTemplate"u8)) - { - vmTemplate = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ssoadfsAuthority"u8)) - { - ssoadfsAuthority = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ssoClientId"u8)) - { - ssoClientId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ssoClientSecretKeyVaultPath"u8)) - { - ssoClientSecretKeyVaultPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ssoSecretType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - ssoSecretType = null; - continue; - } - ssoSecretType = new HostPoolSsoSecretType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("preferredAppGroupType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - preferredAppGroupType = new PreferredAppGroupType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("startVMOnConnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - startVmOnConnect = null; - continue; - } - startVmOnConnect = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - publicNetworkAccess = null; - continue; - } - publicNetworkAccess = new HostPoolPublicNetworkAccess(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("agentUpdate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - agentUpdate = null; - continue; - } - agentUpdate = SessionHostAgentUpdatePatchProperties.DeserializeSessionHostAgentUpdatePatchProperties(property0.Value, options); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -467,24 +145,7 @@ internal static HostPoolPatch DeserializeHostPoolPatch(JsonElement element, Mode type, systemData, tags ?? new ChangeTrackingDictionary(), - friendlyName, - description, - customRdpProperty, - maxSessionLimit, - personalDesktopAssignmentType, - loadBalancerType, - ring, - validationEnvironment, - registrationInfo, - vmTemplate, - ssoadfsAuthority, - ssoClientId, - ssoClientSecretKeyVaultPath, - ssoSecretType, - preferredAppGroupType, - startVmOnConnect, - publicNetworkAccess, - agentUpdate, + properties, serializedAdditionalRawData); } @@ -559,367 +220,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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(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(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomRdpProperty), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" customRdpProperty: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CustomRdpProperty)) - { - builder.Append(" customRdpProperty: "); - if (CustomRdpProperty.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CustomRdpProperty}'''"); - } - else - { - builder.AppendLine($"'{CustomRdpProperty}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxSessionLimit), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxSessionLimit: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxSessionLimit)) - { - builder.Append(" maxSessionLimit: "); - builder.AppendLine($"{MaxSessionLimit.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PersonalDesktopAssignmentType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" personalDesktopAssignmentType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PersonalDesktopAssignmentType)) - { - builder.Append(" personalDesktopAssignmentType: "); - builder.AppendLine($"'{PersonalDesktopAssignmentType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LoadBalancerType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" loadBalancerType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LoadBalancerType)) - { - builder.Append(" loadBalancerType: "); - builder.AppendLine($"'{LoadBalancerType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Ring), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ring: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Ring)) - { - builder.Append(" ring: "); - builder.AppendLine($"{Ring.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsValidationEnvironment), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" validationEnvironment: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsValidationEnvironment)) - { - builder.Append(" validationEnvironment: "); - var boolValue = IsValidationEnvironment.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RegistrationInfo), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" registrationInfo: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RegistrationInfo)) - { - builder.Append(" registrationInfo: "); - BicepSerializationHelpers.AppendChildObject(builder, RegistrationInfo, options, 4, false, " registrationInfo: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmTemplate), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmTemplate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmTemplate)) - { - builder.Append(" vmTemplate: "); - if (VmTemplate.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{VmTemplate}'''"); - } - else - { - builder.AppendLine($"'{VmTemplate}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoAdfsAuthority), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ssoadfsAuthority: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SsoAdfsAuthority)) - { - builder.Append(" ssoadfsAuthority: "); - if (SsoAdfsAuthority.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SsoAdfsAuthority}'''"); - } - else - { - builder.AppendLine($"'{SsoAdfsAuthority}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoClientId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" ssoClientId: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SsoClientId)) + if (Optional.IsDefined(Properties)) { - builder.Append(" ssoClientId: "); - if (SsoClientId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SsoClientId}'''"); - } - else - { - builder.AppendLine($"'{SsoClientId}'"); - } + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoClientSecretKeyVaultPath), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ssoClientSecretKeyVaultPath: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SsoClientSecretKeyVaultPath)) - { - builder.Append(" ssoClientSecretKeyVaultPath: "); - if (SsoClientSecretKeyVaultPath.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SsoClientSecretKeyVaultPath}'''"); - } - else - { - builder.AppendLine($"'{SsoClientSecretKeyVaultPath}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoSecretType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ssoSecretType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SsoSecretType)) - { - builder.Append(" ssoSecretType: "); - builder.AppendLine($"'{SsoSecretType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredAppGroupType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" preferredAppGroupType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PreferredAppGroupType)) - { - builder.Append(" preferredAppGroupType: "); - builder.AppendLine($"'{PreferredAppGroupType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartVmOnConnect), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startVMOnConnect: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartVmOnConnect)) - { - builder.Append(" startVMOnConnect: "); - var boolValue = StartVmOnConnect.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" publicNetworkAccess: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(PublicNetworkAccess)) + if (Optional.IsDefined(Id)) { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'"); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentUpdate), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" agentUpdate: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(AgentUpdate)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" agentUpdate: "); - BicepSerializationHelpers.AppendChildObject(builder, AgentUpdate, options, 4, false, " agentUpdate: "); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.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..f73435a67ed3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatch.cs @@ -59,105 +59,20 @@ public HostPoolPatch() /// 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. + /// HostPool properties that can be patched. /// 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, HostPoolPatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, 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; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// tags to be updated. [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Friendly name of HostPool. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } - /// Description of HostPool. - [WirePath("properties.description")] - public string Description { get; set; } - /// Custom rdp property of HostPool. - [WirePath("properties.customRdpProperty")] - public string CustomRdpProperty { get; set; } - /// The max session limit of HostPool. - [WirePath("properties.maxSessionLimit")] - public int? MaxSessionLimit { get; set; } - /// PersonalDesktopAssignment type for HostPool. - [WirePath("properties.personalDesktopAssignmentType")] - public PersonalDesktopAssignmentType? PersonalDesktopAssignmentType { get; set; } - /// The type of the load balancer. - [WirePath("properties.loadBalancerType")] - public HostPoolLoadBalancerType? LoadBalancerType { get; set; } - /// The ring number of HostPool. - [WirePath("properties.ring")] - public int? Ring { get; set; } - /// Is validation environment. - [WirePath("properties.validationEnvironment")] - public bool? IsValidationEnvironment { get; set; } - /// The registration info of HostPool. - [WirePath("properties.registrationInfo")] - public HostPoolRegistrationInfoPatch RegistrationInfo { get; set; } - /// VM template for sessionhosts configuration within hostpool. - [WirePath("properties.vmTemplate")] - public string VmTemplate { get; set; } - /// URL to customer ADFS server for signing WVD SSO certificates. - [WirePath("properties.ssoadfsAuthority")] - public string SsoAdfsAuthority { get; set; } - /// ClientId for the registered Relying Party used to issue WVD SSO certificates. - [WirePath("properties.ssoClientId")] - public string SsoClientId { get; set; } - /// Path to Azure KeyVault storing the secret used for communication to ADFS. - [WirePath("properties.ssoClientSecretKeyVaultPath")] - public string SsoClientSecretKeyVaultPath { get; set; } - /// The type of single sign on Secret Type. - [WirePath("properties.ssoSecretType")] - public HostPoolSsoSecretType? SsoSecretType { get; set; } - /// The type of preferred application group type, default to Desktop Application Group. - [WirePath("properties.preferredAppGroupType")] - public PreferredAppGroupType? PreferredAppGroupType { get; set; } - /// The flag to turn on/off StartVMOnConnect feature. - [WirePath("properties.startVMOnConnect")] - public bool? StartVmOnConnect { get; set; } - /// Enabled to allow this resource to be access from the public network. - [WirePath("properties.publicNetworkAccess")] - public HostPoolPublicNetworkAccess? PublicNetworkAccess { get; set; } - /// The session host configuration for updating agent, monitoring agent, and stack component. - [WirePath("properties.agentUpdate")] - public SessionHostAgentUpdatePatchProperties AgentUpdate { get; set; } + public IDictionary Tags { get; } + /// HostPool properties that can be patched. + [WirePath("properties")] + public HostPoolPatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.Serialization.cs new file mode 100644 index 000000000000..4393a9e5d0ee --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.Serialization.cs @@ -0,0 +1,849 @@ +// 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 HostPoolPatchProperties : 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(HostPoolPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(CustomRdpProperty)) + { + writer.WritePropertyName("customRdpProperty"u8); + writer.WriteStringValue(CustomRdpProperty); + } + if (Optional.IsDefined(MaxSessionLimit)) + { + writer.WritePropertyName("maxSessionLimit"u8); + writer.WriteNumberValue(MaxSessionLimit.Value); + } + if (Optional.IsDefined(PersonalDesktopAssignmentType)) + { + writer.WritePropertyName("personalDesktopAssignmentType"u8); + writer.WriteStringValue(PersonalDesktopAssignmentType.Value.ToString()); + } + if (Optional.IsDefined(LoadBalancerType)) + { + writer.WritePropertyName("loadBalancerType"u8); + writer.WriteStringValue(LoadBalancerType.Value.ToString()); + } + if (Optional.IsDefined(Ring)) + { + writer.WritePropertyName("ring"u8); + writer.WriteNumberValue(Ring.Value); + } + if (Optional.IsDefined(ValidationEnvironment)) + { + writer.WritePropertyName("validationEnvironment"u8); + writer.WriteBooleanValue(ValidationEnvironment.Value); + } + if (Optional.IsDefined(RegistrationInfo)) + { + writer.WritePropertyName("registrationInfo"u8); + writer.WriteObjectValue(RegistrationInfo, options); + } + if (Optional.IsDefined(VmTemplate)) + { + writer.WritePropertyName("vmTemplate"u8); + writer.WriteStringValue(VmTemplate); + } + if (Optional.IsDefined(SsoadfsAuthority)) + { + writer.WritePropertyName("ssoadfsAuthority"u8); + writer.WriteStringValue(SsoadfsAuthority); + } + if (Optional.IsDefined(SsoClientId)) + { + writer.WritePropertyName("ssoClientId"u8); + writer.WriteStringValue(SsoClientId); + } + if (Optional.IsDefined(SsoClientSecretKeyVaultPath)) + { + writer.WritePropertyName("ssoClientSecretKeyVaultPath"u8); + writer.WriteStringValue(SsoClientSecretKeyVaultPath); + } + if (Optional.IsDefined(SsoSecretType)) + { + writer.WritePropertyName("ssoSecretType"u8); + writer.WriteStringValue(SsoSecretType.Value.ToString()); + } + if (Optional.IsDefined(PreferredAppGroupType)) + { + writer.WritePropertyName("preferredAppGroupType"u8); + writer.WriteStringValue(PreferredAppGroupType.Value.ToString()); + } + if (Optional.IsDefined(StartVmOnConnect)) + { + writer.WritePropertyName("startVMOnConnect"u8); + writer.WriteBooleanValue(StartVmOnConnect.Value); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsDefined(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()); + } + 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 + } + } + } + + HostPoolPatchProperties 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(HostPoolPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHostPoolPatchProperties(document.RootElement, options); + } + + internal static HostPoolPatchProperties DeserializeHostPoolPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string friendlyName = default; + string description = default; + string customRdpProperty = default; + int? maxSessionLimit = default; + PersonalDesktopAssignmentType? personalDesktopAssignmentType = default; + HostPoolLoadBalancerType? loadBalancerType = default; + int? ring = default; + bool? validationEnvironment = default; + HostPoolRegistrationInfoPatch registrationInfo = default; + string vmTemplate = default; + string ssoadfsAuthority = default; + string ssoClientId = default; + string ssoClientSecretKeyVaultPath = default; + HostPoolSsoSecretType? ssoSecretType = default; + PreferredAppGroupType? preferredAppGroupType = default; + 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()) + { + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("customRdpProperty"u8)) + { + customRdpProperty = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxSessionLimit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxSessionLimit = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("personalDesktopAssignmentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + personalDesktopAssignmentType = new PersonalDesktopAssignmentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("loadBalancerType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadBalancerType = new HostPoolLoadBalancerType(property.Value.GetString()); + continue; + } + if (property.NameEquals("ring"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ring = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("validationEnvironment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationEnvironment = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("registrationInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + registrationInfo = HostPoolRegistrationInfoPatch.DeserializeHostPoolRegistrationInfoPatch(property.Value, options); + continue; + } + if (property.NameEquals("vmTemplate"u8)) + { + vmTemplate = property.Value.GetString(); + continue; + } + if (property.NameEquals("ssoadfsAuthority"u8)) + { + ssoadfsAuthority = property.Value.GetString(); + continue; + } + if (property.NameEquals("ssoClientId"u8)) + { + ssoClientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("ssoClientSecretKeyVaultPath"u8)) + { + ssoClientSecretKeyVaultPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("ssoSecretType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ssoSecretType = new HostPoolSsoSecretType(property.Value.GetString()); + continue; + } + if (property.NameEquals("preferredAppGroupType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preferredAppGroupType = new PreferredAppGroupType(property.Value.GetString()); + continue; + } + if (property.NameEquals("startVMOnConnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startVmOnConnect = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new HostPoolPublicNetworkAccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("agentUpdate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + agentUpdate = SessionHostAgentUpdatePatchProperties.DeserializeSessionHostAgentUpdatePatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("managedPrivateUDP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedPrivateUDP = new ManagedPrivateUDP(property.Value.GetString()); + continue; + } + if (property.NameEquals("directUDP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + directUDP = new DirectUDP(property.Value.GetString()); + continue; + } + if (property.NameEquals("publicUDP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicUDP = new PublicUDP(property.Value.GetString()); + continue; + } + if (property.NameEquals("relayUDP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relayUDP = new RelayUDP(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HostPoolPatchProperties( + friendlyName, + description, + customRdpProperty, + maxSessionLimit, + personalDesktopAssignmentType, + loadBalancerType, + ring, + validationEnvironment, + registrationInfo, + vmTemplate, + ssoadfsAuthority, + ssoClientId, + ssoClientSecretKeyVaultPath, + ssoSecretType, + preferredAppGroupType, + startVmOnConnect, + publicNetworkAccess, + agentUpdate, + managedPrivateUDP, + directUDP, + publicUDP, + relayUDP, + 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(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(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomRdpProperty), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customRdpProperty: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomRdpProperty)) + { + builder.Append(" customRdpProperty: "); + if (CustomRdpProperty.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CustomRdpProperty}'''"); + } + else + { + builder.AppendLine($"'{CustomRdpProperty}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxSessionLimit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxSessionLimit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxSessionLimit)) + { + builder.Append(" maxSessionLimit: "); + builder.AppendLine($"{MaxSessionLimit.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PersonalDesktopAssignmentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" personalDesktopAssignmentType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PersonalDesktopAssignmentType)) + { + builder.Append(" personalDesktopAssignmentType: "); + builder.AppendLine($"'{PersonalDesktopAssignmentType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LoadBalancerType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" loadBalancerType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LoadBalancerType)) + { + builder.Append(" loadBalancerType: "); + builder.AppendLine($"'{LoadBalancerType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Ring), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ring: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Ring)) + { + builder.Append(" ring: "); + builder.AppendLine($"{Ring.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ValidationEnvironment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" validationEnvironment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ValidationEnvironment)) + { + builder.Append(" validationEnvironment: "); + var boolValue = ValidationEnvironment.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RegistrationInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" registrationInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RegistrationInfo)) + { + builder.Append(" registrationInfo: "); + BicepSerializationHelpers.AppendChildObject(builder, RegistrationInfo, options, 2, false, " registrationInfo: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmTemplate), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmTemplate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmTemplate)) + { + builder.Append(" vmTemplate: "); + if (VmTemplate.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmTemplate}'''"); + } + else + { + builder.AppendLine($"'{VmTemplate}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoadfsAuthority), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ssoadfsAuthority: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SsoadfsAuthority)) + { + builder.Append(" ssoadfsAuthority: "); + if (SsoadfsAuthority.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SsoadfsAuthority}'''"); + } + else + { + builder.AppendLine($"'{SsoadfsAuthority}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoClientId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ssoClientId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SsoClientId)) + { + builder.Append(" ssoClientId: "); + if (SsoClientId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SsoClientId}'''"); + } + else + { + builder.AppendLine($"'{SsoClientId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoClientSecretKeyVaultPath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ssoClientSecretKeyVaultPath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SsoClientSecretKeyVaultPath)) + { + builder.Append(" ssoClientSecretKeyVaultPath: "); + if (SsoClientSecretKeyVaultPath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SsoClientSecretKeyVaultPath}'''"); + } + else + { + builder.AppendLine($"'{SsoClientSecretKeyVaultPath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SsoSecretType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ssoSecretType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SsoSecretType)) + { + builder.Append(" ssoSecretType: "); + builder.AppendLine($"'{SsoSecretType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredAppGroupType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" preferredAppGroupType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PreferredAppGroupType)) + { + builder.Append(" preferredAppGroupType: "); + builder.AppendLine($"'{PreferredAppGroupType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartVmOnConnect), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startVMOnConnect: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartVmOnConnect)) + { + builder.Append(" startVMOnConnect: "); + var boolValue = StartVmOnConnect.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publicNetworkAccess: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PublicNetworkAccess)) + { + builder.Append(" publicNetworkAccess: "); + builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentUpdate), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" agentUpdate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AgentUpdate)) + { + builder.Append(" agentUpdate: "); + BicepSerializationHelpers.AppendChildObject(builder, AgentUpdate, options, 2, false, " agentUpdate: "); + } + } + + 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("}"); + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(HostPoolPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + HostPoolPatchProperties 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 DeserializeHostPoolPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HostPoolPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.cs new file mode 100644 index 000000000000..d46014a602f5 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPatchProperties.cs @@ -0,0 +1,171 @@ +// 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 +{ + /// Properties of HostPool. + public partial class HostPoolPatchProperties + { + /// + /// 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 HostPoolPatchProperties() + { + } + + /// Initializes a new instance of . + /// 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. + /// 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 HostPoolPatchProperties(string friendlyName, string description, string customRdpProperty, int? maxSessionLimit, PersonalDesktopAssignmentType? personalDesktopAssignmentType, HostPoolLoadBalancerType? loadBalancerType, int? ring, bool? validationEnvironment, 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) + { + FriendlyName = friendlyName; + Description = description; + CustomRdpProperty = customRdpProperty; + MaxSessionLimit = maxSessionLimit; + PersonalDesktopAssignmentType = personalDesktopAssignmentType; + LoadBalancerType = loadBalancerType; + Ring = ring; + ValidationEnvironment = validationEnvironment; + RegistrationInfo = registrationInfo; + VmTemplate = vmTemplate; + SsoadfsAuthority = ssoadfsAuthority; + SsoClientId = ssoClientId; + SsoClientSecretKeyVaultPath = ssoClientSecretKeyVaultPath; + SsoSecretType = ssoSecretType; + PreferredAppGroupType = preferredAppGroupType; + StartVmOnConnect = startVmOnConnect; + PublicNetworkAccess = publicNetworkAccess; + AgentUpdate = agentUpdate; + ManagedPrivateUDP = managedPrivateUDP; + DirectUDP = directUDP; + PublicUDP = publicUDP; + RelayUDP = relayUDP; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Friendly name of HostPool. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + /// Description of HostPool. + [WirePath("description")] + public string Description { get; set; } + /// Custom rdp property of HostPool. + [WirePath("customRdpProperty")] + public string CustomRdpProperty { get; set; } + /// The max session limit of HostPool. + [WirePath("maxSessionLimit")] + public int? MaxSessionLimit { get; set; } + /// PersonalDesktopAssignment type for HostPool. + [WirePath("personalDesktopAssignmentType")] + public PersonalDesktopAssignmentType? PersonalDesktopAssignmentType { get; set; } + /// The type of the load balancer. + [WirePath("loadBalancerType")] + public HostPoolLoadBalancerType? LoadBalancerType { get; set; } + /// The ring number of HostPool. + [WirePath("ring")] + public int? Ring { get; set; } + /// Is validation environment. + [WirePath("validationEnvironment")] + public bool? ValidationEnvironment { get; set; } + /// The registration info of HostPool. + [WirePath("registrationInfo")] + public HostPoolRegistrationInfoPatch RegistrationInfo { get; set; } + /// VM template for sessionhosts configuration within hostpool. + [WirePath("vmTemplate")] + public string VmTemplate { get; set; } + /// URL to customer ADFS server for signing WVD SSO certificates. + [WirePath("ssoadfsAuthority")] + public string SsoadfsAuthority { get; set; } + /// ClientId for the registered Relying Party used to issue WVD SSO certificates. + [WirePath("ssoClientId")] + public string SsoClientId { get; set; } + /// Path to Azure KeyVault storing the secret used for communication to ADFS. + [WirePath("ssoClientSecretKeyVaultPath")] + public string SsoClientSecretKeyVaultPath { get; set; } + /// The type of single sign on Secret Type. + [WirePath("ssoSecretType")] + public HostPoolSsoSecretType? SsoSecretType { get; set; } + /// The type of preferred application group type, default to Desktop Application Group. + [WirePath("preferredAppGroupType")] + public PreferredAppGroupType? PreferredAppGroupType { get; set; } + /// The flag to turn on/off StartVMOnConnect feature. + [WirePath("startVMOnConnect")] + public bool? StartVmOnConnect { get; set; } + /// Enabled to allow this resource to be access from the public network. + [WirePath("publicNetworkAccess")] + public HostPoolPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// The session host configuration for updating agent, monitoring agent, and stack component. + [WirePath("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("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("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("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("relayUDP")] + public RelayUDP? RelayUDP { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPublicNetworkAccess.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPublicNetworkAccess.cs index 46c50026cea1..c85ed3813563 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPublicNetworkAccess.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolPublicNetworkAccess.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. + /// Enabled to allow this resource to be access from the public network. public readonly partial struct HostPoolPublicNetworkAccess : IEquatable { private readonly string _value; @@ -27,13 +27,13 @@ public HostPoolPublicNetworkAccess(string value) private const string EnabledForSessionHostsOnlyValue = "EnabledForSessionHostsOnly"; private const string EnabledForClientsOnlyValue = "EnabledForClientsOnly"; - /// Enabled. + /// Allows this resource to be accessed from the public network. public static HostPoolPublicNetworkAccess Enabled { get; } = new HostPoolPublicNetworkAccess(EnabledValue); - /// Disabled. + /// Prevents this resource from being accessed from the public network. public static HostPoolPublicNetworkAccess Disabled { get; } = new HostPoolPublicNetworkAccess(DisabledValue); - /// EnabledForSessionHostsOnly. + /// Allows SessionHosts to be accessed from the public network. public static HostPoolPublicNetworkAccess EnabledForSessionHostsOnly { get; } = new HostPoolPublicNetworkAccess(EnabledForSessionHostsOnlyValue); - /// EnabledForClientsOnly. + /// Allows Clients to be accessed from the public network. public static HostPoolPublicNetworkAccess EnabledForClientsOnly { get; } = new HostPoolPublicNetworkAccess(EnabledForClientsOnlyValue); /// Determines if two values are the same. public static bool operator ==(HostPoolPublicNetworkAccess left, HostPoolPublicNetworkAccess right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.Serialization.cs index b3762b7eb5be..2db093bec1e3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfo.Serialization.cs @@ -37,15 +37,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(ExpireOn)) { - if (ExpireOn != null) - { - writer.WritePropertyName("expirationTime"u8); - writer.WriteStringValue(ExpireOn.Value, "O"); - } - else - { - writer.WriteNull("expirationTime"); - } + writer.WritePropertyName("expirationTime"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); } if (Optional.IsDefined(Token)) { @@ -105,7 +98,6 @@ internal static HostPoolRegistrationInfo DeserializeHostPoolRegistrationInfo(Jso { if (property.Value.ValueKind == JsonValueKind.Null) { - expirationTime = null; continue; } expirationTime = property.Value.GetDateTimeOffset("O"); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.Serialization.cs index a276960e2293..060f89b15db7 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationInfoPatch.Serialization.cs @@ -37,15 +37,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(ExpireOn)) { - if (ExpireOn != null) - { - writer.WritePropertyName("expirationTime"u8); - writer.WriteStringValue(ExpireOn.Value, "O"); - } - else - { - writer.WriteNull("expirationTime"); - } + writer.WritePropertyName("expirationTime"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); } if (Optional.IsDefined(RegistrationTokenOperation)) { @@ -99,7 +92,6 @@ internal static HostPoolRegistrationInfoPatch DeserializeHostPoolRegistrationInf { if (property.Value.ValueKind == JsonValueKind.Null) { - expirationTime = null; continue; } expirationTime = property.Value.GetDateTimeOffset("O"); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationTokenOperation.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationTokenOperation.cs index 24696e49c745..422a6d0d3dd0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationTokenOperation.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolRegistrationTokenOperation.cs @@ -26,11 +26,11 @@ public HostPoolRegistrationTokenOperation(string value) private const string NoneValue = "None"; private const string UpdateValue = "Update"; - /// Delete. + /// Delete operation. public static HostPoolRegistrationTokenOperation Delete { get; } = new HostPoolRegistrationTokenOperation(DeleteValue); - /// None. + /// No Operation. public static HostPoolRegistrationTokenOperation None { get; } = new HostPoolRegistrationTokenOperation(NoneValue); - /// Update. + /// Update Operation. public static HostPoolRegistrationTokenOperation Update { get; } = new HostPoolRegistrationTokenOperation(UpdateValue); /// Determines if two values are the same. public static bool operator ==(HostPoolRegistrationTokenOperation left, HostPoolRegistrationTokenOperation right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolSsoSecretType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolSsoSecretType.cs index 89ee7ad2e889..2c65a706ecc3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolSsoSecretType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/HostPoolSsoSecretType.cs @@ -27,13 +27,13 @@ public HostPoolSsoSecretType(string value) private const string SharedKeyInKeyVaultValue = "SharedKeyInKeyVault"; private const string CertificateInKeyVaultValue = "CertificateInKeyVault"; - /// SharedKey. + /// The SSO Secret is a Shared Key. public static HostPoolSsoSecretType SharedKey { get; } = new HostPoolSsoSecretType(SharedKeyValue); - /// Certificate. + /// The SSO Secret is a Certificate. public static HostPoolSsoSecretType Certificate { get; } = new HostPoolSsoSecretType(CertificateValue); - /// SharedKeyInKeyVault. + /// The SSO Secret is a SharedKey that is stored in KeyVault. public static HostPoolSsoSecretType SharedKeyInKeyVault { get; } = new HostPoolSsoSecretType(SharedKeyInKeyVaultValue); - /// CertificateInKeyVault. + /// The SSO Secret is a Certificate that is stored in KeyVault. public static HostPoolSsoSecretType CertificateInKeyVault { get; } = new HostPoolSsoSecretType(CertificateInKeyVaultValue); /// Determines if two values are the same. public static bool operator ==(HostPoolSsoSecretType left, HostPoolSsoSecretType right) => left.Equals(right); 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..82ea5c52b460 --- /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); + 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..0b725619e814 --- /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. Default value is an empty string. + /// 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. Default value is an empty string. + [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..5b398fb01a4d --- /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); + 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..315db87e5e2e --- /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); + 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..038cfc45e9a6 --- /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 +{ + /// Object containing control action for hostpool update. + 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..2d22632ad2e0 --- /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); + 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..37d0f1d7cf21 --- /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 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..e675282a27be --- /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); + 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..86cc9d4d5158 --- /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 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/ImportPackageInfoContent.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImportPackageInfoContent.Serialization.cs index b8ea5f1f112e..73d92a6a68d3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImportPackageInfoContent.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ImportPackageInfoContent.Serialization.cs @@ -41,15 +41,8 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsDefined(PackageArchitecture)) { - if (PackageArchitecture != null) - { - writer.WritePropertyName("packageArchitecture"u8); - writer.WriteStringValue(PackageArchitecture.Value.ToString()); - } - else - { - writer.WriteNull("packageArchitecture"); - } + writer.WritePropertyName("packageArchitecture"u8); + writer.WriteStringValue(PackageArchitecture.Value.ToString()); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -103,7 +96,6 @@ internal static ImportPackageInfoContent DeserializeImportPackageInfoContent(Jso { if (property.Value.ValueKind == JsonValueKind.Null) { - packageArchitecture = null; continue; } packageArchitecture = new AppAttachPackageArchitecture(property.Value.GetString()); 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..51e4787841a9 --- /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); + 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..33d06d9e8118 --- /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); + 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/ManagedPrivateUDP.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ManagedPrivateUDP.cs new file mode 100644 index 000000000000..4704c9e800dc --- /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 +{ + /// Managed Private UDP Connection Settings. + 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"; + + /// AVD-wide settings are used to determine connection availability. + public static ManagedPrivateUDP Default { get; } = new ManagedPrivateUDP(DefaultValue); + /// UDP will attempt this connection type when making connections. + public static ManagedPrivateUDP Enabled { get; } = new ManagedPrivateUDP(EnabledValue); + /// UDP will not attempt this connection type when making connections. + 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..0a4571b82b6a --- /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 the hostpool. + 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 management of the hostpool. + public static ManagementType Automated { get; } = new ManagementType(AutomatedValue); + /// Standard management of the hostpool. + 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..c0d0e92bb5a8 --- /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); + 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..1f711ff2d780 --- /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 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 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..8d4cbe63f621 --- /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); + 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..5c400ad924b3 --- /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 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 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 version of the image. + [WirePath("exactVersion")] + public string ExactVersion { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.Serialization.cs index c51874fa4017..df461cde4744 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(MsixPackageList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static MsixPackageList DeserializeMsixPackageList(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static MsixPackageList DeserializeMsixPackageList(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static MsixPackageList DeserializeMsixPackageList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new MsixPackageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new MsixPackageList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.cs index d98f7ce070cb..f614b8df998b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackageList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class MsixPackageList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal MsixPackageList() + /// The MSIXPackage items on this page. + /// is null. + internal MsixPackageList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of MSIX Package definitions. - /// Link to the next page of results. + /// The MSIXPackage items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal MsixPackageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal MsixPackageList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of MSIX Package definitions. + /// Initializes a new instance of for deserialization. + internal MsixPackageList() + { + } + + /// The MSIXPackage items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.Serialization.cs index ff1390943826..c29989e8a24e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.Serialization.cs @@ -37,24 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(IsActive)) - { - writer.WritePropertyName("isActive"u8); - writer.WriteBooleanValue(IsActive.Value); - } - if (Optional.IsDefined(IsRegularRegistration)) - { - writer.WritePropertyName("isRegularRegistration"u8); - writer.WriteBooleanValue(IsRegularRegistration.Value); - } - if (Optional.IsDefined(DisplayName)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } MsixPackagePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -77,17 +64,24 @@ internal static MsixPackagePatch DeserializeMsixPackagePatch(JsonElement element { return null; } + MsixPackagePatchProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - bool? isActive = default; - bool? isRegularRegistration = default; - string displayName = 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) + { + continue; + } + properties = MsixPackagePatchProperties.DeserializeMsixPackagePatchProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,41 +106,6 @@ internal static MsixPackagePatch DeserializeMsixPackagePatch(JsonElement element 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("isActive"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isActive = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("isRegularRegistration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isRegularRegistration = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -158,9 +117,7 @@ internal static MsixPackagePatch DeserializeMsixPackagePatch(JsonElement element name, type, systemData, - isActive, - isRegularRegistration, - displayName, + properties, serializedAdditionalRawData); } @@ -198,94 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Properties)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsActive), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isActive: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsActive)) - { - builder.Append(" isActive: "); - var boolValue = IsActive.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRegularRegistration), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" isRegularRegistration: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IsRegularRegistration)) + if (Optional.IsDefined(Id)) { - builder.Append(" isRegularRegistration: "); - var boolValue = IsRegularRegistration.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" displayName: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(DisplayName)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" displayName: "); - if (DisplayName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DisplayName}'''"); - } - else - { - builder.AppendLine($"'{DisplayName}'"); - } + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.cs index 90acc8666b3d..4dc06d5b177c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatch.cs @@ -57,26 +57,16 @@ public MsixPackagePatch() /// The name. /// The resourceType. /// The systemData. - /// Set a version of the package to be active across hostpool. - /// Set Registration mode. Regular or Delayed. - /// Display name for MSIX Package. + /// Detailed properties for MSIX Package. /// Keeps track of any properties unknown to the library. - internal MsixPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isActive, bool? isRegularRegistration, string displayName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal MsixPackagePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MsixPackagePatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - IsActive = isActive; - IsRegularRegistration = isRegularRegistration; - DisplayName = displayName; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Set a version of the package to be active across hostpool. - [WirePath("properties.isActive")] - public bool? IsActive { get; set; } - /// Set Registration mode. Regular or Delayed. - [WirePath("properties.isRegularRegistration")] - public bool? IsRegularRegistration { get; set; } - /// Display name for MSIX Package. - [WirePath("properties.displayName")] - public string DisplayName { get; set; } + /// Detailed properties for MSIX Package. + [WirePath("properties")] + public MsixPackagePatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.Serialization.cs new file mode 100644 index 000000000000..24315c1efe06 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.Serialization.cs @@ -0,0 +1,232 @@ +// 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 MsixPackagePatchProperties : 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(MsixPackagePatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IsActive)) + { + writer.WritePropertyName("isActive"u8); + writer.WriteBooleanValue(IsActive.Value); + } + if (Optional.IsDefined(IsRegularRegistration)) + { + writer.WritePropertyName("isRegularRegistration"u8); + writer.WriteBooleanValue(IsRegularRegistration.Value); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + 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 + } + } + } + + MsixPackagePatchProperties 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(MsixPackagePatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMsixPackagePatchProperties(document.RootElement, options); + } + + internal static MsixPackagePatchProperties DeserializeMsixPackagePatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? isActive = default; + bool? isRegularRegistration = default; + string displayName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isActive"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isActive = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("isRegularRegistration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRegularRegistration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MsixPackagePatchProperties(isActive, isRegularRegistration, displayName, 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(IsActive), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isActive: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsActive)) + { + builder.Append(" isActive: "); + var boolValue = IsActive.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRegularRegistration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isRegularRegistration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsRegularRegistration)) + { + builder.Append(" isRegularRegistration: "); + var boolValue = IsRegularRegistration.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" displayName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisplayName)) + { + builder.Append(" displayName: "); + if (DisplayName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DisplayName}'''"); + } + else + { + builder.AppendLine($"'{DisplayName}'"); + } + } + } + + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(MsixPackagePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + MsixPackagePatchProperties 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 DeserializeMsixPackagePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MsixPackagePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.cs new file mode 100644 index 000000000000..eba58d556f7a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/MsixPackagePatchProperties.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 +{ + /// MSIX Package properties that can be patched. + public partial class MsixPackagePatchProperties + { + /// + /// 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 MsixPackagePatchProperties() + { + } + + /// Initializes a new instance of . + /// Set a version of the package to be active across hostpool. + /// Set Registration mode. Regular or Delayed. + /// Display name for MSIX Package. + /// Keeps track of any properties unknown to the library. + internal MsixPackagePatchProperties(bool? isActive, bool? isRegularRegistration, string displayName, IDictionary serializedAdditionalRawData) + { + IsActive = isActive; + IsRegularRegistration = isRegularRegistration; + DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Set a version of the package to be active across hostpool. + [WirePath("isActive")] + public bool? IsActive { get; set; } + /// Set Registration mode. Regular or Delayed. + [WirePath("isRegularRegistration")] + public bool? IsRegularRegistration { get; set; } + /// Display name for MSIX Package. + [WirePath("displayName")] + public string DisplayName { get; set; } + } +} 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..595fb29560e6 --- /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); + 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..5cb64f67451b --- /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); + 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/PackageTimestamped.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PackageTimestamped.cs index 9b8e9327cbff..f008772dcc16 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PackageTimestamped.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PackageTimestamped.cs @@ -25,9 +25,9 @@ public PackageTimestamped(string value) private const string TimestampedValue = "Timestamped"; private const string NotTimestampedValue = "NotTimestamped"; - /// Timestamped. + /// Package is timestamped. public static PackageTimestamped Timestamped { get; } = new PackageTimestamped(TimestampedValue); - /// NotTimestamped. + /// Package is not timestamped, use certificate expiry date. public static PackageTimestamped NotTimestamped { get; } = new PackageTimestamped(NotTimestampedValue); /// Determines if two values are the same. public static bool operator ==(PackageTimestamped left, PackageTimestamped right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PersonalDesktopAssignmentType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PersonalDesktopAssignmentType.cs index a601a4b424df..b3c73de299ae 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PersonalDesktopAssignmentType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PersonalDesktopAssignmentType.cs @@ -25,9 +25,9 @@ public PersonalDesktopAssignmentType(string value) private const string AutomaticValue = "Automatic"; private const string DirectValue = "Direct"; - /// Automatic. + /// Automatically assigns an available personal desktop to the user. public static PersonalDesktopAssignmentType Automatic { get; } = new PersonalDesktopAssignmentType(AutomaticValue); - /// Direct. + /// Manually assigns a specific personal desktop to the user. public static PersonalDesktopAssignmentType Direct { get; } = new PersonalDesktopAssignmentType(DirectValue); /// Determines if two values are the same. public static bool operator ==(PersonalDesktopAssignmentType left, PersonalDesktopAssignmentType right) => left.Equals(right); 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..dd2c2c560527 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. + /// Internal Use Only. public static PreferredAppGroupType None { get; } = new PreferredAppGroupType(NoneValue); - /// Desktop. + /// Use Desktop Application Group. public static PreferredAppGroupType Desktop { get; } = new PreferredAppGroupType(DesktopValue); - /// RailApplications. + /// Use RailApplications (RemoteApp). 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/PrivateEndpointConnectionListResultWithSystemData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.Serialization.cs index d7767b35a4e3..33f3d0505636 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(PrivateEndpointConnectionListResultWithSystemData)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static PrivateEndpointConnectionListResultWithSystemData DeserializePri return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static PrivateEndpointConnectionListResultWithSystemData DeserializePri } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static PrivateEndpointConnectionListResultWithSystemData DeserializePri } } serializedAdditionalRawData = rawDataDictionary; - return new PrivateEndpointConnectionListResultWithSystemData(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new PrivateEndpointConnectionListResultWithSystemData(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.cs index fe7429d6affd..0982f4de6697 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionListResultWithSystemData.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// List of private endpoint connection associated with the specified storage account. + /// List of private endpoint connection associated with the specified HostPool. internal partial class PrivateEndpointConnectionListResultWithSystemData { /// @@ -46,25 +47,34 @@ internal partial class PrivateEndpointConnectionListResultWithSystemData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal PrivateEndpointConnectionListResultWithSystemData() + /// The PrivateEndpointConnectionWithSystemData items on this page. + /// is null. + internal PrivateEndpointConnectionListResultWithSystemData(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private endpoint connections. - /// Link to the next page of results. + /// The PrivateEndpointConnectionWithSystemData items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal PrivateEndpointConnectionListResultWithSystemData(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal PrivateEndpointConnectionListResultWithSystemData(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private endpoint connections. + /// Initializes a new instance of for deserialization. + internal PrivateEndpointConnectionListResultWithSystemData() + { + } + + /// The PrivateEndpointConnectionWithSystemData items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs similarity index 56% rename from sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs rename to sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs index ccae1b3efbf5..61b6dd9630c0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/AppAttachPackageProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.Serialization.cs @@ -12,14 +12,15 @@ using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DesktopVirtualization.Models { - public partial class AppAttachPackageProperties : IUtf8JsonSerializable, IJsonModel + public partial class PrivateEndpointConnectionProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,41 +31,33 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AppAttachPackageProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Image)) + if (options.Format != "W" && Optional.IsCollectionDefined(GroupIds)) { - writer.WritePropertyName("image"u8); - writer.WriteObjectValue(Image, options); - } - if (Optional.IsCollectionDefined(HostPoolReferences)) - { - writer.WritePropertyName("hostPoolReferences"u8); + writer.WritePropertyName("groupIds"u8); writer.WriteStartArray(); - foreach (var item in HostPoolReferences) + foreach (var item in GroupIds) { writer.WriteStringValue(item); } writer.WriteEndArray(); } - if (Optional.IsDefined(KeyVaultUri)) + if (Optional.IsDefined(PrivateEndpoint)) { - writer.WritePropertyName("keyVaultURL"u8); - writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); } - if (Optional.IsDefined(FailHealthCheckOnStagingFailure)) + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { - writer.WritePropertyName("failHealthCheckOnStagingFailure"u8); - writer.WriteStringValue(FailHealthCheckOnStagingFailure.Value.ToString()); + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -83,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AppAttachPackageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PrivateEndpointConnectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(AppAttachPackageProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAppAttachPackageProperties(document.RootElement, options); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); } - internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static PrivateEndpointConnectionProperties DeserializePrivateEndpointConnectionProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -103,34 +96,15 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties { return null; } - AppAttachPackageProvisioningState? provisioningState = default; - AppAttachPackageInfoProperties image = default; - IList hostPoolReferences = default; - Uri keyVaultURL = default; - FailHealthCheckOnStagingFailure? failHealthCheckOnStagingFailure = default; + IReadOnlyList groupIds = default; + SubResource privateEndpoint = default; + DesktopVirtualizationPrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("provisioningState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new AppAttachPackageProvisioningState(property.Value.GetString()); - continue; - } - if (property.NameEquals("image"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - image = AppAttachPackageInfoProperties.DeserializeAppAttachPackageInfoProperties(property.Value, options); - continue; - } - if (property.NameEquals("hostPoolReferences"u8)) + if (property.NameEquals("groupIds"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { @@ -141,25 +115,30 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties { array.Add(item.GetString()); } - hostPoolReferences = array; + groupIds = array; continue; } - if (property.NameEquals("keyVaultURL"u8)) + if (property.NameEquals("privateEndpoint"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - keyVaultURL = new Uri(property.Value.GetString()); + privateEndpoint = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("failHealthCheckOnStagingFailure"u8)) + if (property.NameEquals("privateLinkServiceConnectionState"u8)) + { + privateLinkServiceConnectionState = DesktopVirtualizationPrivateLinkServiceConnectionState.DeserializeDesktopVirtualizationPrivateLinkServiceConnectionState(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - failHealthCheckOnStagingFailure = new FailHealthCheckOnStagingFailure(property.Value.GetString()); + provisioningState = new DesktopVirtualizationPrivateEndpointConnectionProvisioningState(property.Value.GetString()); continue; } if (options.Format != "W") @@ -168,13 +147,7 @@ internal static AppAttachPackageProperties DeserializeAppAttachPackageProperties } } serializedAdditionalRawData = rawDataDictionary; - return new AppAttachPackageProperties( - provisioningState, - image, - hostPoolReferences ?? new ChangeTrackingList(), - keyVaultURL, - failHealthCheckOnStagingFailure, - serializedAdditionalRawData); + return new PrivateEndpointConnectionProperties(groupIds ?? new ChangeTrackingList(), privateEndpoint, privateLinkServiceConnectionState, provisioningState, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -188,51 +161,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupIds), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" provisioningState: "); + builder.Append(" groupIds: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ProvisioningState)) + if (Optional.IsCollectionDefined(GroupIds)) { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Image), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" image: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Image)) - { - builder.Append(" image: "); - BicepSerializationHelpers.AppendChildObject(builder, Image, options, 2, false, " image: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostPoolReferences), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hostPoolReferences: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(HostPoolReferences)) - { - if (HostPoolReferences.Any()) + if (GroupIds.Any()) { - builder.Append(" hostPoolReferences: "); + builder.Append(" groupIds: "); builder.AppendLine("["); - foreach (var item in HostPoolReferences) + foreach (var item in GroupIds) { if (item == null) { @@ -254,33 +197,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultUri), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); if (hasPropertyOverride) { - builder.Append(" keyVaultURL: "); + builder.Append(" privateEndpoint: "); + builder.AppendLine("{"); + builder.Append(" id: "); builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); } else { - if (Optional.IsDefined(KeyVaultUri)) + if (Optional.IsDefined(PrivateEndpoint)) { - builder.Append(" keyVaultURL: "); - builder.AppendLine($"'{KeyVaultUri.AbsoluteUri}'"); + builder.Append(" privateEndpoint: "); + BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 2, false, " privateEndpoint: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FailHealthCheckOnStagingFailure), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" failHealthCheckOnStagingFailure: "); + builder.Append(" privateLinkServiceConnectionState: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(FailHealthCheckOnStagingFailure)) + if (Optional.IsDefined(ConnectionState)) { - builder.Append(" failHealthCheckOnStagingFailure: "); - builder.AppendLine($"'{FailHealthCheckOnStagingFailure.Value.ToString()}'"); + builder.Append(" privateLinkServiceConnectionState: "); + BicepSerializationHelpers.AppendChildObject(builder, ConnectionState, options, 2, false, " privateLinkServiceConnectionState: "); + } + } + + 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()}'"); } } @@ -288,9 +249,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -299,26 +260,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriter case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(AppAttachPackageProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support writing '{options.Format}' format."); } } - AppAttachPackageProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PrivateEndpointConnectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAppAttachPackageProperties(document.RootElement, options); + return DeserializePrivateEndpointConnectionProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AppAttachPackageProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PrivateEndpointConnectionProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..365303dc569d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/PrivateEndpointConnectionProperties.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; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Properties of the private endpoint connection. + public partial class PrivateEndpointConnectionProperties + { + /// + /// 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 . + /// A collection of information about the state of the connection between service consumer and provider. + /// is null. + public PrivateEndpointConnectionProperties(DesktopVirtualizationPrivateLinkServiceConnectionState connectionState) + { + Argument.AssertNotNull(connectionState, nameof(connectionState)); + + GroupIds = new ChangeTrackingList(); + ConnectionState = connectionState; + } + + /// Initializes a new instance of . + /// The group ids for the private endpoint resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. + /// Keeps track of any properties unknown to the library. + internal PrivateEndpointConnectionProperties(IReadOnlyList groupIds, SubResource privateEndpoint, DesktopVirtualizationPrivateLinkServiceConnectionState connectionState, DesktopVirtualizationPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + GroupIds = groupIds; + PrivateEndpoint = privateEndpoint; + ConnectionState = connectionState; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PrivateEndpointConnectionProperties() + { + } + + /// The group ids for the private endpoint resource. + [WirePath("groupIds")] + public IReadOnlyList GroupIds { get; } + /// The private endpoint resource. + internal SubResource PrivateEndpoint { get; set; } + /// Gets Id. + [WirePath("privateEndpoint.id")] + public ResourceIdentifier PrivateEndpointId + { + get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + + /// A collection of information about the state of the connection between service consumer and provider. + [WirePath("privateLinkServiceConnectionState")] + public DesktopVirtualizationPrivateLinkServiceConnectionState ConnectionState { get; set; } + /// The provisioning state of the private endpoint connection resource. + [WirePath("provisioningState")] + public DesktopVirtualizationPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + } +} 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..08e57185a286 --- /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"; + + /// Provisioning Successful. + public static ProvisioningStateSHC Succeeded { get; } = new ProvisioningStateSHC(SucceededValue); + /// Provisioning Failed. + public static ProvisioningStateSHC Failed { get; } = new ProvisioningStateSHC(FailedValue); + /// Provisioning was Canceled. + public static ProvisioningStateSHC Canceled { get; } = new ProvisioningStateSHC(CanceledValue); + /// Provisioning in Progress. + 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..6ef8de148859 --- /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 +{ + /// Public UDP Connection Settings. + 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"; + + /// AVD-wide settings are used to determine connection availability. + public static PublicUDP Default { get; } = new PublicUDP(DefaultValue); + /// UDP will attempt this connection type when making connections. + public static PublicUDP Enabled { get; } = new PublicUDP(EnabledValue); + /// UDP will not attempt this connection type when making connections. + 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..3a23bd728b68 --- /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); + 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..ecf2867c43c3 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RegistrationTokenMinimal.Serialization.cs @@ -0,0 +1,201 @@ +// 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)) + { + writer.WritePropertyName("expirationTime"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); + } + 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) + { + 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); + 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..7e3a5cb72645 --- /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 +{ + /// Relay UDP Connection Settings. + 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"; + + /// AVD-wide settings are used to determine connection availability. + public static RelayUDP Default { get; } = new RelayUDP(DefaultValue); + /// UDP will attempt this connection type when making connections. + public static RelayUDP Enabled { get; } = new RelayUDP(EnabledValue); + /// UDP will not attempt this connection type when making connections. + 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/RemoteApplicationType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RemoteApplicationType.cs index 47cc50344fb8..6a41d757b140 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RemoteApplicationType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/RemoteApplicationType.cs @@ -25,9 +25,9 @@ public RemoteApplicationType(string value) private const string InBuiltValue = "InBuilt"; private const string MsixApplicationValue = "MsixApplication"; - /// InBuilt. + /// Built-in applications. public static RemoteApplicationType InBuilt { get; } = new RemoteApplicationType(InBuiltValue); - /// MsixApplication. + /// Imported MSIX application packages. public static RemoteApplicationType MsixApplication { get; } = new RemoteApplicationType(MsixApplicationValue); /// Determines if two values are the same. public static bool operator ==(RemoteApplicationType left, RemoteApplicationType right) => left.Equals(right); 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/ScalingMethodType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingMethodType.cs new file mode 100644 index 000000000000..0cfcb29018cb --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingMethodType.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 ScalingMethodType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScalingMethodType(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 ScalingMethodType PowerManage { get; } = new ScalingMethodType(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 ScalingMethodType CreateDeletePowerManage { get; } = new ScalingMethodType(CreateDeletePowerManageValue); + /// Determines if two values are the same. + public static bool operator ==(ScalingMethodType left, ScalingMethodType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScalingMethodType left, ScalingMethodType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScalingMethodType(string value) => new ScalingMethodType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScalingMethodType other && Equals(other); + /// + public bool Equals(ScalingMethodType 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/ScalingPlanList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.Serialization.cs index 4a08455887ba..7817febf5722 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ScalingPlanList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ScalingPlanList DeserializeScalingPlanList(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ScalingPlanList DeserializeScalingPlanList(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ScalingPlanList DeserializeScalingPlanList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new ScalingPlanList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ScalingPlanList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.cs index e0a706bf3856..e4258ca7643a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ScalingPlanList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ScalingPlanList() + /// The ScalingPlan items on this page. + /// is null. + internal ScalingPlanList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of scaling plan definitions. - /// Link to the next page of results. + /// The ScalingPlan items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ScalingPlanList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ScalingPlanList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of scaling plan definitions. + /// Initializes a new instance of for deserialization. + internal ScalingPlanList() + { + } + + /// The ScalingPlan items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.Serialization.cs index 786f98419607..29986ba83791 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.Serialization.cs @@ -36,65 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsCollectionDefined(Tags)) { - if (Tags != null) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); - } - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - if (Optional.IsDefined(TimeZone)) - { - writer.WritePropertyName("timeZone"u8); - writer.WriteStringValue(TimeZone); - } - if (Optional.IsDefined(ExclusionTag)) - { - writer.WritePropertyName("exclusionTag"u8); - writer.WriteStringValue(ExclusionTag); - } - if (Optional.IsCollectionDefined(Schedules)) - { - writer.WritePropertyName("schedules"u8); - writer.WriteStartArray(); - foreach (var item in Schedules) - { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); + writer.WriteEndObject(); } - if (Optional.IsCollectionDefined(HostPoolReferences)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("hostPoolReferences"u8); - writer.WriteStartArray(); - foreach (var item in HostPoolReferences) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -133,12 +88,7 @@ internal static ScalingPlanPatch DeserializeScalingPlanPatch(JsonElement element return null; } IDictionary tags = default; - string description = default; - string friendlyName = default; - string timeZone = default; - string exclusionTag = default; - IList schedules = default; - IList hostPoolReferences = default; + ScalingPlanPatchProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -147,7 +97,6 @@ internal static ScalingPlanPatch DeserializeScalingPlanPatch(JsonElement element { if (property.Value.ValueKind == JsonValueKind.Null) { - tags = null; continue; } Dictionary dictionary = new Dictionary(); @@ -162,60 +111,9 @@ internal static ScalingPlanPatch DeserializeScalingPlanPatch(JsonElement element { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("timeZone"u8)) - { - timeZone = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("exclusionTag"u8)) - { - exclusionTag = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("schedules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ScalingSchedule.DeserializeScalingSchedule(item, options)); - } - schedules = array; - continue; - } - if (property0.NameEquals("hostPoolReferences"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ScalingHostPoolReference.DeserializeScalingHostPoolReference(item, options)); - } - hostPoolReferences = array; - continue; - } - } + properties = ScalingPlanPatchProperties.DeserializeScalingPlanPatchProperties(property.Value, options); continue; } if (options.Format != "W") @@ -224,15 +122,7 @@ internal static ScalingPlanPatch DeserializeScalingPlanPatch(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new ScalingPlanPatch( - tags ?? new ChangeTrackingDictionary(), - description, - friendlyName, - timeZone, - exclusionTag, - schedules ?? new ChangeTrackingList(), - hostPoolReferences ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new ScalingPlanPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) 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..4ae1eb486e48 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatch.cs @@ -49,51 +49,24 @@ public partial class ScalingPlanPatch public ScalingPlanPatch() { Tags = new ChangeTrackingDictionary(); - Schedules = new ChangeTrackingList(); - HostPoolReferences = new ChangeTrackingList(); } /// Initializes a new instance of . /// tags to be updated. - /// Description of scaling plan. - /// User friendly name of scaling plan. - /// Timezone of the scaling plan. - /// Exclusion tag for scaling plan. - /// List of ScalingSchedule definitions. - /// List of ScalingHostPoolReference definitions. + /// Detailed properties for scaling plan. /// 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) + internal ScalingPlanPatch(IDictionary tags, ScalingPlanPatchProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; - Description = description; - FriendlyName = friendlyName; - TimeZone = timeZone; - ExclusionTag = exclusionTag; - Schedules = schedules; - HostPoolReferences = hostPoolReferences; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// tags to be updated. [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Description of scaling plan. - [WirePath("properties.description")] - public string Description { get; set; } - /// User friendly name of scaling plan. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } - /// Timezone of the scaling plan. - [WirePath("properties.timeZone")] - public string TimeZone { get; set; } - /// Exclusion tag for scaling plan. - [WirePath("properties.exclusionTag")] - public string ExclusionTag { get; set; } - /// List of ScalingSchedule definitions. - [WirePath("properties.schedules")] - public IList Schedules { get; } - /// List of ScalingHostPoolReference definitions. - [WirePath("properties.hostPoolReferences")] - public IList HostPoolReferences { get; } + public IDictionary Tags { get; } + /// Detailed properties for scaling plan. + [WirePath("properties")] + public ScalingPlanPatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.Serialization.cs new file mode 100644 index 000000000000..af8c7d72ca7a --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.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.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + public partial class ScalingPlanPatchProperties : 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(ScalingPlanPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsDefined(TimeZone)) + { + writer.WritePropertyName("timeZone"u8); + writer.WriteStringValue(TimeZone); + } + if (Optional.IsDefined(ExclusionTag)) + { + writer.WritePropertyName("exclusionTag"u8); + writer.WriteStringValue(ExclusionTag); + } + if (Optional.IsCollectionDefined(Schedules)) + { + writer.WritePropertyName("schedules"u8); + writer.WriteStartArray(); + foreach (var item in Schedules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HostPoolReferences)) + { + writer.WritePropertyName("hostPoolReferences"u8); + writer.WriteStartArray(); + foreach (var item in HostPoolReferences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + 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 + } + } + } + + ScalingPlanPatchProperties 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(ScalingPlanPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScalingPlanPatchProperties(document.RootElement, options); + } + + internal static ScalingPlanPatchProperties DeserializeScalingPlanPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string friendlyName = default; + string timeZone = default; + string exclusionTag = default; + IList schedules = default; + IList hostPoolReferences = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeZone"u8)) + { + timeZone = property.Value.GetString(); + continue; + } + if (property.NameEquals("exclusionTag"u8)) + { + exclusionTag = property.Value.GetString(); + continue; + } + if (property.NameEquals("schedules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScalingSchedule.DeserializeScalingSchedule(item, options)); + } + schedules = array; + continue; + } + if (property.NameEquals("hostPoolReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScalingHostPoolReference.DeserializeScalingHostPoolReference(item, options)); + } + hostPoolReferences = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScalingPlanPatchProperties( + description, + friendlyName, + timeZone, + exclusionTag, + schedules ?? new ChangeTrackingList(), + hostPoolReferences ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ScalingPlanPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ScalingPlanPatchProperties 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 DeserializeScalingPlanPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScalingPlanPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.cs new file mode 100644 index 000000000000..3ed1a871b80e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPatchProperties.cs @@ -0,0 +1,93 @@ +// 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 +{ + /// Scaling plan properties. + public partial class ScalingPlanPatchProperties + { + /// + /// 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 ScalingPlanPatchProperties() + { + Schedules = new ChangeTrackingList(); + HostPoolReferences = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Description of scaling plan. + /// User friendly name of scaling plan. + /// Timezone of the scaling plan. + /// Exclusion tag for scaling plan. + /// List of ScalingSchedule definitions. + /// List of ScalingHostPoolReference definitions. + /// Keeps track of any properties unknown to the library. + internal ScalingPlanPatchProperties(string description, string friendlyName, string timeZone, string exclusionTag, IList schedules, IList hostPoolReferences, IDictionary serializedAdditionalRawData) + { + Description = description; + FriendlyName = friendlyName; + TimeZone = timeZone; + ExclusionTag = exclusionTag; + Schedules = schedules; + HostPoolReferences = hostPoolReferences; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of scaling plan. + [WirePath("description")] + public string Description { get; set; } + /// User friendly name of scaling plan. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + /// Timezone of the scaling plan. + [WirePath("timeZone")] + public string TimeZone { get; set; } + /// Exclusion tag for scaling plan. + [WirePath("exclusionTag")] + public string ExclusionTag { get; set; } + /// List of ScalingSchedule definitions. + [WirePath("schedules")] + public IList Schedules { get; } + /// List of ScalingHostPoolReference definitions. + [WirePath("hostPoolReferences")] + public IList HostPoolReferences { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.Serialization.cs index ebef387d43ad..a1ae339c0e09 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ScalingPlanPersonalScheduleList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ScalingPlanPersonalScheduleList DeserializeScalingPlanPersonalSc return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ScalingPlanPersonalScheduleList DeserializeScalingPlanPersonalSc } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ScalingPlanPersonalScheduleList DeserializeScalingPlanPersonalSc } } serializedAdditionalRawData = rawDataDictionary; - return new ScalingPlanPersonalScheduleList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ScalingPlanPersonalScheduleList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.cs index 1c6a1bb153ec..cff7bea3df2c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalScheduleList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ScalingPlanPersonalScheduleList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ScalingPlanPersonalScheduleList() + /// The ScalingPlanPersonalSchedule items on this page. + /// is null. + internal ScalingPlanPersonalScheduleList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of ScalingPlanPersonalSchedule definitions. - /// Link to the next page of results. + /// The ScalingPlanPersonalSchedule items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ScalingPlanPersonalScheduleList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ScalingPlanPersonalScheduleList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of ScalingPlanPersonalSchedule definitions. + /// Initializes a new instance of for deserialization. + internal ScalingPlanPersonalScheduleList() + { + } + + /// The ScalingPlanPersonalSchedule items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.Serialization.cs index 39d8648b9965..4e26ef384cd0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.Serialization.cs @@ -34,144 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ScalingPlanPersonalSchedulePatch)} does not support writing '{format}' format."); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(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); - } - if (Optional.IsDefined(RampUpAutoStartHosts)) - { - writer.WritePropertyName("rampUpAutoStartHosts"u8); - writer.WriteStringValue(RampUpAutoStartHosts.Value.ToString()); - } - if (Optional.IsDefined(RampUpStartVmOnConnect)) - { - writer.WritePropertyName("rampUpStartVMOnConnect"u8); - writer.WriteStringValue(RampUpStartVmOnConnect.Value.ToString()); - } - if (Optional.IsDefined(RampUpActionOnDisconnect)) - { - writer.WritePropertyName("rampUpActionOnDisconnect"u8); - writer.WriteStringValue(RampUpActionOnDisconnect.Value.ToString()); - } - if (Optional.IsDefined(RampUpMinutesToWaitOnDisconnect)) - { - writer.WritePropertyName("rampUpMinutesToWaitOnDisconnect"u8); - writer.WriteNumberValue(RampUpMinutesToWaitOnDisconnect.Value); - } - if (Optional.IsDefined(RampUpActionOnLogoff)) - { - writer.WritePropertyName("rampUpActionOnLogoff"u8); - writer.WriteStringValue(RampUpActionOnLogoff.Value.ToString()); - } - if (Optional.IsDefined(RampUpMinutesToWaitOnLogoff)) - { - writer.WritePropertyName("rampUpMinutesToWaitOnLogoff"u8); - writer.WriteNumberValue(RampUpMinutesToWaitOnLogoff.Value); - } - if (Optional.IsDefined(PeakStartTime)) - { - writer.WritePropertyName("peakStartTime"u8); - writer.WriteObjectValue(PeakStartTime, options); - } - if (Optional.IsDefined(PeakStartVmOnConnect)) - { - writer.WritePropertyName("peakStartVMOnConnect"u8); - writer.WriteStringValue(PeakStartVmOnConnect.Value.ToString()); - } - if (Optional.IsDefined(PeakActionOnDisconnect)) - { - writer.WritePropertyName("peakActionOnDisconnect"u8); - writer.WriteStringValue(PeakActionOnDisconnect.Value.ToString()); - } - if (Optional.IsDefined(PeakMinutesToWaitOnDisconnect)) - { - writer.WritePropertyName("peakMinutesToWaitOnDisconnect"u8); - writer.WriteNumberValue(PeakMinutesToWaitOnDisconnect.Value); - } - if (Optional.IsDefined(PeakActionOnLogoff)) - { - writer.WritePropertyName("peakActionOnLogoff"u8); - writer.WriteStringValue(PeakActionOnLogoff.Value.ToString()); - } - if (Optional.IsDefined(PeakMinutesToWaitOnLogoff)) - { - writer.WritePropertyName("peakMinutesToWaitOnLogoff"u8); - writer.WriteNumberValue(PeakMinutesToWaitOnLogoff.Value); - } - if (Optional.IsDefined(RampDownStartTime)) - { - writer.WritePropertyName("rampDownStartTime"u8); - writer.WriteObjectValue(RampDownStartTime, options); - } - if (Optional.IsDefined(RampDownStartVmOnConnect)) - { - writer.WritePropertyName("rampDownStartVMOnConnect"u8); - writer.WriteStringValue(RampDownStartVmOnConnect.Value.ToString()); - } - if (Optional.IsDefined(RampDownActionOnDisconnect)) - { - writer.WritePropertyName("rampDownActionOnDisconnect"u8); - writer.WriteStringValue(RampDownActionOnDisconnect.Value.ToString()); - } - if (Optional.IsDefined(RampDownMinutesToWaitOnDisconnect)) - { - writer.WritePropertyName("rampDownMinutesToWaitOnDisconnect"u8); - writer.WriteNumberValue(RampDownMinutesToWaitOnDisconnect.Value); - } - if (Optional.IsDefined(RampDownActionOnLogoff)) - { - writer.WritePropertyName("rampDownActionOnLogoff"u8); - writer.WriteStringValue(RampDownActionOnLogoff.Value.ToString()); - } - if (Optional.IsDefined(RampDownMinutesToWaitOnLogoff)) - { - writer.WritePropertyName("rampDownMinutesToWaitOnLogoff"u8); - writer.WriteNumberValue(RampDownMinutesToWaitOnLogoff.Value); - } - if (Optional.IsDefined(OffPeakStartTime)) - { - writer.WritePropertyName("offPeakStartTime"u8); - writer.WriteObjectValue(OffPeakStartTime, options); - } - if (Optional.IsDefined(OffPeakStartVmOnConnect)) - { - writer.WritePropertyName("offPeakStartVMOnConnect"u8); - writer.WriteStringValue(OffPeakStartVmOnConnect.Value.ToString()); - } - if (Optional.IsDefined(OffPeakActionOnDisconnect)) - { - writer.WritePropertyName("offPeakActionOnDisconnect"u8); - writer.WriteStringValue(OffPeakActionOnDisconnect.Value.ToString()); - } - if (Optional.IsDefined(OffPeakMinutesToWaitOnDisconnect)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("offPeakMinutesToWaitOnDisconnect"u8); - writer.WriteNumberValue(OffPeakMinutesToWaitOnDisconnect.Value); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(OffPeakActionOnLogoff)) - { - writer.WritePropertyName("offPeakActionOnLogoff"u8); - writer.WriteStringValue(OffPeakActionOnLogoff.Value.ToString()); - } - if (Optional.IsDefined(OffPeakMinutesToWaitOnLogoff)) - { - writer.WritePropertyName("offPeakMinutesToWaitOnLogoff"u8); - writer.WriteNumberValue(OffPeakMinutesToWaitOnLogoff.Value); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -209,32 +76,7 @@ internal static ScalingPlanPersonalSchedulePatch DeserializeScalingPlanPersonalS { return null; } - IList daysOfWeek = default; - ScalingActionTime rampUpStartTime = default; - StartupBehavior? rampUpAutoStartHosts = default; - SetStartVmOnConnect? rampUpStartVmOnConnect = default; - SessionHandlingOperation? rampUpActionOnDisconnect = default; - int? rampUpMinutesToWaitOnDisconnect = default; - SessionHandlingOperation? rampUpActionOnLogoff = default; - int? rampUpMinutesToWaitOnLogoff = default; - ScalingActionTime peakStartTime = default; - SetStartVmOnConnect? peakStartVmOnConnect = default; - SessionHandlingOperation? peakActionOnDisconnect = default; - int? peakMinutesToWaitOnDisconnect = default; - SessionHandlingOperation? peakActionOnLogoff = default; - int? peakMinutesToWaitOnLogoff = default; - ScalingActionTime rampDownStartTime = default; - SetStartVmOnConnect? rampDownStartVmOnConnect = default; - SessionHandlingOperation? rampDownActionOnDisconnect = default; - int? rampDownMinutesToWaitOnDisconnect = default; - SessionHandlingOperation? rampDownActionOnLogoff = default; - int? rampDownMinutesToWaitOnLogoff = default; - ScalingActionTime offPeakStartTime = default; - SetStartVmOnConnect? offPeakStartVmOnConnect = default; - SessionHandlingOperation? offPeakActionOnDisconnect = default; - int? offPeakMinutesToWaitOnDisconnect = default; - SessionHandlingOperation? offPeakActionOnLogoff = default; - int? offPeakMinutesToWaitOnLogoff = default; + ScalingPlanPersonalSchedulePatchProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -243,251 +85,9 @@ internal static ScalingPlanPersonalSchedulePatch DeserializeScalingPlanPersonalS { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("daysOfWeek"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString().ToDesktopVirtualizationDayOfWeek()); - } - daysOfWeek = array; - continue; - } - if (property0.NameEquals("rampUpStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("rampUpAutoStartHosts"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpAutoStartHosts = new StartupBehavior(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampUpStartVMOnConnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpStartVmOnConnect = new SetStartVmOnConnect(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampUpActionOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpActionOnDisconnect = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampUpMinutesToWaitOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpMinutesToWaitOnDisconnect = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampUpActionOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpActionOnLogoff = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampUpMinutesToWaitOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpMinutesToWaitOnLogoff = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("peakStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("peakStartVMOnConnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakStartVmOnConnect = new SetStartVmOnConnect(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("peakActionOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakActionOnDisconnect = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("peakMinutesToWaitOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakMinutesToWaitOnDisconnect = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("peakActionOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakActionOnLogoff = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("peakMinutesToWaitOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakMinutesToWaitOnLogoff = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampDownStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("rampDownStartVMOnConnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownStartVmOnConnect = new SetStartVmOnConnect(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownActionOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownActionOnDisconnect = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownMinutesToWaitOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownMinutesToWaitOnDisconnect = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampDownActionOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownActionOnLogoff = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownMinutesToWaitOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownMinutesToWaitOnLogoff = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("offPeakStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("offPeakStartVMOnConnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakStartVmOnConnect = new SetStartVmOnConnect(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("offPeakActionOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakActionOnDisconnect = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("offPeakMinutesToWaitOnDisconnect"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakMinutesToWaitOnDisconnect = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("offPeakActionOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakActionOnLogoff = new SessionHandlingOperation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("offPeakMinutesToWaitOnLogoff"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakMinutesToWaitOnLogoff = property0.Value.GetInt32(); - continue; - } - } + properties = ScalingPlanPersonalSchedulePatchProperties.DeserializeScalingPlanPersonalSchedulePatchProperties(property.Value, options); continue; } if (options.Format != "W") @@ -496,34 +96,7 @@ internal static ScalingPlanPersonalSchedulePatch DeserializeScalingPlanPersonalS } } serializedAdditionalRawData = rawDataDictionary; - return new ScalingPlanPersonalSchedulePatch( - daysOfWeek ?? new ChangeTrackingList(), - rampUpStartTime, - rampUpAutoStartHosts, - rampUpStartVmOnConnect, - rampUpActionOnDisconnect, - rampUpMinutesToWaitOnDisconnect, - rampUpActionOnLogoff, - rampUpMinutesToWaitOnLogoff, - peakStartTime, - peakStartVmOnConnect, - peakActionOnDisconnect, - peakMinutesToWaitOnDisconnect, - peakActionOnLogoff, - peakMinutesToWaitOnLogoff, - rampDownStartTime, - rampDownStartVmOnConnect, - rampDownActionOnDisconnect, - rampDownMinutesToWaitOnDisconnect, - rampDownActionOnLogoff, - rampDownMinutesToWaitOnLogoff, - offPeakStartTime, - offPeakStartVmOnConnect, - offPeakActionOnDisconnect, - offPeakMinutesToWaitOnDisconnect, - offPeakActionOnLogoff, - offPeakMinutesToWaitOnLogoff, - serializedAdditionalRawData); + return new ScalingPlanPersonalSchedulePatch(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.cs index 333c345b34ba..9203114353b0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatch.cs @@ -48,145 +48,19 @@ public partial class ScalingPlanPersonalSchedulePatch /// Initializes a new instance of . public ScalingPlanPersonalSchedulePatch() { - DaysOfWeek = new ChangeTrackingList(); } /// Initializes a new instance of . - /// Set of days of the week on which this schedule is active. - /// Starting time for ramp up period. - /// The desired startup behavior during the ramp up period for personal vms in the hostpool. - /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. - /// Action to be taken after a user disconnect during the ramp up period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. - /// Action to be taken after a logoff during the ramp up period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. - /// Starting time for peak period. - /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. - /// Action to be taken after a user disconnect during the peak period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. - /// Action to be taken after a logoff during the peak period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. - /// Starting time for ramp down period. - /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. - /// Action to be taken after a user disconnect during the ramp down period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. - /// Action to be taken after a logoff during the ramp down period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. - /// Starting time for off-peak period. - /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. - /// Action to be taken after a user disconnect during the off-peak period. - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. - /// Action to be taken after a logoff during the off-peak period. - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. + /// Detailed properties for ScalingPlanPersonalSchedule. /// Keeps track of any properties unknown to the library. - internal ScalingPlanPersonalSchedulePatch(IList daysOfWeek, ScalingActionTime rampUpStartTime, StartupBehavior? rampUpAutoStartHosts, SetStartVmOnConnect? rampUpStartVmOnConnect, SessionHandlingOperation? rampUpActionOnDisconnect, int? rampUpMinutesToWaitOnDisconnect, SessionHandlingOperation? rampUpActionOnLogoff, int? rampUpMinutesToWaitOnLogoff, ScalingActionTime peakStartTime, SetStartVmOnConnect? peakStartVmOnConnect, SessionHandlingOperation? peakActionOnDisconnect, int? peakMinutesToWaitOnDisconnect, SessionHandlingOperation? peakActionOnLogoff, int? peakMinutesToWaitOnLogoff, ScalingActionTime rampDownStartTime, SetStartVmOnConnect? rampDownStartVmOnConnect, SessionHandlingOperation? rampDownActionOnDisconnect, int? rampDownMinutesToWaitOnDisconnect, SessionHandlingOperation? rampDownActionOnLogoff, int? rampDownMinutesToWaitOnLogoff, ScalingActionTime offPeakStartTime, SetStartVmOnConnect? offPeakStartVmOnConnect, SessionHandlingOperation? offPeakActionOnDisconnect, int? offPeakMinutesToWaitOnDisconnect, SessionHandlingOperation? offPeakActionOnLogoff, int? offPeakMinutesToWaitOnLogoff, IDictionary serializedAdditionalRawData) + internal ScalingPlanPersonalSchedulePatch(ScalingPlanPersonalSchedulePatchProperties properties, IDictionary serializedAdditionalRawData) { - DaysOfWeek = daysOfWeek; - RampUpStartTime = rampUpStartTime; - RampUpAutoStartHosts = rampUpAutoStartHosts; - RampUpStartVmOnConnect = rampUpStartVmOnConnect; - RampUpActionOnDisconnect = rampUpActionOnDisconnect; - RampUpMinutesToWaitOnDisconnect = rampUpMinutesToWaitOnDisconnect; - RampUpActionOnLogoff = rampUpActionOnLogoff; - RampUpMinutesToWaitOnLogoff = rampUpMinutesToWaitOnLogoff; - PeakStartTime = peakStartTime; - PeakStartVmOnConnect = peakStartVmOnConnect; - PeakActionOnDisconnect = peakActionOnDisconnect; - PeakMinutesToWaitOnDisconnect = peakMinutesToWaitOnDisconnect; - PeakActionOnLogoff = peakActionOnLogoff; - PeakMinutesToWaitOnLogoff = peakMinutesToWaitOnLogoff; - RampDownStartTime = rampDownStartTime; - RampDownStartVmOnConnect = rampDownStartVmOnConnect; - RampDownActionOnDisconnect = rampDownActionOnDisconnect; - RampDownMinutesToWaitOnDisconnect = rampDownMinutesToWaitOnDisconnect; - RampDownActionOnLogoff = rampDownActionOnLogoff; - RampDownMinutesToWaitOnLogoff = rampDownMinutesToWaitOnLogoff; - OffPeakStartTime = offPeakStartTime; - OffPeakStartVmOnConnect = offPeakStartVmOnConnect; - OffPeakActionOnDisconnect = offPeakActionOnDisconnect; - OffPeakMinutesToWaitOnDisconnect = offPeakMinutesToWaitOnDisconnect; - OffPeakActionOnLogoff = offPeakActionOnLogoff; - OffPeakMinutesToWaitOnLogoff = offPeakMinutesToWaitOnLogoff; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Set of days of the week on which this schedule is active. - [WirePath("properties.daysOfWeek")] - public IList DaysOfWeek { get; } - /// Starting time for ramp up period. - [WirePath("properties.rampUpStartTime")] - public ScalingActionTime RampUpStartTime { get; set; } - /// The desired startup behavior during the ramp up period for personal vms in the hostpool. - [WirePath("properties.rampUpAutoStartHosts")] - public StartupBehavior? RampUpAutoStartHosts { get; set; } - /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. - [WirePath("properties.rampUpStartVMOnConnect")] - public SetStartVmOnConnect? RampUpStartVmOnConnect { get; set; } - /// Action to be taken after a user disconnect during the ramp up period. - [WirePath("properties.rampUpActionOnDisconnect")] - public SessionHandlingOperation? RampUpActionOnDisconnect { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. - [WirePath("properties.rampUpMinutesToWaitOnDisconnect")] - public int? RampUpMinutesToWaitOnDisconnect { get; set; } - /// Action to be taken after a logoff during the ramp up period. - [WirePath("properties.rampUpActionOnLogoff")] - public SessionHandlingOperation? RampUpActionOnLogoff { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. - [WirePath("properties.rampUpMinutesToWaitOnLogoff")] - public int? RampUpMinutesToWaitOnLogoff { get; set; } - /// Starting time for peak period. - [WirePath("properties.peakStartTime")] - public ScalingActionTime PeakStartTime { get; set; } - /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. - [WirePath("properties.peakStartVMOnConnect")] - public SetStartVmOnConnect? PeakStartVmOnConnect { get; set; } - /// Action to be taken after a user disconnect during the peak period. - [WirePath("properties.peakActionOnDisconnect")] - public SessionHandlingOperation? PeakActionOnDisconnect { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. - [WirePath("properties.peakMinutesToWaitOnDisconnect")] - public int? PeakMinutesToWaitOnDisconnect { get; set; } - /// Action to be taken after a logoff during the peak period. - [WirePath("properties.peakActionOnLogoff")] - public SessionHandlingOperation? PeakActionOnLogoff { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. - [WirePath("properties.peakMinutesToWaitOnLogoff")] - public int? PeakMinutesToWaitOnLogoff { get; set; } - /// Starting time for ramp down period. - [WirePath("properties.rampDownStartTime")] - public ScalingActionTime RampDownStartTime { get; set; } - /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. - [WirePath("properties.rampDownStartVMOnConnect")] - public SetStartVmOnConnect? RampDownStartVmOnConnect { get; set; } - /// Action to be taken after a user disconnect during the ramp down period. - [WirePath("properties.rampDownActionOnDisconnect")] - public SessionHandlingOperation? RampDownActionOnDisconnect { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. - [WirePath("properties.rampDownMinutesToWaitOnDisconnect")] - public int? RampDownMinutesToWaitOnDisconnect { get; set; } - /// Action to be taken after a logoff during the ramp down period. - [WirePath("properties.rampDownActionOnLogoff")] - public SessionHandlingOperation? RampDownActionOnLogoff { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. - [WirePath("properties.rampDownMinutesToWaitOnLogoff")] - public int? RampDownMinutesToWaitOnLogoff { get; set; } - /// Starting time for off-peak period. - [WirePath("properties.offPeakStartTime")] - public ScalingActionTime OffPeakStartTime { get; set; } - /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. - [WirePath("properties.offPeakStartVMOnConnect")] - public SetStartVmOnConnect? OffPeakStartVmOnConnect { get; set; } - /// Action to be taken after a user disconnect during the off-peak period. - [WirePath("properties.offPeakActionOnDisconnect")] - public SessionHandlingOperation? OffPeakActionOnDisconnect { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. - [WirePath("properties.offPeakMinutesToWaitOnDisconnect")] - public int? OffPeakMinutesToWaitOnDisconnect { get; set; } - /// Action to be taken after a logoff during the off-peak period. - [WirePath("properties.offPeakActionOnLogoff")] - public SessionHandlingOperation? OffPeakActionOnLogoff { get; set; } - /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. - [WirePath("properties.offPeakMinutesToWaitOnLogoff")] - public int? OffPeakMinutesToWaitOnLogoff { get; set; } + /// Detailed properties for ScalingPlanPersonalSchedule. + [WirePath("properties")] + public ScalingPlanPersonalSchedulePatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.Serialization.cs new file mode 100644 index 000000000000..482c386fc445 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.Serialization.cs @@ -0,0 +1,545 @@ +// 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 ScalingPlanPersonalSchedulePatchProperties : 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(ScalingPlanPersonalSchedulePatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(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); + } + if (Optional.IsDefined(RampUpAutoStartHosts)) + { + writer.WritePropertyName("rampUpAutoStartHosts"u8); + writer.WriteStringValue(RampUpAutoStartHosts.Value.ToString()); + } + if (Optional.IsDefined(RampUpStartVmOnConnect)) + { + writer.WritePropertyName("rampUpStartVMOnConnect"u8); + writer.WriteStringValue(RampUpStartVmOnConnect.Value.ToString()); + } + if (Optional.IsDefined(RampUpActionOnDisconnect)) + { + writer.WritePropertyName("rampUpActionOnDisconnect"u8); + writer.WriteStringValue(RampUpActionOnDisconnect.Value.ToString()); + } + if (Optional.IsDefined(RampUpMinutesToWaitOnDisconnect)) + { + writer.WritePropertyName("rampUpMinutesToWaitOnDisconnect"u8); + writer.WriteNumberValue(RampUpMinutesToWaitOnDisconnect.Value); + } + if (Optional.IsDefined(RampUpActionOnLogoff)) + { + writer.WritePropertyName("rampUpActionOnLogoff"u8); + writer.WriteStringValue(RampUpActionOnLogoff.Value.ToString()); + } + if (Optional.IsDefined(RampUpMinutesToWaitOnLogoff)) + { + writer.WritePropertyName("rampUpMinutesToWaitOnLogoff"u8); + writer.WriteNumberValue(RampUpMinutesToWaitOnLogoff.Value); + } + if (Optional.IsDefined(PeakStartTime)) + { + writer.WritePropertyName("peakStartTime"u8); + writer.WriteObjectValue(PeakStartTime, options); + } + if (Optional.IsDefined(PeakStartVmOnConnect)) + { + writer.WritePropertyName("peakStartVMOnConnect"u8); + writer.WriteStringValue(PeakStartVmOnConnect.Value.ToString()); + } + if (Optional.IsDefined(PeakActionOnDisconnect)) + { + writer.WritePropertyName("peakActionOnDisconnect"u8); + writer.WriteStringValue(PeakActionOnDisconnect.Value.ToString()); + } + if (Optional.IsDefined(PeakMinutesToWaitOnDisconnect)) + { + writer.WritePropertyName("peakMinutesToWaitOnDisconnect"u8); + writer.WriteNumberValue(PeakMinutesToWaitOnDisconnect.Value); + } + if (Optional.IsDefined(PeakActionOnLogoff)) + { + writer.WritePropertyName("peakActionOnLogoff"u8); + writer.WriteStringValue(PeakActionOnLogoff.Value.ToString()); + } + if (Optional.IsDefined(PeakMinutesToWaitOnLogoff)) + { + writer.WritePropertyName("peakMinutesToWaitOnLogoff"u8); + writer.WriteNumberValue(PeakMinutesToWaitOnLogoff.Value); + } + if (Optional.IsDefined(RampDownStartTime)) + { + writer.WritePropertyName("rampDownStartTime"u8); + writer.WriteObjectValue(RampDownStartTime, options); + } + if (Optional.IsDefined(RampDownStartVmOnConnect)) + { + writer.WritePropertyName("rampDownStartVMOnConnect"u8); + writer.WriteStringValue(RampDownStartVmOnConnect.Value.ToString()); + } + if (Optional.IsDefined(RampDownActionOnDisconnect)) + { + writer.WritePropertyName("rampDownActionOnDisconnect"u8); + writer.WriteStringValue(RampDownActionOnDisconnect.Value.ToString()); + } + if (Optional.IsDefined(RampDownMinutesToWaitOnDisconnect)) + { + writer.WritePropertyName("rampDownMinutesToWaitOnDisconnect"u8); + writer.WriteNumberValue(RampDownMinutesToWaitOnDisconnect.Value); + } + if (Optional.IsDefined(RampDownActionOnLogoff)) + { + writer.WritePropertyName("rampDownActionOnLogoff"u8); + writer.WriteStringValue(RampDownActionOnLogoff.Value.ToString()); + } + if (Optional.IsDefined(RampDownMinutesToWaitOnLogoff)) + { + writer.WritePropertyName("rampDownMinutesToWaitOnLogoff"u8); + writer.WriteNumberValue(RampDownMinutesToWaitOnLogoff.Value); + } + if (Optional.IsDefined(OffPeakStartTime)) + { + writer.WritePropertyName("offPeakStartTime"u8); + writer.WriteObjectValue(OffPeakStartTime, options); + } + if (Optional.IsDefined(OffPeakStartVmOnConnect)) + { + writer.WritePropertyName("offPeakStartVMOnConnect"u8); + writer.WriteStringValue(OffPeakStartVmOnConnect.Value.ToString()); + } + if (Optional.IsDefined(OffPeakActionOnDisconnect)) + { + writer.WritePropertyName("offPeakActionOnDisconnect"u8); + writer.WriteStringValue(OffPeakActionOnDisconnect.Value.ToString()); + } + if (Optional.IsDefined(OffPeakMinutesToWaitOnDisconnect)) + { + writer.WritePropertyName("offPeakMinutesToWaitOnDisconnect"u8); + writer.WriteNumberValue(OffPeakMinutesToWaitOnDisconnect.Value); + } + if (Optional.IsDefined(OffPeakActionOnLogoff)) + { + writer.WritePropertyName("offPeakActionOnLogoff"u8); + writer.WriteStringValue(OffPeakActionOnLogoff.Value.ToString()); + } + if (Optional.IsDefined(OffPeakMinutesToWaitOnLogoff)) + { + writer.WritePropertyName("offPeakMinutesToWaitOnLogoff"u8); + writer.WriteNumberValue(OffPeakMinutesToWaitOnLogoff.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 + } + } + } + + ScalingPlanPersonalSchedulePatchProperties 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(ScalingPlanPersonalSchedulePatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScalingPlanPersonalSchedulePatchProperties(document.RootElement, options); + } + + internal static ScalingPlanPersonalSchedulePatchProperties DeserializeScalingPlanPersonalSchedulePatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList daysOfWeek = default; + ScalingActionTime rampUpStartTime = default; + StartupBehavior? rampUpAutoStartHosts = default; + SetStartVmOnConnect? rampUpStartVmOnConnect = default; + SessionHandlingOperation? rampUpActionOnDisconnect = default; + int? rampUpMinutesToWaitOnDisconnect = default; + SessionHandlingOperation? rampUpActionOnLogoff = default; + int? rampUpMinutesToWaitOnLogoff = default; + ScalingActionTime peakStartTime = default; + SetStartVmOnConnect? peakStartVmOnConnect = default; + SessionHandlingOperation? peakActionOnDisconnect = default; + int? peakMinutesToWaitOnDisconnect = default; + SessionHandlingOperation? peakActionOnLogoff = default; + int? peakMinutesToWaitOnLogoff = default; + ScalingActionTime rampDownStartTime = default; + SetStartVmOnConnect? rampDownStartVmOnConnect = default; + SessionHandlingOperation? rampDownActionOnDisconnect = default; + int? rampDownMinutesToWaitOnDisconnect = default; + SessionHandlingOperation? rampDownActionOnLogoff = default; + int? rampDownMinutesToWaitOnLogoff = default; + ScalingActionTime offPeakStartTime = default; + SetStartVmOnConnect? offPeakStartVmOnConnect = default; + SessionHandlingOperation? offPeakActionOnDisconnect = default; + int? offPeakMinutesToWaitOnDisconnect = default; + SessionHandlingOperation? offPeakActionOnLogoff = default; + int? offPeakMinutesToWaitOnLogoff = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("daysOfWeek"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString().ToDesktopVirtualizationDayOfWeek()); + } + daysOfWeek = array; + continue; + } + if (property.NameEquals("rampUpStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("rampUpAutoStartHosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpAutoStartHosts = new StartupBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampUpStartVMOnConnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpStartVmOnConnect = new SetStartVmOnConnect(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampUpActionOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpActionOnDisconnect = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampUpMinutesToWaitOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpMinutesToWaitOnDisconnect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampUpActionOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpActionOnLogoff = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampUpMinutesToWaitOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpMinutesToWaitOnLogoff = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("peakStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("peakStartVMOnConnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakStartVmOnConnect = new SetStartVmOnConnect(property.Value.GetString()); + continue; + } + if (property.NameEquals("peakActionOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakActionOnDisconnect = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("peakMinutesToWaitOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakMinutesToWaitOnDisconnect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("peakActionOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakActionOnLogoff = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("peakMinutesToWaitOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakMinutesToWaitOnLogoff = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("rampDownStartVMOnConnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownStartVmOnConnect = new SetStartVmOnConnect(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownActionOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownActionOnDisconnect = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownMinutesToWaitOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownMinutesToWaitOnDisconnect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownActionOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownActionOnLogoff = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownMinutesToWaitOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownMinutesToWaitOnLogoff = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("offPeakStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("offPeakStartVMOnConnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakStartVmOnConnect = new SetStartVmOnConnect(property.Value.GetString()); + continue; + } + if (property.NameEquals("offPeakActionOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakActionOnDisconnect = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("offPeakMinutesToWaitOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakMinutesToWaitOnDisconnect = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("offPeakActionOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakActionOnLogoff = new SessionHandlingOperation(property.Value.GetString()); + continue; + } + if (property.NameEquals("offPeakMinutesToWaitOnLogoff"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakMinutesToWaitOnLogoff = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScalingPlanPersonalSchedulePatchProperties( + daysOfWeek ?? new ChangeTrackingList(), + rampUpStartTime, + rampUpAutoStartHosts, + rampUpStartVmOnConnect, + rampUpActionOnDisconnect, + rampUpMinutesToWaitOnDisconnect, + rampUpActionOnLogoff, + rampUpMinutesToWaitOnLogoff, + peakStartTime, + peakStartVmOnConnect, + peakActionOnDisconnect, + peakMinutesToWaitOnDisconnect, + peakActionOnLogoff, + peakMinutesToWaitOnLogoff, + rampDownStartTime, + rampDownStartVmOnConnect, + rampDownActionOnDisconnect, + rampDownMinutesToWaitOnDisconnect, + rampDownActionOnLogoff, + rampDownMinutesToWaitOnLogoff, + offPeakStartTime, + offPeakStartVmOnConnect, + offPeakActionOnDisconnect, + offPeakMinutesToWaitOnDisconnect, + offPeakActionOnLogoff, + offPeakMinutesToWaitOnLogoff, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ScalingPlanPersonalSchedulePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ScalingPlanPersonalSchedulePatchProperties 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 DeserializeScalingPlanPersonalSchedulePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScalingPlanPersonalSchedulePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.cs new file mode 100644 index 000000000000..d1b7c34f9732 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPersonalSchedulePatchProperties.cs @@ -0,0 +1,192 @@ +// 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 +{ + /// ScalingPlanPersonalSchedule properties that can be patched. + public partial class ScalingPlanPersonalSchedulePatchProperties + { + /// + /// 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 ScalingPlanPersonalSchedulePatchProperties() + { + DaysOfWeek = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Set of days of the week on which this schedule is active. + /// Starting time for ramp up period. + /// The desired startup behavior during the ramp up period for personal vms in the hostpool. + /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. + /// Action to be taken after a user disconnect during the ramp up period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. + /// Action to be taken after a logoff during the ramp up period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. + /// Starting time for peak period. + /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. + /// Action to be taken after a user disconnect during the peak period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. + /// Action to be taken after a logoff during the peak period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. + /// Starting time for ramp down period. + /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. + /// Action to be taken after a user disconnect during the ramp down period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. + /// Action to be taken after a logoff during the ramp down period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. + /// Starting time for off-peak period. + /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. + /// Action to be taken after a user disconnect during the off-peak period. + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. + /// Action to be taken after a logoff during the off-peak period. + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. + /// Keeps track of any properties unknown to the library. + internal ScalingPlanPersonalSchedulePatchProperties(IList daysOfWeek, ScalingActionTime rampUpStartTime, StartupBehavior? rampUpAutoStartHosts, SetStartVmOnConnect? rampUpStartVmOnConnect, SessionHandlingOperation? rampUpActionOnDisconnect, int? rampUpMinutesToWaitOnDisconnect, SessionHandlingOperation? rampUpActionOnLogoff, int? rampUpMinutesToWaitOnLogoff, ScalingActionTime peakStartTime, SetStartVmOnConnect? peakStartVmOnConnect, SessionHandlingOperation? peakActionOnDisconnect, int? peakMinutesToWaitOnDisconnect, SessionHandlingOperation? peakActionOnLogoff, int? peakMinutesToWaitOnLogoff, ScalingActionTime rampDownStartTime, SetStartVmOnConnect? rampDownStartVmOnConnect, SessionHandlingOperation? rampDownActionOnDisconnect, int? rampDownMinutesToWaitOnDisconnect, SessionHandlingOperation? rampDownActionOnLogoff, int? rampDownMinutesToWaitOnLogoff, ScalingActionTime offPeakStartTime, SetStartVmOnConnect? offPeakStartVmOnConnect, SessionHandlingOperation? offPeakActionOnDisconnect, int? offPeakMinutesToWaitOnDisconnect, SessionHandlingOperation? offPeakActionOnLogoff, int? offPeakMinutesToWaitOnLogoff, IDictionary serializedAdditionalRawData) + { + DaysOfWeek = daysOfWeek; + RampUpStartTime = rampUpStartTime; + RampUpAutoStartHosts = rampUpAutoStartHosts; + RampUpStartVmOnConnect = rampUpStartVmOnConnect; + RampUpActionOnDisconnect = rampUpActionOnDisconnect; + RampUpMinutesToWaitOnDisconnect = rampUpMinutesToWaitOnDisconnect; + RampUpActionOnLogoff = rampUpActionOnLogoff; + RampUpMinutesToWaitOnLogoff = rampUpMinutesToWaitOnLogoff; + PeakStartTime = peakStartTime; + PeakStartVmOnConnect = peakStartVmOnConnect; + PeakActionOnDisconnect = peakActionOnDisconnect; + PeakMinutesToWaitOnDisconnect = peakMinutesToWaitOnDisconnect; + PeakActionOnLogoff = peakActionOnLogoff; + PeakMinutesToWaitOnLogoff = peakMinutesToWaitOnLogoff; + RampDownStartTime = rampDownStartTime; + RampDownStartVmOnConnect = rampDownStartVmOnConnect; + RampDownActionOnDisconnect = rampDownActionOnDisconnect; + RampDownMinutesToWaitOnDisconnect = rampDownMinutesToWaitOnDisconnect; + RampDownActionOnLogoff = rampDownActionOnLogoff; + RampDownMinutesToWaitOnLogoff = rampDownMinutesToWaitOnLogoff; + OffPeakStartTime = offPeakStartTime; + OffPeakStartVmOnConnect = offPeakStartVmOnConnect; + OffPeakActionOnDisconnect = offPeakActionOnDisconnect; + OffPeakMinutesToWaitOnDisconnect = offPeakMinutesToWaitOnDisconnect; + OffPeakActionOnLogoff = offPeakActionOnLogoff; + OffPeakMinutesToWaitOnLogoff = offPeakMinutesToWaitOnLogoff; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Set of days of the week on which this schedule is active. + [WirePath("daysOfWeek")] + public IList DaysOfWeek { get; } + /// Starting time for ramp up period. + [WirePath("rampUpStartTime")] + public ScalingActionTime RampUpStartTime { get; set; } + /// The desired startup behavior during the ramp up period for personal vms in the hostpool. + [WirePath("rampUpAutoStartHosts")] + public StartupBehavior? RampUpAutoStartHosts { get; set; } + /// The desired configuration of Start VM On Connect for the hostpool during the ramp up phase. If this is disabled, session hosts must be turned on using rampUpAutoStartHosts or by turning them on manually. + [WirePath("rampUpStartVMOnConnect")] + public SetStartVmOnConnect? RampUpStartVmOnConnect { get; set; } + /// Action to be taken after a user disconnect during the ramp up period. + [WirePath("rampUpActionOnDisconnect")] + public SessionHandlingOperation? RampUpActionOnDisconnect { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp up period. + [WirePath("rampUpMinutesToWaitOnDisconnect")] + public int? RampUpMinutesToWaitOnDisconnect { get; set; } + /// Action to be taken after a logoff during the ramp up period. + [WirePath("rampUpActionOnLogoff")] + public SessionHandlingOperation? RampUpActionOnLogoff { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp up period. + [WirePath("rampUpMinutesToWaitOnLogoff")] + public int? RampUpMinutesToWaitOnLogoff { get; set; } + /// Starting time for peak period. + [WirePath("peakStartTime")] + public ScalingActionTime PeakStartTime { get; set; } + /// The desired configuration of Start VM On Connect for the hostpool during the peak phase. + [WirePath("peakStartVMOnConnect")] + public SetStartVmOnConnect? PeakStartVmOnConnect { get; set; } + /// Action to be taken after a user disconnect during the peak period. + [WirePath("peakActionOnDisconnect")] + public SessionHandlingOperation? PeakActionOnDisconnect { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the peak period. + [WirePath("peakMinutesToWaitOnDisconnect")] + public int? PeakMinutesToWaitOnDisconnect { get; set; } + /// Action to be taken after a logoff during the peak period. + [WirePath("peakActionOnLogoff")] + public SessionHandlingOperation? PeakActionOnLogoff { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the peak period. + [WirePath("peakMinutesToWaitOnLogoff")] + public int? PeakMinutesToWaitOnLogoff { get; set; } + /// Starting time for ramp down period. + [WirePath("rampDownStartTime")] + public ScalingActionTime RampDownStartTime { get; set; } + /// The desired configuration of Start VM On Connect for the hostpool during the ramp down phase. + [WirePath("rampDownStartVMOnConnect")] + public SetStartVmOnConnect? RampDownStartVmOnConnect { get; set; } + /// Action to be taken after a user disconnect during the ramp down period. + [WirePath("rampDownActionOnDisconnect")] + public SessionHandlingOperation? RampDownActionOnDisconnect { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the ramp down period. + [WirePath("rampDownMinutesToWaitOnDisconnect")] + public int? RampDownMinutesToWaitOnDisconnect { get; set; } + /// Action to be taken after a logoff during the ramp down period. + [WirePath("rampDownActionOnLogoff")] + public SessionHandlingOperation? RampDownActionOnLogoff { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the ramp down period. + [WirePath("rampDownMinutesToWaitOnLogoff")] + public int? RampDownMinutesToWaitOnLogoff { get; set; } + /// Starting time for off-peak period. + [WirePath("offPeakStartTime")] + public ScalingActionTime OffPeakStartTime { get; set; } + /// The desired configuration of Start VM On Connect for the hostpool during the off-peak phase. + [WirePath("offPeakStartVMOnConnect")] + public SetStartVmOnConnect? OffPeakStartVmOnConnect { get; set; } + /// Action to be taken after a user disconnect during the off-peak period. + [WirePath("offPeakActionOnDisconnect")] + public SessionHandlingOperation? OffPeakActionOnDisconnect { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user disconnects during the off-peak period. + [WirePath("offPeakMinutesToWaitOnDisconnect")] + public int? OffPeakMinutesToWaitOnDisconnect { get; set; } + /// Action to be taken after a logoff during the off-peak period. + [WirePath("offPeakActionOnLogoff")] + public SessionHandlingOperation? OffPeakActionOnLogoff { get; set; } + /// The time in minutes to wait before performing the desired session handling action when a user logs off during the off-peak period. + [WirePath("offPeakMinutesToWaitOnLogoff")] + public int? OffPeakMinutesToWaitOnLogoff { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.Serialization.cs index 5acae07cb078..da620ee077e6 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(ScalingPlanPooledScheduleList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static ScalingPlanPooledScheduleList DeserializeScalingPlanPooledSchedu return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static ScalingPlanPooledScheduleList DeserializeScalingPlanPooledSchedu } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static ScalingPlanPooledScheduleList DeserializeScalingPlanPooledSchedu } } serializedAdditionalRawData = rawDataDictionary; - return new ScalingPlanPooledScheduleList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ScalingPlanPooledScheduleList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.cs index 2e1cd32a5f75..15d0acd3a75e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledScheduleList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class ScalingPlanPooledScheduleList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal ScalingPlanPooledScheduleList() + /// The ScalingPlanPooledSchedule items on this page. + /// is null. + internal ScalingPlanPooledScheduleList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of ScalingPlanPooledSchedule definitions. - /// Link to the next page of results. + /// The ScalingPlanPooledSchedule items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ScalingPlanPooledScheduleList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal ScalingPlanPooledScheduleList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of ScalingPlanPooledSchedule definitions. + /// Initializes a new instance of for deserialization. + internal ScalingPlanPooledScheduleList() + { + } + + /// The ScalingPlanPooledSchedule items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } 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 b00ede59b67c..7d7ccdfc1110 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 @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -38,99 +37,11 @@ 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.WriteStringValue(item.ToSerialString()); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(RampUpStartTime)) - { - writer.WritePropertyName("rampUpStartTime"u8); - writer.WriteObjectValue(RampUpStartTime, options); - } - if (Optional.IsDefined(RampUpLoadBalancingAlgorithm)) - { - writer.WritePropertyName("rampUpLoadBalancingAlgorithm"u8); - writer.WriteStringValue(RampUpLoadBalancingAlgorithm.Value.ToString()); - } - if (Optional.IsDefined(RampUpMinimumHostsPct)) - { - 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); - } - 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); - } - if (Optional.IsDefined(RampDownLoadBalancingAlgorithm)) - { - writer.WritePropertyName("rampDownLoadBalancingAlgorithm"u8); - writer.WriteStringValue(RampDownLoadBalancingAlgorithm.Value.ToString()); - } - if (Optional.IsDefined(RampDownMinimumHostsPct)) - { - writer.WritePropertyName("rampDownMinimumHostsPct"u8); - writer.WriteNumberValue(RampDownMinimumHostsPct.Value); - } - if (Optional.IsDefined(RampDownCapacityThresholdPct)) - { - writer.WritePropertyName("rampDownCapacityThresholdPct"u8); - writer.WriteNumberValue(RampDownCapacityThresholdPct.Value); - } - if (Optional.IsDefined(RampDownForceLogoffUsers)) - { - writer.WritePropertyName("rampDownForceLogoffUsers"u8); - writer.WriteBooleanValue(RampDownForceLogoffUsers.Value); - } - if (Optional.IsDefined(RampDownStopHostsWhen)) - { - writer.WritePropertyName("rampDownStopHostsWhen"u8); - writer.WriteStringValue(RampDownStopHostsWhen.Value.ToString()); - } - if (Optional.IsDefined(RampDownWaitTimeMinutes)) - { - writer.WritePropertyName("rampDownWaitTimeMinutes"u8); - writer.WriteNumberValue(RampDownWaitTimeMinutes.Value); - } - if (Optional.IsDefined(RampDownNotificationMessage)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("rampDownNotificationMessage"u8); - writer.WriteStringValue(RampDownNotificationMessage); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(OffPeakStartTime)) - { - writer.WritePropertyName("offPeakStartTime"u8); - writer.WriteObjectValue(OffPeakStartTime, options); - } - if (Optional.IsDefined(OffPeakLoadBalancingAlgorithm)) - { - writer.WritePropertyName("offPeakLoadBalancingAlgorithm"u8); - writer.WriteStringValue(OffPeakLoadBalancingAlgorithm.Value.ToString()); - } - writer.WriteEndObject(); } ScalingPlanPooledSchedulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -153,31 +64,24 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched { return null; } + ScalingPlanPooledSchedulePatchProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IList daysOfWeek = default; - ScalingActionTime rampUpStartTime = default; - SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; - int? rampUpMinimumHostsPct = default; - int? rampUpCapacityThresholdPct = default; - ScalingActionTime peakStartTime = default; - SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = default; - ScalingActionTime rampDownStartTime = default; - SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = default; - int? rampDownMinimumHostsPct = default; - int? rampDownCapacityThresholdPct = default; - bool? rampDownForceLogoffUsers = default; - DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = default; - int? rampDownWaitTimeMinutes = default; - string rampDownNotificationMessage = default; - ScalingActionTime offPeakStartTime = default; - SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = 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) + { + continue; + } + properties = ScalingPlanPooledSchedulePatchProperties.DeserializeScalingPlanPooledSchedulePatchProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -202,172 +106,6 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched 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("daysOfWeek"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString().ToDesktopVirtualizationDayOfWeek()); - } - daysOfWeek = array; - continue; - } - if (property0.NameEquals("rampUpStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("rampUpLoadBalancingAlgorithm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampUpMinimumHostsPct"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampUpMinimumHostsPct = property0.Value.GetInt32(); - continue; - } - 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; - } - if (property0.NameEquals("peakLoadBalancingAlgorithm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - peakLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("rampDownLoadBalancingAlgorithm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownMinimumHostsPct"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownMinimumHostsPct = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampDownCapacityThresholdPct"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownCapacityThresholdPct = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampDownForceLogoffUsers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownForceLogoffUsers = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("rampDownStopHostsWhen"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownStopHostsWhen = new DesktopVirtualizationStopHostsWhen(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("rampDownWaitTimeMinutes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - rampDownWaitTimeMinutes = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("rampDownNotificationMessage"u8)) - { - rampDownNotificationMessage = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("offPeakStartTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property0.Value, options); - continue; - } - if (property0.NameEquals("offPeakLoadBalancingAlgorithm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - offPeakLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -379,23 +117,7 @@ internal static ScalingPlanPooledSchedulePatch DeserializeScalingPlanPooledSched name, type, systemData, - daysOfWeek ?? new ChangeTrackingList(), - rampUpStartTime, - rampUpLoadBalancingAlgorithm, - rampUpMinimumHostsPct, - rampUpCapacityThresholdPct, - peakStartTime, - peakLoadBalancingAlgorithm, - rampDownStartTime, - rampDownLoadBalancingAlgorithm, - rampDownMinimumHostsPct, - rampDownCapacityThresholdPct, - rampDownForceLogoffUsers, - rampDownStopHostsWhen, - rampDownWaitTimeMinutes, - rampDownNotificationMessage, - offPeakStartTime, - offPeakLoadBalancingAlgorithm, + properties, serializedAdditionalRawData); } @@ -433,311 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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(DaysOfWeek), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" daysOfWeek: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(DaysOfWeek)) - { - if (DaysOfWeek.Any()) - { - builder.Append(" daysOfWeek: "); - builder.AppendLine("["); - foreach (var item in DaysOfWeek) - { - builder.AppendLine($" '{item.ToSerialString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpStartTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampUpStartTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampUpStartTime)) - { - builder.Append(" rampUpStartTime: "); - BicepSerializationHelpers.AppendChildObject(builder, RampUpStartTime, options, 4, false, " rampUpStartTime: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpLoadBalancingAlgorithm), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampUpLoadBalancingAlgorithm: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampUpLoadBalancingAlgorithm)) - { - builder.Append(" rampUpLoadBalancingAlgorithm: "); - builder.AppendLine($"'{RampUpLoadBalancingAlgorithm.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpMinimumHostsPct), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampUpMinimumHostsPct: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampUpMinimumHostsPct)) - { - builder.Append(" rampUpMinimumHostsPct: "); - builder.AppendLine($"{RampUpMinimumHostsPct.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpCapacityThresholdPct), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampUpCapacityThresholdPct: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampUpCapacityThresholdPct)) - { - builder.Append(" rampUpCapacityThresholdPct: "); - builder.AppendLine($"{RampUpCapacityThresholdPct.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PeakStartTime), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" peakStartTime: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(PeakStartTime)) + if (Optional.IsDefined(Properties)) { - builder.Append(" peakStartTime: "); - BicepSerializationHelpers.AppendChildObject(builder, PeakStartTime, options, 4, false, " peakStartTime: "); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PeakLoadBalancingAlgorithm), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" peakLoadBalancingAlgorithm: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PeakLoadBalancingAlgorithm)) - { - builder.Append(" peakLoadBalancingAlgorithm: "); - builder.AppendLine($"'{PeakLoadBalancingAlgorithm.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownStartTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownStartTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownStartTime)) - { - builder.Append(" rampDownStartTime: "); - BicepSerializationHelpers.AppendChildObject(builder, RampDownStartTime, options, 4, false, " rampDownStartTime: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownLoadBalancingAlgorithm), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownLoadBalancingAlgorithm: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownLoadBalancingAlgorithm)) - { - builder.Append(" rampDownLoadBalancingAlgorithm: "); - builder.AppendLine($"'{RampDownLoadBalancingAlgorithm.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownMinimumHostsPct), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownMinimumHostsPct: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownMinimumHostsPct)) - { - builder.Append(" rampDownMinimumHostsPct: "); - builder.AppendLine($"{RampDownMinimumHostsPct.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownCapacityThresholdPct), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownCapacityThresholdPct: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownCapacityThresholdPct)) - { - builder.Append(" rampDownCapacityThresholdPct: "); - builder.AppendLine($"{RampDownCapacityThresholdPct.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownForceLogoffUsers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownForceLogoffUsers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownForceLogoffUsers)) - { - builder.Append(" rampDownForceLogoffUsers: "); - var boolValue = RampDownForceLogoffUsers.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownStopHostsWhen), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownStopHostsWhen: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownStopHostsWhen)) - { - builder.Append(" rampDownStopHostsWhen: "); - builder.AppendLine($"'{RampDownStopHostsWhen.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownWaitTimeMinutes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownWaitTimeMinutes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownWaitTimeMinutes)) - { - builder.Append(" rampDownWaitTimeMinutes: "); - builder.AppendLine($"{RampDownWaitTimeMinutes.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownNotificationMessage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rampDownNotificationMessage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RampDownNotificationMessage)) - { - builder.Append(" rampDownNotificationMessage: "); - if (RampDownNotificationMessage.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RampDownNotificationMessage}'''"); - } - else - { - builder.AppendLine($"'{RampDownNotificationMessage}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OffPeakStartTime), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" offPeakStartTime: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(OffPeakStartTime)) + if (Optional.IsDefined(Id)) { - builder.Append(" offPeakStartTime: "); - BicepSerializationHelpers.AppendChildObject(builder, OffPeakStartTime, options, 4, false, " offPeakStartTime: "); + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OffPeakLoadBalancingAlgorithm), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" offPeakLoadBalancingAlgorithm: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(OffPeakLoadBalancingAlgorithm)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" offPeakLoadBalancingAlgorithm: "); - builder.AppendLine($"'{OffPeakLoadBalancingAlgorithm.Value.ToString()}'"); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } 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..1a51c8b59618 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatch.cs @@ -50,7 +50,6 @@ public partial class ScalingPlanPooledSchedulePatch : ResourceData /// Initializes a new instance of . public ScalingPlanPooledSchedulePatch() { - DaysOfWeek = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -58,96 +57,16 @@ public ScalingPlanPooledSchedulePatch() /// 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. + /// Detailed properties for ScalingPlanPooledSchedule. /// 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, ScalingPlanPooledSchedulePatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - DaysOfWeek = daysOfWeek; - 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; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Set of days of the week on which this schedule is active. - [WirePath("properties.daysOfWeek")] - public IList DaysOfWeek { get; } - /// Starting time for ramp up period. - [WirePath("properties.rampUpStartTime")] - public ScalingActionTime RampUpStartTime { get; set; } - /// Load balancing algorithm for ramp up period. - [WirePath("properties.rampUpLoadBalancingAlgorithm")] - public SessionHostLoadBalancingAlgorithm? RampUpLoadBalancingAlgorithm { get; set; } - /// Minimum host percentage for ramp up period. - [WirePath("properties.rampUpMinimumHostsPct")] - public int? RampUpMinimumHostsPct { get; set; } - /// Capacity threshold for ramp up period. - [WirePath("properties.rampUpCapacityThresholdPct")] - public int? RampUpCapacityThresholdPct { get; set; } - /// Starting time for peak period. - [WirePath("properties.peakStartTime")] - public ScalingActionTime PeakStartTime { get; set; } - /// Load balancing algorithm for peak period. - [WirePath("properties.peakLoadBalancingAlgorithm")] - public SessionHostLoadBalancingAlgorithm? PeakLoadBalancingAlgorithm { get; set; } - /// Starting time for ramp down period. - [WirePath("properties.rampDownStartTime")] - public ScalingActionTime RampDownStartTime { get; set; } - /// Load balancing algorithm for ramp down period. - [WirePath("properties.rampDownLoadBalancingAlgorithm")] - public SessionHostLoadBalancingAlgorithm? RampDownLoadBalancingAlgorithm { get; set; } - /// Minimum host percentage for ramp down period. - [WirePath("properties.rampDownMinimumHostsPct")] - public int? RampDownMinimumHostsPct { get; set; } - /// Capacity threshold for ramp down period. - [WirePath("properties.rampDownCapacityThresholdPct")] - public int? RampDownCapacityThresholdPct { get; set; } - /// Should users be logged off forcefully from hosts. - [WirePath("properties.rampDownForceLogoffUsers")] - public bool? RampDownForceLogoffUsers { get; set; } - /// Specifies when to stop hosts during ramp down period. - [WirePath("properties.rampDownStopHostsWhen")] - public DesktopVirtualizationStopHostsWhen? RampDownStopHostsWhen { get; set; } - /// Number of minutes to wait to stop hosts during ramp down period. - [WirePath("properties.rampDownWaitTimeMinutes")] - public int? RampDownWaitTimeMinutes { get; set; } - /// Notification message for users during ramp down period. - [WirePath("properties.rampDownNotificationMessage")] - public string RampDownNotificationMessage { get; set; } - /// Starting time for off-peak period. - [WirePath("properties.offPeakStartTime")] - public ScalingActionTime OffPeakStartTime { get; set; } - /// Load balancing algorithm for off-peak period. - [WirePath("properties.offPeakLoadBalancingAlgorithm")] - public SessionHostLoadBalancingAlgorithm? OffPeakLoadBalancingAlgorithm { get; set; } + /// Detailed properties for ScalingPlanPooledSchedule. + [WirePath("properties")] + public ScalingPlanPooledSchedulePatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.Serialization.cs new file mode 100644 index 000000000000..7ce1f5839435 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.Serialization.cs @@ -0,0 +1,793 @@ +// 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 +{ + public partial class ScalingPlanPooledSchedulePatchProperties : 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(ScalingPlanPooledSchedulePatchProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(DaysOfWeek)) + { + writer.WritePropertyName("daysOfWeek"u8); + writer.WriteStartArray(); + foreach (var item in DaysOfWeek) + { + 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); + writer.WriteObjectValue(RampUpStartTime, options); + } + if (Optional.IsDefined(RampUpLoadBalancingAlgorithm)) + { + writer.WritePropertyName("rampUpLoadBalancingAlgorithm"u8); + writer.WriteStringValue(RampUpLoadBalancingAlgorithm.Value.ToString()); + } + if (Optional.IsDefined(RampUpMinimumHostsPct)) + { + 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); + } + 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); + } + if (Optional.IsDefined(RampDownLoadBalancingAlgorithm)) + { + writer.WritePropertyName("rampDownLoadBalancingAlgorithm"u8); + writer.WriteStringValue(RampDownLoadBalancingAlgorithm.Value.ToString()); + } + if (Optional.IsDefined(RampDownMinimumHostsPct)) + { + writer.WritePropertyName("rampDownMinimumHostsPct"u8); + writer.WriteNumberValue(RampDownMinimumHostsPct.Value); + } + if (Optional.IsDefined(RampDownCapacityThresholdPct)) + { + writer.WritePropertyName("rampDownCapacityThresholdPct"u8); + writer.WriteNumberValue(RampDownCapacityThresholdPct.Value); + } + if (Optional.IsDefined(RampDownForceLogoffUsers)) + { + writer.WritePropertyName("rampDownForceLogoffUsers"u8); + writer.WriteBooleanValue(RampDownForceLogoffUsers.Value); + } + if (Optional.IsDefined(RampDownStopHostsWhen)) + { + writer.WritePropertyName("rampDownStopHostsWhen"u8); + writer.WriteStringValue(RampDownStopHostsWhen.Value.ToString()); + } + if (Optional.IsDefined(RampDownWaitTimeMinutes)) + { + writer.WritePropertyName("rampDownWaitTimeMinutes"u8); + writer.WriteNumberValue(RampDownWaitTimeMinutes.Value); + } + if (Optional.IsDefined(RampDownNotificationMessage)) + { + writer.WritePropertyName("rampDownNotificationMessage"u8); + writer.WriteStringValue(RampDownNotificationMessage); + } + if (Optional.IsDefined(OffPeakStartTime)) + { + writer.WritePropertyName("offPeakStartTime"u8); + writer.WriteObjectValue(OffPeakStartTime, options); + } + if (Optional.IsDefined(OffPeakLoadBalancingAlgorithm)) + { + writer.WritePropertyName("offPeakLoadBalancingAlgorithm"u8); + writer.WriteStringValue(OffPeakLoadBalancingAlgorithm.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 + } + } + } + + ScalingPlanPooledSchedulePatchProperties 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(ScalingPlanPooledSchedulePatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScalingPlanPooledSchedulePatchProperties(document.RootElement, options); + } + + internal static ScalingPlanPooledSchedulePatchProperties DeserializeScalingPlanPooledSchedulePatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IList daysOfWeek = default; + ScalingMethodType? scalingMethod = default; + CreateDeleteProperties createDelete = default; + ScalingActionTime rampUpStartTime = default; + SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; + int? rampUpMinimumHostsPct = default; + int? rampUpCapacityThresholdPct = default; + ScalingActionTime peakStartTime = default; + SessionHostLoadBalancingAlgorithm? peakLoadBalancingAlgorithm = default; + ScalingActionTime rampDownStartTime = default; + SessionHostLoadBalancingAlgorithm? rampDownLoadBalancingAlgorithm = default; + int? rampDownMinimumHostsPct = default; + int? rampDownCapacityThresholdPct = default; + bool? rampDownForceLogoffUsers = default; + DesktopVirtualizationStopHostsWhen? rampDownStopHostsWhen = default; + int? rampDownWaitTimeMinutes = default; + string rampDownNotificationMessage = default; + ScalingActionTime offPeakStartTime = default; + SessionHostLoadBalancingAlgorithm? offPeakLoadBalancingAlgorithm = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("daysOfWeek"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString().ToDesktopVirtualizationDayOfWeek()); + } + daysOfWeek = array; + continue; + } + if (property.NameEquals("scalingMethod"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMethod = new ScalingMethodType(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) + { + continue; + } + rampUpStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("rampUpLoadBalancingAlgorithm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampUpMinimumHostsPct"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpMinimumHostsPct = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampUpCapacityThresholdPct"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampUpCapacityThresholdPct = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("peakStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("peakLoadBalancingAlgorithm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + peakLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("rampDownLoadBalancingAlgorithm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownMinimumHostsPct"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownMinimumHostsPct = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownCapacityThresholdPct"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownCapacityThresholdPct = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownForceLogoffUsers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownForceLogoffUsers = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("rampDownStopHostsWhen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownStopHostsWhen = new DesktopVirtualizationStopHostsWhen(property.Value.GetString()); + continue; + } + if (property.NameEquals("rampDownWaitTimeMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rampDownWaitTimeMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rampDownNotificationMessage"u8)) + { + rampDownNotificationMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("offPeakStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakStartTime = ScalingActionTime.DeserializeScalingActionTime(property.Value, options); + continue; + } + if (property.NameEquals("offPeakLoadBalancingAlgorithm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offPeakLoadBalancingAlgorithm = new SessionHostLoadBalancingAlgorithm(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScalingPlanPooledSchedulePatchProperties( + name, + daysOfWeek ?? new ChangeTrackingList(), + scalingMethod, + createDelete, + rampUpStartTime, + rampUpLoadBalancingAlgorithm, + rampUpMinimumHostsPct, + rampUpCapacityThresholdPct, + peakStartTime, + peakLoadBalancingAlgorithm, + rampDownStartTime, + rampDownLoadBalancingAlgorithm, + rampDownMinimumHostsPct, + rampDownCapacityThresholdPct, + rampDownForceLogoffUsers, + rampDownStopHostsWhen, + rampDownWaitTimeMinutes, + rampDownNotificationMessage, + offPeakStartTime, + offPeakLoadBalancingAlgorithm, + 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(DaysOfWeek), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daysOfWeek: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DaysOfWeek)) + { + if (DaysOfWeek.Any()) + { + builder.Append(" daysOfWeek: "); + builder.AppendLine("["); + foreach (var item in DaysOfWeek) + { + 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) + { + builder.Append(" rampUpStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpStartTime)) + { + builder.Append(" rampUpStartTime: "); + BicepSerializationHelpers.AppendChildObject(builder, RampUpStartTime, options, 2, false, " rampUpStartTime: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpLoadBalancingAlgorithm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampUpLoadBalancingAlgorithm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpLoadBalancingAlgorithm)) + { + builder.Append(" rampUpLoadBalancingAlgorithm: "); + builder.AppendLine($"'{RampUpLoadBalancingAlgorithm.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpMinimumHostsPct), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampUpMinimumHostsPct: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpMinimumHostsPct)) + { + builder.Append(" rampUpMinimumHostsPct: "); + builder.AppendLine($"{RampUpMinimumHostsPct.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampUpCapacityThresholdPct), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampUpCapacityThresholdPct: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampUpCapacityThresholdPct)) + { + builder.Append(" rampUpCapacityThresholdPct: "); + builder.AppendLine($"{RampUpCapacityThresholdPct.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PeakStartTime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" peakStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PeakStartTime)) + { + builder.Append(" peakStartTime: "); + BicepSerializationHelpers.AppendChildObject(builder, PeakStartTime, options, 2, false, " peakStartTime: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PeakLoadBalancingAlgorithm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" peakLoadBalancingAlgorithm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PeakLoadBalancingAlgorithm)) + { + builder.Append(" peakLoadBalancingAlgorithm: "); + builder.AppendLine($"'{PeakLoadBalancingAlgorithm.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownStartTime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownStartTime)) + { + builder.Append(" rampDownStartTime: "); + BicepSerializationHelpers.AppendChildObject(builder, RampDownStartTime, options, 2, false, " rampDownStartTime: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownLoadBalancingAlgorithm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownLoadBalancingAlgorithm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownLoadBalancingAlgorithm)) + { + builder.Append(" rampDownLoadBalancingAlgorithm: "); + builder.AppendLine($"'{RampDownLoadBalancingAlgorithm.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownMinimumHostsPct), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownMinimumHostsPct: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownMinimumHostsPct)) + { + builder.Append(" rampDownMinimumHostsPct: "); + builder.AppendLine($"{RampDownMinimumHostsPct.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownCapacityThresholdPct), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownCapacityThresholdPct: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownCapacityThresholdPct)) + { + builder.Append(" rampDownCapacityThresholdPct: "); + builder.AppendLine($"{RampDownCapacityThresholdPct.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownForceLogoffUsers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownForceLogoffUsers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownForceLogoffUsers)) + { + builder.Append(" rampDownForceLogoffUsers: "); + var boolValue = RampDownForceLogoffUsers.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownStopHostsWhen), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownStopHostsWhen: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownStopHostsWhen)) + { + builder.Append(" rampDownStopHostsWhen: "); + builder.AppendLine($"'{RampDownStopHostsWhen.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownWaitTimeMinutes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownWaitTimeMinutes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownWaitTimeMinutes)) + { + builder.Append(" rampDownWaitTimeMinutes: "); + builder.AppendLine($"{RampDownWaitTimeMinutes.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RampDownNotificationMessage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rampDownNotificationMessage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RampDownNotificationMessage)) + { + builder.Append(" rampDownNotificationMessage: "); + if (RampDownNotificationMessage.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RampDownNotificationMessage}'''"); + } + else + { + builder.AppendLine($"'{RampDownNotificationMessage}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OffPeakStartTime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" offPeakStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OffPeakStartTime)) + { + builder.Append(" offPeakStartTime: "); + BicepSerializationHelpers.AppendChildObject(builder, OffPeakStartTime, options, 2, false, " offPeakStartTime: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OffPeakLoadBalancingAlgorithm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" offPeakLoadBalancingAlgorithm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OffPeakLoadBalancingAlgorithm)) + { + builder.Append(" offPeakLoadBalancingAlgorithm: "); + builder.AppendLine($"'{OffPeakLoadBalancingAlgorithm.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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ScalingPlanPooledSchedulePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + ScalingPlanPooledSchedulePatchProperties 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 DeserializeScalingPlanPooledSchedulePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScalingPlanPooledSchedulePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.cs new file mode 100644 index 000000000000..18e544e262d0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/ScalingPlanPooledSchedulePatchProperties.cs @@ -0,0 +1,162 @@ +// 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 +{ + /// A ScalingPlanPooledSchedule that can be patched. + public partial class ScalingPlanPooledSchedulePatchProperties + { + /// + /// 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 ScalingPlanPooledSchedulePatchProperties() + { + 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. + /// 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. + /// Keeps track of any properties unknown to the library. + internal ScalingPlanPooledSchedulePatchProperties(string name, IList daysOfWeek, ScalingMethodType? 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; + 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; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the ScalingPlanPooledSchedule. + [WirePath("name")] + public string Name { get; } + /// Set of days of the week on which this schedule is active. + [WirePath("daysOfWeek")] + public IList DaysOfWeek { get; } + /// The desired scaling method to be used to scale the hosts in the assigned host pool. + [WirePath("scalingMethod")] + public ScalingMethodType? 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; } + /// Load balancing algorithm for ramp up period. + [WirePath("rampUpLoadBalancingAlgorithm")] + public SessionHostLoadBalancingAlgorithm? RampUpLoadBalancingAlgorithm { get; set; } + /// Minimum host percentage for ramp up period. + [WirePath("rampUpMinimumHostsPct")] + public int? RampUpMinimumHostsPct { get; set; } + /// Capacity threshold for ramp up period. + [WirePath("rampUpCapacityThresholdPct")] + public int? RampUpCapacityThresholdPct { get; set; } + /// Starting time for peak period. + [WirePath("peakStartTime")] + public ScalingActionTime PeakStartTime { get; set; } + /// Load balancing algorithm for peak period. + [WirePath("peakLoadBalancingAlgorithm")] + public SessionHostLoadBalancingAlgorithm? PeakLoadBalancingAlgorithm { get; set; } + /// Starting time for ramp down period. + [WirePath("rampDownStartTime")] + public ScalingActionTime RampDownStartTime { get; set; } + /// Load balancing algorithm for ramp down period. + [WirePath("rampDownLoadBalancingAlgorithm")] + public SessionHostLoadBalancingAlgorithm? RampDownLoadBalancingAlgorithm { get; set; } + /// Minimum host percentage for ramp down period. + [WirePath("rampDownMinimumHostsPct")] + public int? RampDownMinimumHostsPct { get; set; } + /// Capacity threshold for ramp down period. + [WirePath("rampDownCapacityThresholdPct")] + public int? RampDownCapacityThresholdPct { get; set; } + /// Should users be logged off forcefully from hosts. + [WirePath("rampDownForceLogoffUsers")] + public bool? RampDownForceLogoffUsers { get; set; } + /// Specifies when to stop hosts during ramp down period. + [WirePath("rampDownStopHostsWhen")] + public DesktopVirtualizationStopHostsWhen? RampDownStopHostsWhen { get; set; } + /// Number of minutes to wait to stop hosts during ramp down period. + [WirePath("rampDownWaitTimeMinutes")] + public int? RampDownWaitTimeMinutes { get; set; } + /// Notification message for users during ramp down period. + [WirePath("rampDownNotificationMessage")] + public string RampDownNotificationMessage { get; set; } + /// Starting time for off-peak period. + [WirePath("offPeakStartTime")] + public ScalingActionTime OffPeakStartTime { get; set; } + /// Load balancing algorithm for off-peak period. + [WirePath("offPeakLoadBalancingAlgorithm")] + public SessionHostLoadBalancingAlgorithm? OffPeakLoadBalancingAlgorithm { 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 692899d4de3b..2a09c9f121bd 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; + ScalingMethodType? 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 ScalingMethodType(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..d58f474c9fe7 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, ScalingMethodType? 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 ScalingMethodType? 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..b5efbe46d92d --- /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); + 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..9fc800db397c --- /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. 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 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. 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/SecurityInfoProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SecurityInfoProperties.Serialization.cs new file mode 100644 index 000000000000..0aed28a77b35 --- /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); + 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..48f6460bbe8f --- /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/SessionHandlingOperation.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHandlingOperation.cs index 2239a47e0767..f979948fe140 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHandlingOperation.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHandlingOperation.cs @@ -26,11 +26,11 @@ public SessionHandlingOperation(string value) private const string DeallocateValue = "Deallocate"; private const string HibernateValue = "Hibernate"; - /// None. + /// No action will be taken after disconnect. public static SessionHandlingOperation None { get; } = new SessionHandlingOperation(NoneValue); - /// Deallocate. + /// Session Host will be deallocated after disconnect. public static SessionHandlingOperation Deallocate { get; } = new SessionHandlingOperation(DeallocateValue); - /// Hibernate. + /// Session Host will hibernate after disconnect. public static SessionHandlingOperation Hibernate { get; } = new SessionHandlingOperation(HibernateValue); /// Determines if two values are the same. public static bool operator ==(SessionHandlingOperation left, SessionHandlingOperation right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.Serialization.cs index cf52a59ece78..0e93a75a0180 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.Serialization.cs @@ -53,20 +53,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsCollectionDefined(MaintenanceWindows)) { - if (MaintenanceWindows != null) + writer.WritePropertyName("maintenanceWindows"u8); + writer.WriteStartArray(); + foreach (var item in MaintenanceWindows) { - writer.WritePropertyName("maintenanceWindows"u8); - writer.WriteStartArray(); - foreach (var item in MaintenanceWindows) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("maintenanceWindows"); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -140,7 +133,6 @@ internal static SessionHostAgentUpdatePatchProperties DeserializeSessionHostAgen { if (property.Value.ValueKind == JsonValueKind.Null) { - maintenanceWindows = null; continue; } List array = new List(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.cs index 54412ef305f0..ff2bd9182d70 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdatePatchProperties.cs @@ -77,6 +77,6 @@ internal SessionHostAgentUpdatePatchProperties(SessionHostComponentUpdateType? u public string MaintenanceWindowTimeZone { get; set; } /// List of maintenance windows. Maintenance windows are 2 hours long. [WirePath("maintenanceWindows")] - public IList MaintenanceWindows { get; set; } + public IList MaintenanceWindows { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.Serialization.cs index 4357734a2a57..7b5755558117 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.Serialization.cs @@ -53,20 +53,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsCollectionDefined(MaintenanceWindows)) { - if (MaintenanceWindows != null) + writer.WritePropertyName("maintenanceWindows"u8); + writer.WriteStartArray(); + foreach (var item in MaintenanceWindows) { - writer.WritePropertyName("maintenanceWindows"u8); - writer.WriteStartArray(); - foreach (var item in MaintenanceWindows) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("maintenanceWindows"); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -140,7 +133,6 @@ internal static SessionHostAgentUpdateProperties DeserializeSessionHostAgentUpda { if (property.Value.ValueKind == JsonValueKind.Null) { - maintenanceWindows = null; continue; } List array = new List(); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.cs index 71be7ac70ea6..c1d80e5e02b4 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostAgentUpdateProperties.cs @@ -77,6 +77,6 @@ internal SessionHostAgentUpdateProperties(SessionHostComponentUpdateType? update public string MaintenanceWindowTimeZone { get; set; } /// List of maintenance windows. Maintenance windows are 2 hours long. [WirePath("maintenanceWindows")] - public IList MaintenanceWindows { get; set; } + public IList MaintenanceWindows { get; } } } 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..1e4ddfdb5254 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.Serialization.cs @@ -0,0 +1,208 @@ +// 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."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.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 + } + } + } + + 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; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + 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)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationList(value, 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: "); + builder.AppendLine($"'{NextLink.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); + 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..9aec46c68a03 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationList.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +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 . + /// The SessionHostConfiguration items on this page. + /// is null. + internal SessionHostConfigurationList(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SessionHostConfiguration items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SessionHostConfigurationList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostConfigurationList() + { + } + + /// The SessionHostConfiguration items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri 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..b32d3d3c2ba7 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.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 +{ + 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."); + } + + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + 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; + } + SessionHostConfigurationPatchProperties properties = 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) + { + continue; + } + properties = SessionHostConfigurationPatchProperties.DeserializeSessionHostConfigurationPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationPatch(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(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..a109cc7774cd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatch.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 +{ + /// SessionHostConfiguration properties that can be patched. + 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() + { + } + + /// Initializes a new instance of . + /// Detailed properties for SessionHostConfiguration. + /// Keeps track of any properties unknown to the library. + internal SessionHostConfigurationPatch(SessionHostConfigurationPatchProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Detailed properties for SessionHostConfiguration. + [WirePath("properties")] + public SessionHostConfigurationPatchProperties Properties { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.Serialization.cs new file mode 100644 index 000000000000..d67b640f4113 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.Serialization.cs @@ -0,0 +1,360 @@ +// 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 SessionHostConfigurationPatchProperties : 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(SessionHostConfigurationPatchProperties)} does not support writing '{format}' format."); + } + + 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); + } + 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 + } + } + } + + SessionHostConfigurationPatchProperties 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(SessionHostConfigurationPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostConfigurationPatchProperties(document.RootElement, options); + } + + internal static SessionHostConfigurationPatchProperties DeserializeSessionHostConfigurationPatchProperties(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; + DiskInfoPatchProperties 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("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmTags"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()); + } + vmTags = dictionary; + continue; + } + if (property.NameEquals("vmLocation"u8)) + { + vmLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmResourceGroup"u8)) + { + vmResourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmNamePrefix"u8)) + { + vmNamePrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("availabilityZones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + availabilityZones = array; + continue; + } + if (property.NameEquals("networkInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkInfo = NetworkInfoPatchProperties.DeserializeNetworkInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("vmSizeId"u8)) + { + vmSizeId = property.Value.GetString(); + continue; + } + if (property.NameEquals("diskInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskInfo = DiskInfoPatchProperties.DeserializeDiskInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("customConfigurationScriptUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customConfigurationScriptUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("imageInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageInfo = ImageInfoPatchProperties.DeserializeImageInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("domainInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainInfo = DomainInfoPatchProperties.DeserializeDomainInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("securityInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityInfo = SecurityInfoPatchProperties.DeserializeSecurityInfoPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("vmAdminCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmAdminCredentials = KeyVaultCredentialsPatchProperties.DeserializeKeyVaultCredentialsPatchProperties(property.Value, options); + continue; + } + if (property.NameEquals("bootDiagnosticsInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bootDiagnosticsInfo = BootDiagnosticsInfoPatchProperties.DeserializeBootDiagnosticsInfoPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostConfigurationPatchProperties( + 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); + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostConfigurationPatchProperties 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 DeserializeSessionHostConfigurationPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostConfigurationPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.cs new file mode 100644 index 000000000000..0a72c6397c9d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostConfigurationPatchProperties.cs @@ -0,0 +1,162 @@ +// 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 +{ + /// Session host configurations of HostPool. + public partial class SessionHostConfigurationPatchProperties + { + /// + /// 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 SessionHostConfigurationPatchProperties() + { + 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. 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 SessionHostConfigurationPatchProperties(string friendlyName, IDictionary vmTags, string vmLocation, string vmResourceGroup, string vmNamePrefix, IList availabilityZones, NetworkInfoPatchProperties networkInfo, string vmSizeId, DiskInfoPatchProperties 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("friendlyName")] + public string FriendlyName { get; set; } + /// Hashtable that lists key/value pair tags to apply to the VMs. + [WirePath("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("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("vmResourceGroup")] + public string VmResourceGroup { get; set; } + /// The prefix that should be associated with session host names. + [WirePath("vmNamePrefix")] + public string VmNamePrefix { get; set; } + /// Value for availability zones to be used by the session host. Should be from [1,2,3]. + [WirePath("availabilityZones")] + public IList AvailabilityZones { get; } + /// Network information. + [WirePath("networkInfo")] + public NetworkInfoPatchProperties NetworkInfo { get; set; } + /// The id of the size of a virtual machine connected to a hostpool. Example: Standard_D2as_v6. + [WirePath("vmSizeId")] + public string VmSizeId { get; set; } + /// Disk Information. + internal DiskInfoPatchProperties DiskInfo { get; set; } + /// The disk type used by virtual machine in hostpool session host. + [WirePath("diskInfo.type")] + public VirtualMachineDiskType? VirtualMachineDiskType + { + get => DiskInfo is null ? default : DiskInfo.VirtualMachineDiskType; + set + { + if (DiskInfo is null) + DiskInfo = new DiskInfoPatchProperties(); + DiskInfo.VirtualMachineDiskType = value; + } + } + + /// The uri to the storage blob containing the arm template to be run on the virtual machine after provisioning. + [WirePath("customConfigurationScriptUrl")] + public Uri CustomConfigurationScriptUri { get; set; } + /// Image configurations of HostPool. + [WirePath("imageInfo")] + public ImageInfoPatchProperties ImageInfo { get; set; } + /// Domain configurations of session hosts. + internal DomainInfoPatchProperties DomainInfo { get; set; } + /// Credentials needed to create the virtual machine. + [WirePath("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("securityInfo")] + public SecurityInfoPatchProperties SecurityInfo { get; set; } + /// Local Admin credentials for session hosts.". + [WirePath("vmAdminCredentials")] + public KeyVaultCredentialsPatchProperties VmAdminCredentials { get; set; } + /// Boot Diagnostics Information. + [WirePath("bootDiagnosticsInfo")] + public BootDiagnosticsInfoPatchProperties BootDiagnosticsInfo { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostHealthCheckName.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostHealthCheckName.cs index a78600f80f6a..3eff719a2daf 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostHealthCheckName.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostHealthCheckName.cs @@ -54,7 +54,7 @@ public SessionHostHealthCheckName(string value) public static SessionHostHealthCheckName SupportedEncryptionCheck { get; } = new SessionHostHealthCheckName(SupportedEncryptionCheckValue); /// Verifies the metadata service is accessible and return compute properties. (Currently Enabled). public static SessionHostHealthCheckName MetaDataServiceCheck { get; } = new SessionHostHealthCheckName(MetaDataServiceCheckValue); - /// Verifies that the AppAttachService is healthy (there were no issues during package staging). The AppAttachService is used to enable the staging/registration (and eventual deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks whether the component had any failures during package staging. Failures in staging will prevent some MSIX apps from working properly for the end user. If this check fails, it is non fatal and the machine still can service connections, main issue may be certain apps will not work for end-users. (Currently Enabled). + /// Verifies that the AppAttachService is healthy (there were no issues during package staging). The AppAttachService is used to enable the staging/registration (and eventual de-registration/destaging) of MSIX apps that have been set up by the tenant admin. This checks whether the component had any failures during package staging. Failures in staging will prevent some MSIX apps from working properly for the end user. If this check fails, it is non fatal and the machine still can service connections, main issue may be certain apps will not work for end-users. (Currently Enabled). public static SessionHostHealthCheckName AppAttachHealthCheck { get; } = new SessionHostHealthCheckName(AppAttachHealthCheckValue); /// Determines if two values are the same. public static bool operator ==(SessionHostHealthCheckName left, SessionHostHealthCheckName right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.Serialization.cs index 11ce8ef7ea9b..b6577052a793 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(SessionHostList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static SessionHostList DeserializeSessionHostList(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static SessionHostList DeserializeSessionHostList(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static SessionHostList DeserializeSessionHostList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new SessionHostList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SessionHostList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.cs index 004a3a5c893c..1d857d4b5ee5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class SessionHostList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal SessionHostList() + /// The SessionHost items on this page. + /// is null. + internal SessionHostList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of SessionHost definitions. - /// Link to the next page of results. + /// The SessionHost items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal SessionHostList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal SessionHostList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of SessionHost definitions. + /// Initializes a new instance of for deserialization. + internal SessionHostList() + { + } + + /// The SessionHost items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostLoadBalancingAlgorithm.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostLoadBalancingAlgorithm.cs index 659e86658cbd..40d16c416707 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostLoadBalancingAlgorithm.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostLoadBalancingAlgorithm.cs @@ -25,9 +25,9 @@ public SessionHostLoadBalancingAlgorithm(string value) private const string BreadthFirstValue = "BreadthFirst"; private const string DepthFirstValue = "DepthFirst"; - /// BreadthFirst. + /// Breadth First Algorithm for Load Balancing. public static SessionHostLoadBalancingAlgorithm BreadthFirst { get; } = new SessionHostLoadBalancingAlgorithm(BreadthFirstValue); - /// DepthFirst. + /// Depth First Algorithm for Load Balancing. public static SessionHostLoadBalancingAlgorithm DepthFirst { get; } = new SessionHostLoadBalancingAlgorithm(DepthFirstValue); /// Determines if two values are the same. public static bool operator ==(SessionHostLoadBalancingAlgorithm left, SessionHostLoadBalancingAlgorithm right) => left.Equals(right); 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..3a13cda4b3a1 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.Serialization.cs @@ -0,0 +1,208 @@ +// 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."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.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 + } + } + } + + 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; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + 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)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementList(value, 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: "); + builder.AppendLine($"'{NextLink.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); + 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..4949c9be5412 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementList.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +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 . + /// The SessionHostManagement items on this page. + /// is null. + internal SessionHostManagementList(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SessionHostManagement items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostManagementList() + { + } + + /// The SessionHostManagement items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri 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..4464b0049336 --- /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); + 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..18aa62a4c1fd --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.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 +{ + 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."); + } + + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + 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; + } + SessionHostManagementPatchProperties properties = 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) + { + continue; + } + properties = SessionHostManagementPatchProperties.DeserializeSessionHostManagementPatchProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementPatch(properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(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..591c7fdd9452 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatch.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 +{ + /// SessionHostManagement properties that can be patched. + 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 . + /// Detailed properties for SessionHostManagement. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementPatch(SessionHostManagementPatchProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Detailed properties for SessionHostManagement. + [WirePath("properties")] + public SessionHostManagementPatchProperties Properties { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.Serialization.cs new file mode 100644 index 000000000000..9363a1911e80 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.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 SessionHostManagementPatchProperties : 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(SessionHostManagementPatchProperties)} does not support writing '{format}' format."); + } + + 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 + } + } + } + + SessionHostManagementPatchProperties 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(SessionHostManagementPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementPatchProperties(document.RootElement, options); + } + + internal static SessionHostManagementPatchProperties DeserializeSessionHostManagementPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string scheduledDateTimeZone = default; + HostPoolUpdateConfigurationPatchProperties update = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + 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 SessionHostManagementPatchProperties(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); + default: + throw new FormatException($"The model {nameof(SessionHostManagementPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementPatchProperties 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 DeserializeSessionHostManagementPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.cs new file mode 100644 index 000000000000..9b8026f778ff --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementPatchProperties.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 SessionHostManagementPatch definition. + public partial class SessionHostManagementPatchProperties + { + /// + /// 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 SessionHostManagementPatchProperties() + { + } + + /// 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. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementPatchProperties(string scheduledDateTimeZone, HostPoolUpdateConfigurationPatchProperties update, IDictionary serializedAdditionalRawData) + { + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + _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("scheduledDateTimeZone")] + public string ScheduledDateTimeZone { get; set; } + /// Parameters for a hostpool update. + [WirePath("update")] + public HostPoolUpdateConfigurationPatchProperties Update { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateOperationStatus.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateOperationStatus.cs new file mode 100644 index 000000000000..9f11c334661e --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateOperationStatus.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Operation status for SessionHostManagementUpdate. + public readonly partial struct SessionHostManagementUpdateOperationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SessionHostManagementUpdateOperationStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ErrorValue = "Error"; + private const string ScheduledValue = "Scheduled"; + private const string UpdatingSessionHostsValue = "UpdatingSessionHosts"; + private const string ValidatingSessionHostUpdateValue = "ValidatingSessionHostUpdate"; + private const string PausedValue = "Paused"; + private const string PausingValue = "Pausing"; + private const string CancellingValue = "Cancelling"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + + /// The operation has an error. + public static SessionHostManagementUpdateOperationStatus Error { get; } = new SessionHostManagementUpdateOperationStatus(ErrorValue); + /// The operation is scheduled. + public static SessionHostManagementUpdateOperationStatus Scheduled { get; } = new SessionHostManagementUpdateOperationStatus(ScheduledValue); + /// The operation is currently updating Session Hosts. + public static SessionHostManagementUpdateOperationStatus UpdatingSessionHosts { get; } = new SessionHostManagementUpdateOperationStatus(UpdatingSessionHostsValue); + /// The operation is validating the update. + public static SessionHostManagementUpdateOperationStatus ValidatingSessionHostUpdate { get; } = new SessionHostManagementUpdateOperationStatus(ValidatingSessionHostUpdateValue); + /// The operation is paused. + public static SessionHostManagementUpdateOperationStatus Paused { get; } = new SessionHostManagementUpdateOperationStatus(PausedValue); + /// The operation is pausing. + public static SessionHostManagementUpdateOperationStatus Pausing { get; } = new SessionHostManagementUpdateOperationStatus(PausingValue); + /// Canceling the operation. + public static SessionHostManagementUpdateOperationStatus Cancelling { get; } = new SessionHostManagementUpdateOperationStatus(CancellingValue); + /// The operation succeeded. + public static SessionHostManagementUpdateOperationStatus Succeeded { get; } = new SessionHostManagementUpdateOperationStatus(SucceededValue); + /// The operation failed. + public static SessionHostManagementUpdateOperationStatus Failed { get; } = new SessionHostManagementUpdateOperationStatus(FailedValue); + /// The operation is canceled. + public static SessionHostManagementUpdateOperationStatus Cancelled { get; } = new SessionHostManagementUpdateOperationStatus(CancelledValue); + /// Determines if two values are the same. + public static bool operator ==(SessionHostManagementUpdateOperationStatus left, SessionHostManagementUpdateOperationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SessionHostManagementUpdateOperationStatus left, SessionHostManagementUpdateOperationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SessionHostManagementUpdateOperationStatus(string value) => new SessionHostManagementUpdateOperationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SessionHostManagementUpdateOperationStatus other && Equals(other); + /// + public bool Equals(SessionHostManagementUpdateOperationStatus 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/SessionHostManagementUpdateStatus.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.Serialization.cs new file mode 100644 index 000000000000..a037775cde05 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.Serialization.cs @@ -0,0 +1,384 @@ +// 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); + } + 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); + } + if (options.Format != "W") + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + 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; + } + ResourceIdentifier id = default; + string name = default; + double? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + ResponseError error = default; + SessionHostManagementUpdateOperationStatus status = default; + SessionHostManagementUpdateStatusProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetDouble(); + 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("status"u8)) + { + status = new SessionHostManagementUpdateOperationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SessionHostManagementUpdateStatusProperties.DeserializeSessionHostManagementUpdateStatusProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementUpdateStatus( + id, + name, + percentComplete, + startTime, + endTime, + error, + status, + properties, + 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: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + 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(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: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" status: "); + builder.AppendLine($"'{Status.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + 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); + 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..3510d165d972 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatus.cs @@ -0,0 +1,109 @@ +// 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 +{ + /// Schema for SessionHostManagementUpdateStatus properties. + 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. + internal SessionHostManagementUpdateStatus(SessionHostManagementUpdateOperationStatus status) + { + Status = status; + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// 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. + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + /// Properties bag to hold custom RP properties for sessionHostManagement Update Statuses. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementUpdateStatus(ResourceIdentifier id, string name, double? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, ResponseError error, SessionHostManagementUpdateOperationStatus status, SessionHostManagementUpdateStatusProperties properties, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Error = error; + Status = status; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SessionHostManagementUpdateStatus() + { + } + + /// Fully qualified ID for the async operation. + [WirePath("id")] + public ResourceIdentifier Id { get; } + /// Name of the async operation. + [WirePath("name")] + public string Name { get; } + /// Percent of the operation that is complete. + [WirePath("percentComplete")] + public double? 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; } + /// Operation status. Current defined values are < Error | Scheduled | UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | Succeeded | Failed | Canceled. + [WirePath("status")] + public SessionHostManagementUpdateOperationStatus Status { get; } + /// Properties bag to hold custom RP properties for sessionHostManagement Update Statuses. + [WirePath("properties")] + public SessionHostManagementUpdateStatusProperties Properties { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.Serialization.cs new file mode 100644 index 000000000000..f1a717a13263 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.Serialization.cs @@ -0,0 +1,261 @@ +// 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 SessionHostManagementUpdateStatusProperties : 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(SessionHostManagementUpdateStatusProperties)} does not support writing '{format}' format."); + } + + 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); + } + 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 + } + } + } + + SessionHostManagementUpdateStatusProperties 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(SessionHostManagementUpdateStatusProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostManagementUpdateStatusProperties(document.RootElement, options); + } + + internal static SessionHostManagementUpdateStatusProperties DeserializeSessionHostManagementUpdateStatusProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + 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("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("progress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + progress = SessionHostManagementOperationProgress.DeserializeSessionHostManagementOperationProgress(property.Value, options); + continue; + } + if (property.NameEquals("scheduledDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scheduledDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("sessionHostManagement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionHostManagement = SessionHostManagementData.DeserializeSessionHostManagementData(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostManagementUpdateStatusProperties(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(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, 2, 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, 2, false, " sessionHostManagement: "); + } + } + + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostManagementUpdateStatusProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostManagementUpdateStatusProperties 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 DeserializeSessionHostManagementUpdateStatusProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostManagementUpdateStatusProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.cs new file mode 100644 index 000000000000..b8210c139f2c --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostManagementUpdateStatusProperties.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 current status of the session host update async operation. + public partial class SessionHostManagementUpdateStatusProperties + { + /// + /// 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 SessionHostManagementUpdateStatusProperties() + { + } + + /// Initializes a new instance of . + /// The 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 SessionHostManagementUpdateStatusProperties(string correlationId, SessionHostManagementOperationProgress progress, DateTimeOffset? scheduledOn, SessionHostManagementData sessionHostManagement, IDictionary serializedAdditionalRawData) + { + CorrelationId = correlationId; + Progress = progress; + ScheduledOn = scheduledOn; + SessionHostManagement = sessionHostManagement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Log Analytics. + [WirePath("correlationId")] + public string CorrelationId { get; } + /// Progress information on the sessionHostManagement operation. + [WirePath("progress")] + public SessionHostManagementOperationProgress Progress { get; } + /// The timestamp that the update is scheduled for. + [WirePath("scheduledDateTime")] + public DateTimeOffset? ScheduledOn { get; } + /// SessionHostManagement properties used for the operation. + [WirePath("sessionHostManagement")] + public SessionHostManagementData SessionHostManagement { get; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.Serialization.cs index 1a121fd0e5da..f01941c9ac48 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.Serialization.cs @@ -37,24 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(AllowNewSession)) - { - writer.WritePropertyName("allowNewSession"u8); - writer.WriteBooleanValue(AllowNewSession.Value); - } - if (Optional.IsDefined(AssignedUser)) - { - writer.WritePropertyName("assignedUser"u8); - writer.WriteStringValue(AssignedUser); - } - if (Optional.IsDefined(FriendlyName)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } SessionHostPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -77,17 +64,24 @@ internal static SessionHostPatch DeserializeSessionHostPatch(JsonElement element { return null; } + SessionHostPatchProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - bool? allowNewSession = default; - string assignedUser = default; - string friendlyName = 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) + { + continue; + } + properties = SessionHostPatchProperties.DeserializeSessionHostPatchProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -112,37 +106,6 @@ internal static SessionHostPatch DeserializeSessionHostPatch(JsonElement element 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("allowNewSession"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allowNewSession = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("assignedUser"u8)) - { - assignedUser = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -154,9 +117,7 @@ internal static SessionHostPatch DeserializeSessionHostPatch(JsonElement element name, type, systemData, - allowNewSession, - assignedUser, - friendlyName, + properties, serializedAdditionalRawData); } @@ -194,101 +155,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Properties)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowNewSession), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" allowNewSession: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AllowNewSession)) - { - builder.Append(" allowNewSession: "); - var boolValue = AllowNewSession.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignedUser), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" assignedUser: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(AssignedUser)) + if (Optional.IsDefined(Id)) { - builder.Append(" assignedUser: "); - if (AssignedUser.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AssignedUser}'''"); - } - else - { - builder.AppendLine($"'{AssignedUser}'"); - } + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FriendlyName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" friendlyName: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(FriendlyName)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" friendlyName: "); - if (FriendlyName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{FriendlyName}'''"); - } - else - { - builder.AppendLine($"'{FriendlyName}'"); - } + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.cs index 6df4adf0d782..8ca4c02f1b44 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatch.cs @@ -57,26 +57,16 @@ public SessionHostPatch() /// The name. /// The resourceType. /// The systemData. - /// Allow a new session. - /// User assigned to SessionHost. - /// Friendly name of SessionHost. + /// Detailed properties for SessionHost. /// Keeps track of any properties unknown to the library. - internal SessionHostPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? allowNewSession, string assignedUser, string friendlyName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal SessionHostPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SessionHostPatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - AllowNewSession = allowNewSession; - AssignedUser = assignedUser; - FriendlyName = friendlyName; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Allow a new session. - [WirePath("properties.allowNewSession")] - public bool? AllowNewSession { get; set; } - /// User assigned to SessionHost. - [WirePath("properties.assignedUser")] - public string AssignedUser { get; set; } - /// Friendly name of SessionHost. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } + /// Detailed properties for SessionHost. + [WirePath("properties")] + public SessionHostPatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.Serialization.cs new file mode 100644 index 000000000000..5bf8e0161743 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.Serialization.cs @@ -0,0 +1,235 @@ +// 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 SessionHostPatchProperties : 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(SessionHostPatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AllowNewSession)) + { + writer.WritePropertyName("allowNewSession"u8); + writer.WriteBooleanValue(AllowNewSession.Value); + } + if (Optional.IsDefined(AssignedUser)) + { + writer.WritePropertyName("assignedUser"u8); + writer.WriteStringValue(AssignedUser); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + 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 + } + } + } + + SessionHostPatchProperties 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(SessionHostPatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSessionHostPatchProperties(document.RootElement, options); + } + + internal static SessionHostPatchProperties DeserializeSessionHostPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? allowNewSession = default; + string assignedUser = default; + string friendlyName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowNewSession"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowNewSession = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("assignedUser"u8)) + { + assignedUser = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SessionHostPatchProperties(allowNewSession, assignedUser, friendlyName, 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(AllowNewSession), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowNewSession: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AllowNewSession)) + { + builder.Append(" allowNewSession: "); + var boolValue = AllowNewSession.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignedUser), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignedUser: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AssignedUser)) + { + builder.Append(" assignedUser: "); + if (AssignedUser.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AssignedUser}'''"); + } + else + { + builder.AppendLine($"'{AssignedUser}'"); + } + } + } + + 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}'"); + } + } + } + + 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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SessionHostPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + SessionHostPatchProperties 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 DeserializeSessionHostPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SessionHostPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.cs new file mode 100644 index 000000000000..ac7d2c86a635 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostPatchProperties.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 +{ + /// SessionHost properties that can be patched. + public partial class SessionHostPatchProperties + { + /// + /// 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 SessionHostPatchProperties() + { + } + + /// Initializes a new instance of . + /// Allow a new session. + /// User assigned to SessionHost. + /// Friendly name of SessionHost. + /// Keeps track of any properties unknown to the library. + internal SessionHostPatchProperties(bool? allowNewSession, string assignedUser, string friendlyName, IDictionary serializedAdditionalRawData) + { + AllowNewSession = allowNewSession; + AssignedUser = assignedUser; + FriendlyName = friendlyName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Allow a new session. + [WirePath("allowNewSession")] + public bool? AllowNewSession { get; set; } + /// User assigned to SessionHost. + [WirePath("assignedUser")] + public string AssignedUser { get; set; } + /// Friendly name of SessionHost. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostUpdateState.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostUpdateState.cs index ce71b5bfdcc1..728d649eb6fe 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostUpdateState.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SessionHostUpdateState.cs @@ -28,15 +28,15 @@ public SessionHostUpdateState(string value) private const string SucceededValue = "Succeeded"; private const string FailedValue = "Failed"; - /// Initial. + /// Update is initializing. public static SessionHostUpdateState Initial { get; } = new SessionHostUpdateState(InitialValue); - /// Pending. + /// Update is pending. public static SessionHostUpdateState Pending { get; } = new SessionHostUpdateState(PendingValue); - /// Started. + /// Update has started. public static SessionHostUpdateState Started { get; } = new SessionHostUpdateState(StartedValue); - /// Succeeded. + /// Update has succeeded. public static SessionHostUpdateState Succeeded { get; } = new SessionHostUpdateState(SucceededValue); - /// Failed. + /// Update has failed. public static SessionHostUpdateState Failed { get; } = new SessionHostUpdateState(FailedValue); /// Determines if two values are the same. public static bool operator ==(SessionHostUpdateState left, SessionHostUpdateState right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SetStartVmOnConnect.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SetStartVmOnConnect.cs index 8a1859ddcc04..056cf5cfebf9 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SetStartVmOnConnect.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/SetStartVmOnConnect.cs @@ -25,9 +25,9 @@ public SetStartVmOnConnect(string value) private const string EnableValue = "Enable"; private const string DisableValue = "Disable"; - /// Enable. + /// Start VM on Connect is enabled. public static SetStartVmOnConnect Enable { get; } = new SetStartVmOnConnect(EnableValue); - /// Disable. + /// Start VM on Connect is disabled, must use rampUpAutoStartHosts or turn on manually. public static SetStartVmOnConnect Disable { get; } = new SetStartVmOnConnect(DisableValue); /// Determines if two values are the same. public static bool operator ==(SetStartVmOnConnect left, SetStartVmOnConnect right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.Serialization.cs index 8c0946619574..0944f18cf90b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(StartMenuItemList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static StartMenuItemList DeserializeStartMenuItemList(JsonElement eleme return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static StartMenuItemList DeserializeStartMenuItemList(JsonElement eleme } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static StartMenuItemList DeserializeStartMenuItemList(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new StartMenuItemList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new StartMenuItemList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.cs index bae8033cd47b..ad5a49719d6a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class StartMenuItemList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal StartMenuItemList() + /// The StartMenuItem items on this page. + /// is null. + internal StartMenuItemList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of StartMenuItem definitions. - /// Link to the next page of results. + /// The StartMenuItem items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal StartMenuItemList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal StartMenuItemList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of StartMenuItem definitions. + /// Initializes a new instance of for deserialization. + internal StartMenuItemList() + { + } + + /// The StartMenuItem items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.Serialization.cs new file mode 100644 index 000000000000..1473da983734 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.Serialization.cs @@ -0,0 +1,308 @@ +// 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 StartMenuItemProperties : 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(StartMenuItemProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AppAlias)) + { + writer.WritePropertyName("appAlias"u8); + writer.WriteStringValue(AppAlias); + } + if (Optional.IsDefined(FilePath)) + { + writer.WritePropertyName("filePath"u8); + writer.WriteStringValue(FilePath); + } + if (Optional.IsDefined(CommandLineArguments)) + { + writer.WritePropertyName("commandLineArguments"u8); + writer.WriteStringValue(CommandLineArguments); + } + if (Optional.IsDefined(IconPath)) + { + writer.WritePropertyName("iconPath"u8); + writer.WriteStringValue(IconPath); + } + if (Optional.IsDefined(IconIndex)) + { + writer.WritePropertyName("iconIndex"u8); + writer.WriteNumberValue(IconIndex.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 + } + } + } + + StartMenuItemProperties 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(StartMenuItemProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStartMenuItemProperties(document.RootElement, options); + } + + internal static StartMenuItemProperties DeserializeStartMenuItemProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string appAlias = default; + string filePath = default; + string commandLineArguments = default; + string iconPath = default; + int? iconIndex = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("appAlias"u8)) + { + appAlias = property.Value.GetString(); + continue; + } + if (property.NameEquals("filePath"u8)) + { + filePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("commandLineArguments"u8)) + { + commandLineArguments = property.Value.GetString(); + continue; + } + if (property.NameEquals("iconPath"u8)) + { + iconPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("iconIndex"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + iconIndex = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StartMenuItemProperties( + appAlias, + filePath, + commandLineArguments, + iconPath, + iconIndex, + 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(AppAlias), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appAlias: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppAlias)) + { + builder.Append(" appAlias: "); + if (AppAlias.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AppAlias}'''"); + } + else + { + builder.AppendLine($"'{AppAlias}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FilePath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" filePath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FilePath)) + { + builder.Append(" filePath: "); + if (FilePath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FilePath}'''"); + } + else + { + builder.AppendLine($"'{FilePath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CommandLineArguments), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" commandLineArguments: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CommandLineArguments)) + { + builder.Append(" commandLineArguments: "); + if (CommandLineArguments.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CommandLineArguments}'''"); + } + else + { + builder.AppendLine($"'{CommandLineArguments}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IconPath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" iconPath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IconPath)) + { + builder.Append(" iconPath: "); + if (IconPath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IconPath}'''"); + } + else + { + builder.AppendLine($"'{IconPath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IconIndex), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" iconIndex: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IconIndex)) + { + builder.Append(" iconIndex: "); + builder.AppendLine($"{IconIndex.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); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StartMenuItemProperties)} does not support writing '{options.Format}' format."); + } + } + + StartMenuItemProperties 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 DeserializeStartMenuItemProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StartMenuItemProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.cs new file mode 100644 index 000000000000..7c6d86805028 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/StartMenuItemProperties.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 +{ + /// Schema for StartMenuItem properties. + public partial class StartMenuItemProperties + { + /// + /// 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 StartMenuItemProperties() + { + } + + /// Initializes a new instance of . + /// Alias of StartMenuItem. + /// Path to the file of StartMenuItem. + /// Command line arguments for StartMenuItem. + /// Path to the icon. + /// Index of the icon. + /// Keeps track of any properties unknown to the library. + internal StartMenuItemProperties(string appAlias, string filePath, string commandLineArguments, string iconPath, int? iconIndex, IDictionary serializedAdditionalRawData) + { + AppAlias = appAlias; + FilePath = filePath; + CommandLineArguments = commandLineArguments; + IconPath = iconPath; + IconIndex = iconIndex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Alias of StartMenuItem. + [WirePath("appAlias")] + public string AppAlias { get; set; } + /// Path to the file of StartMenuItem. + [WirePath("filePath")] + public string FilePath { get; set; } + /// Command line arguments for StartMenuItem. + [WirePath("commandLineArguments")] + public string CommandLineArguments { get; set; } + /// Path to the icon. + [WirePath("iconPath")] + public string IconPath { get; set; } + /// Index of the icon. + [WirePath("iconIndex")] + public int? IconIndex { 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..e3236e11665f --- /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); + 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/UserSessionList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.Serialization.cs index feac12aa7989..c989bba67850 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(UserSessionList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static UserSessionList DeserializeUserSessionList(JsonElement element, return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static UserSessionList DeserializeUserSessionList(JsonElement element, } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static UserSessionList DeserializeUserSessionList(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new UserSessionList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new UserSessionList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.cs index 94b9d27a4025..9f4160f0ffb4 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class UserSessionList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal UserSessionList() + /// The UserSession items on this page. + /// is null. + internal UserSessionList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of UserSession definitions. - /// Link to the next page of results. + /// The UserSession items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal UserSessionList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal UserSessionList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of UserSession definitions. + /// Initializes a new instance of for deserialization. + internal UserSessionList() + { + } + + /// The UserSession items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionState.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionState.cs index e8c1f2c7f1e9..5edbd38e128d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionState.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/UserSessionState.cs @@ -29,17 +29,17 @@ public UserSessionState(string value) private const string LogOffValue = "LogOff"; private const string UserProfileDiskMountedValue = "UserProfileDiskMounted"; - /// Unknown. + /// SessionState is unknown. public static UserSessionState Unknown { get; } = new UserSessionState(UnknownValue); - /// Active. + /// Session is active. public static UserSessionState Active { get; } = new UserSessionState(ActiveValue); - /// Disconnected. + /// Session is disconnected. public static UserSessionState Disconnected { get; } = new UserSessionState(DisconnectedValue); - /// Pending. + /// Session is pending connection. public static UserSessionState Pending { get; } = new UserSessionState(PendingValue); - /// LogOff. + /// Session is logging off. public static UserSessionState LogOff { get; } = new UserSessionState(LogOffValue); - /// UserProfileDiskMounted. + /// Session has mounted user profile disk. public static UserSessionState UserProfileDiskMounted { get; } = new UserSessionState(UserProfileDiskMountedValue); /// Determines if two values are the same. public static bool operator ==(UserSessionState left, UserSessionState right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationCommandLineSetting.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationCommandLineSetting.cs index d8e024068f7d..d7919f604e45 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationCommandLineSetting.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationCommandLineSetting.cs @@ -26,11 +26,11 @@ public VirtualApplicationCommandLineSetting(string value) private const string AllowValue = "Allow"; private const string RequireValue = "Require"; - /// DoNotAllow. + /// Cannot be launched with command line arguments. public static VirtualApplicationCommandLineSetting DoNotAllow { get; } = new VirtualApplicationCommandLineSetting(DoNotAllowValue); - /// Allow. + /// Can optionally be launched with command line arguments. public static VirtualApplicationCommandLineSetting Allow { get; } = new VirtualApplicationCommandLineSetting(AllowValue); - /// Require. + /// Required to be launched with command line arguments. public static VirtualApplicationCommandLineSetting Require { get; } = new VirtualApplicationCommandLineSetting(RequireValue); /// Determines if two values are the same. public static bool operator ==(VirtualApplicationCommandLineSetting left, VirtualApplicationCommandLineSetting right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.Serialization.cs index 76abe8ae6897..f889bcab797e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.Serialization.cs @@ -40,40 +40,20 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); if (Optional.IsCollectionDefined(Tags)) { - if (Tags != null) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); } + writer.WriteEndObject(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - if (Optional.IsDefined(ShowInFeed)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("showInFeed"u8); - writer.WriteBooleanValue(ShowInFeed.Value); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } VirtualApplicationGroupPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -97,13 +77,11 @@ internal static VirtualApplicationGroupPatch DeserializeVirtualApplicationGroupP return null; } IDictionary tags = default; + ApplicationGroupPatchProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string description = default; - string friendlyName = default; - bool? showInFeed = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -112,7 +90,6 @@ internal static VirtualApplicationGroupPatch DeserializeVirtualApplicationGroupP { if (property.Value.ValueKind == JsonValueKind.Null) { - tags = null; continue; } Dictionary dictionary = new Dictionary(); @@ -123,6 +100,15 @@ internal static VirtualApplicationGroupPatch DeserializeVirtualApplicationGroupP tags = dictionary; continue; } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ApplicationGroupPatchProperties.DeserializeApplicationGroupPatchProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -147,37 +133,6 @@ internal static VirtualApplicationGroupPatch DeserializeVirtualApplicationGroupP 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("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("showInFeed"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - showInFeed = property0.Value.GetBoolean(); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -190,9 +145,7 @@ internal static VirtualApplicationGroupPatch DeserializeVirtualApplicationGroupP type, systemData, tags ?? new ChangeTrackingDictionary(), - description, - friendlyName, - showInFeed, + properties, serializedAdditionalRawData); } @@ -267,101 +220,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - 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); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" systemData: "); + builder.Append(" properties: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SystemData)) + if (Optional.IsDefined(Properties)) { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); } } - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FriendlyName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" friendlyName: "); + builder.Append(" id: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(FriendlyName)) + if (Optional.IsDefined(Id)) { - builder.Append(" friendlyName: "); - if (FriendlyName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{FriendlyName}'''"); - } - else - { - builder.AppendLine($"'{FriendlyName}'"); - } + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ShowInFeed), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" showInFeed: "); + builder.Append(" systemData: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ShowInFeed)) + if (Optional.IsDefined(SystemData)) { - builder.Append(" showInFeed: "); - var boolValue = ShowInFeed.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.cs index 4e2e64840149..c0d38ed3ed86 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupPatch.cs @@ -59,30 +59,20 @@ public VirtualApplicationGroupPatch() /// The resourceType. /// The systemData. /// tags to be updated. - /// Description of ApplicationGroup. - /// Friendly name of ApplicationGroup. - /// Boolean representing whether the applicationGroup is show in the feed. + /// ApplicationGroup properties that can be patched. /// Keeps track of any properties unknown to the library. - internal VirtualApplicationGroupPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, string description, string friendlyName, bool? showInFeed, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal VirtualApplicationGroupPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, ApplicationGroupPatchProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Tags = tags; - Description = description; - FriendlyName = friendlyName; - ShowInFeed = showInFeed; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// tags to be updated. [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Description of ApplicationGroup. - [WirePath("properties.description")] - public string Description { get; set; } - /// Friendly name of ApplicationGroup. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } - /// Boolean representing whether the applicationGroup is show in the feed. - [WirePath("properties.showInFeed")] - public bool? ShowInFeed { get; set; } + public IDictionary Tags { get; } + /// ApplicationGroup properties that can be patched. + [WirePath("properties")] + public ApplicationGroupPatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupType.cs index 17d5e7c51228..7e95d01f448a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationGroupType.cs @@ -25,9 +25,9 @@ public VirtualApplicationGroupType(string value) private const string RemoteAppValue = "RemoteApp"; private const string DesktopValue = "Desktop"; - /// RemoteApp. + /// Application group is Remote and can launch individual applications without a Desktop. public static VirtualApplicationGroupType RemoteApp { get; } = new VirtualApplicationGroupType(RemoteAppValue); - /// Desktop. + /// Application Group delivers a full expected Desktop experience. public static VirtualApplicationGroupType Desktop { get; } = new VirtualApplicationGroupType(DesktopValue); /// Determines if two values are the same. public static bool operator ==(VirtualApplicationGroupType left, VirtualApplicationGroupType right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.Serialization.cs index d1c733da927b..38bac28d0172 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.Serialization.cs @@ -34,96 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(VirtualApplicationPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) + if (Optional.IsDefined(Properties)) { - if (Tags != null) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); - } - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - if (Optional.IsDefined(FilePath)) - { - writer.WritePropertyName("filePath"u8); - writer.WriteStringValue(FilePath); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (Optional.IsDefined(CommandLineSetting)) - { - writer.WritePropertyName("commandLineSetting"u8); - writer.WriteStringValue(CommandLineSetting.Value.ToString()); - } - if (Optional.IsDefined(CommandLineArguments)) - { - writer.WritePropertyName("commandLineArguments"u8); - writer.WriteStringValue(CommandLineArguments); - } - if (Optional.IsDefined(ShowInPortal)) - { - writer.WritePropertyName("showInPortal"u8); - writer.WriteBooleanValue(ShowInPortal.Value); - } - if (Optional.IsDefined(IconPath)) - { - writer.WritePropertyName("iconPath"u8); - writer.WriteStringValue(IconPath); - } - if (Optional.IsDefined(IconIndex)) - { - writer.WritePropertyName("iconIndex"u8); - writer.WriteNumberValue(IconIndex.Value); - } - if (Optional.IsDefined(MsixPackageFamilyName)) - { - if (MsixPackageFamilyName != null) - { - writer.WritePropertyName("msixPackageFamilyName"u8); - writer.WriteStringValue(MsixPackageFamilyName); - } - else - { - writer.WriteNull("msixPackageFamilyName"); - } - } - if (Optional.IsDefined(MsixPackageApplicationId)) - { - if (MsixPackageApplicationId != null) - { - writer.WritePropertyName("msixPackageApplicationId"u8); - writer.WriteStringValue(MsixPackageApplicationId); - } - else - { - writer.WriteNull("msixPackageApplicationId"); - } - } - if (Optional.IsDefined(ApplicationType)) - { - writer.WritePropertyName("applicationType"u8); - writer.WriteStringValue(ApplicationType.Value.ToString()); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -161,128 +76,18 @@ internal static VirtualApplicationPatch DeserializeVirtualApplicationPatch(JsonE { return null; } - IDictionary tags = default; - string description = default; - string friendlyName = default; - string filePath = default; - VirtualApplicationCommandLineSetting? commandLineSetting = default; - string commandLineArguments = default; - bool? showInPortal = default; - string iconPath = default; - int? iconIndex = default; - string msixPackageFamilyName = default; - string msixPackageApplicationId = default; - RemoteApplicationType? applicationType = default; + ApplicationPatchProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - tags = 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) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("filePath"u8)) - { - filePath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("commandLineSetting"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - commandLineSetting = new VirtualApplicationCommandLineSetting(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("commandLineArguments"u8)) - { - commandLineArguments = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("showInPortal"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - showInPortal = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("iconPath"u8)) - { - iconPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("iconIndex"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - iconIndex = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("msixPackageFamilyName"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - msixPackageFamilyName = null; - continue; - } - msixPackageFamilyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("msixPackageApplicationId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - msixPackageApplicationId = null; - continue; - } - msixPackageApplicationId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("applicationType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - applicationType = new RemoteApplicationType(property0.Value.GetString()); - continue; - } - } + properties = ApplicationPatchProperties.DeserializeApplicationPatchProperties(property.Value, options); continue; } if (options.Format != "W") @@ -291,20 +96,7 @@ internal static VirtualApplicationPatch DeserializeVirtualApplicationPatch(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new VirtualApplicationPatch( - tags ?? new ChangeTrackingDictionary(), - description, - friendlyName, - filePath, - commandLineSetting, - commandLineArguments, - showInPortal, - iconPath, - iconIndex, - msixPackageFamilyName, - msixPackageApplicationId, - applicationType, - serializedAdditionalRawData); + return new VirtualApplicationPatch(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.cs index 00a17d7dadd4..de9fe54365e2 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationPatch.cs @@ -48,75 +48,19 @@ public partial class VirtualApplicationPatch /// Initializes a new instance of . public VirtualApplicationPatch() { - Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// tags to be updated. - /// Description of Application. - /// Friendly name of Application. - /// Specifies a path for the executable file for the application. - /// Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. - /// Command Line Arguments for Application. - /// Specifies whether to show the RemoteApp program in the RD Web Access server. - /// Path to icon. - /// Index of the icon. - /// Specifies the package family name for MSIX applications. - /// Specifies the package application Id for MSIX applications. - /// Resource Type of Application. + /// Detailed properties for Application. /// Keeps track of any properties unknown to the library. - internal VirtualApplicationPatch(IDictionary tags, string description, string friendlyName, string filePath, VirtualApplicationCommandLineSetting? commandLineSetting, string commandLineArguments, bool? showInPortal, string iconPath, int? iconIndex, string msixPackageFamilyName, string msixPackageApplicationId, RemoteApplicationType? applicationType, IDictionary serializedAdditionalRawData) + internal VirtualApplicationPatch(ApplicationPatchProperties properties, IDictionary serializedAdditionalRawData) { - Tags = tags; - Description = description; - FriendlyName = friendlyName; - FilePath = filePath; - CommandLineSetting = commandLineSetting; - CommandLineArguments = commandLineArguments; - ShowInPortal = showInPortal; - IconPath = iconPath; - IconIndex = iconIndex; - MsixPackageFamilyName = msixPackageFamilyName; - MsixPackageApplicationId = msixPackageApplicationId; - ApplicationType = applicationType; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// tags to be updated. - [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Description of Application. - [WirePath("properties.description")] - public string Description { get; set; } - /// Friendly name of Application. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } - /// Specifies a path for the executable file for the application. - [WirePath("properties.filePath")] - public string FilePath { get; set; } - /// Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. - [WirePath("properties.commandLineSetting")] - public VirtualApplicationCommandLineSetting? CommandLineSetting { get; set; } - /// Command Line Arguments for Application. - [WirePath("properties.commandLineArguments")] - public string CommandLineArguments { get; set; } - /// Specifies whether to show the RemoteApp program in the RD Web Access server. - [WirePath("properties.showInPortal")] - public bool? ShowInPortal { get; set; } - /// Path to icon. - [WirePath("properties.iconPath")] - public string IconPath { get; set; } - /// Index of the icon. - [WirePath("properties.iconIndex")] - public int? IconIndex { get; set; } - /// Specifies the package family name for MSIX applications. - [WirePath("properties.msixPackageFamilyName")] - public string MsixPackageFamilyName { get; set; } - /// Specifies the package application Id for MSIX applications. - [WirePath("properties.msixPackageApplicationId")] - public string MsixPackageApplicationId { get; set; } - /// Resource Type of Application. - [WirePath("properties.applicationType")] - public RemoteApplicationType? ApplicationType { get; set; } + /// Detailed properties for Application. + [WirePath("properties")] + public ApplicationPatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationType.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationType.cs index 16144eb86d90..7977aa8022bc 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationType.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualApplicationType.cs @@ -25,9 +25,9 @@ public VirtualApplicationType(string value) private const string RemoteAppValue = "RemoteApp"; private const string DesktopValue = "Desktop"; - /// RemoteApp. + /// Remote Applications (non-desktop). public static VirtualApplicationType RemoteApp { get; } = new VirtualApplicationType(RemoteAppValue); - /// Desktop. + /// Desktop Applications. public static VirtualApplicationType Desktop { get; } = new VirtualApplicationType(DesktopValue); /// Determines if two values are the same. public static bool operator ==(VirtualApplicationType left, VirtualApplicationType right) => left.Equals(right); diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.Serialization.cs index c65a34c9c4ed..58d6d1051c8e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.Serialization.cs @@ -34,37 +34,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(VirtualDesktopPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) + if (Optional.IsDefined(Properties)) { - if (Tags != null) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); - } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,48 +76,18 @@ internal static VirtualDesktopPatch DeserializeVirtualDesktopPatch(JsonElement e { return null; } - IDictionary tags = default; - string description = default; - string friendlyName = default; + DesktopPatchProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - tags = 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) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - } + properties = DesktopPatchProperties.DeserializeDesktopPatchProperties(property.Value, options); continue; } if (options.Format != "W") @@ -152,7 +96,7 @@ internal static VirtualDesktopPatch DeserializeVirtualDesktopPatch(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new VirtualDesktopPatch(tags ?? new ChangeTrackingDictionary(), description, friendlyName, serializedAdditionalRawData); + return new VirtualDesktopPatch(properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.cs index 78499ac2c454..f6d2a7f66615 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualDesktopPatch.cs @@ -48,30 +48,19 @@ public partial class VirtualDesktopPatch /// Initializes a new instance of . public VirtualDesktopPatch() { - Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// tags to be updated. - /// Description of Desktop. - /// Friendly name of Desktop. + /// Detailed properties for Desktop. /// Keeps track of any properties unknown to the library. - internal VirtualDesktopPatch(IDictionary tags, string description, string friendlyName, IDictionary serializedAdditionalRawData) + internal VirtualDesktopPatch(DesktopPatchProperties properties, IDictionary serializedAdditionalRawData) { - Tags = tags; - Description = description; - FriendlyName = friendlyName; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// tags to be updated. - [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Description of Desktop. - [WirePath("properties.description")] - public string Description { get; set; } - /// Friendly name of Desktop. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } + /// Detailed properties for Desktop. + [WirePath("properties")] + public DesktopPatchProperties Properties { 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..1a854aaf2818 --- /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 and 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/Models/VirtualWorkspacePatch.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.Serialization.cs index 9c97fa92a740..136dc9b72e04 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.Serialization.cs @@ -36,64 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsCollectionDefined(Tags)) { - if (Tags != null) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - else - { - writer.WriteNull("tags"); - } - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(FriendlyName)) - { - writer.WritePropertyName("friendlyName"u8); - writer.WriteStringValue(FriendlyName); - } - if (Optional.IsCollectionDefined(ApplicationGroupReferences)) - { - if (ApplicationGroupReferences != null) - { - writer.WritePropertyName("applicationGroupReferences"u8); - writer.WriteStartArray(); - foreach (var item in ApplicationGroupReferences) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("applicationGroupReferences"); + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); } + writer.WriteEndObject(); } - if (Optional.IsDefined(PublicNetworkAccess)) + if (Optional.IsDefined(Properties)) { - if (PublicNetworkAccess != null) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - else - { - writer.WriteNull("publicNetworkAccess"); - } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -132,10 +88,7 @@ internal static VirtualWorkspacePatch DeserializeVirtualWorkspacePatch(JsonEleme return null; } IDictionary tags = default; - string description = default; - string friendlyName = default; - IList applicationGroupReferences = default; - DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess = default; + WorkspacePatchProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -144,7 +97,6 @@ internal static VirtualWorkspacePatch DeserializeVirtualWorkspacePatch(JsonEleme { if (property.Value.ValueKind == JsonValueKind.Null) { - tags = null; continue; } Dictionary dictionary = new Dictionary(); @@ -159,47 +111,9 @@ internal static VirtualWorkspacePatch DeserializeVirtualWorkspacePatch(JsonEleme { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("friendlyName"u8)) - { - friendlyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("applicationGroupReferences"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - applicationGroupReferences = null; - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - applicationGroupReferences = array; - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - publicNetworkAccess = null; - continue; - } - publicNetworkAccess = new DesktopVirtualizationPublicNetworkAccess(property0.Value.GetString()); - continue; - } - } + properties = WorkspacePatchProperties.DeserializeWorkspacePatchProperties(property.Value, options); continue; } if (options.Format != "W") @@ -208,13 +122,7 @@ internal static VirtualWorkspacePatch DeserializeVirtualWorkspacePatch(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new VirtualWorkspacePatch( - tags ?? new ChangeTrackingDictionary(), - description, - friendlyName, - applicationGroupReferences ?? new ChangeTrackingList(), - publicNetworkAccess, - serializedAdditionalRawData); + return new VirtualWorkspacePatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.cs index 75e165c12dc1..2380bb64ff2e 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/VirtualWorkspacePatch.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DesktopVirtualization.Models { - /// Workspace properties that can be patched. + /// Workspace properties that can be patched.A patch model. public partial class VirtualWorkspacePatch { /// @@ -49,40 +49,24 @@ public partial class VirtualWorkspacePatch public VirtualWorkspacePatch() { Tags = new ChangeTrackingDictionary(); - ApplicationGroupReferences = new ChangeTrackingList(); } /// Initializes a new instance of . /// tags to be updated. - /// Description of Workspace. - /// Friendly name of Workspace. - /// List of applicationGroup links. - /// Enabled to allow this resource to be access from the public network. + /// Detailed properties for Workspace. /// Keeps track of any properties unknown to the library. - internal VirtualWorkspacePatch(IDictionary tags, string description, string friendlyName, IList applicationGroupReferences, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess, IDictionary serializedAdditionalRawData) + internal VirtualWorkspacePatch(IDictionary tags, WorkspacePatchProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; - Description = description; - FriendlyName = friendlyName; - ApplicationGroupReferences = applicationGroupReferences; - PublicNetworkAccess = publicNetworkAccess; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// tags to be updated. [WirePath("tags")] - public IDictionary Tags { get; set; } - /// Description of Workspace. - [WirePath("properties.description")] - public string Description { get; set; } - /// Friendly name of Workspace. - [WirePath("properties.friendlyName")] - public string FriendlyName { get; set; } - /// List of applicationGroup links. - [WirePath("properties.applicationGroupReferences")] - public IList ApplicationGroupReferences { get; set; } - /// Enabled to allow this resource to be access from the public network. - [WirePath("properties.publicNetworkAccess")] - public DesktopVirtualizationPublicNetworkAccess? PublicNetworkAccess { get; set; } + public IDictionary Tags { get; } + /// Detailed properties for Workspace. + [WirePath("properties")] + public WorkspacePatchProperties Properties { get; set; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.Serialization.cs index 925e19b665f9..10e5dbb05564 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.Serialization.cs @@ -36,20 +36,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(WorkspaceList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +86,13 @@ internal static WorkspaceList DeserializeWorkspaceList(JsonElement element, Mode return null; } IReadOnlyList value = default; - string nextLink = default; + Uri 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()) { @@ -110,7 +103,11 @@ internal static WorkspaceList DeserializeWorkspaceList(JsonElement element, Mode } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static WorkspaceList DeserializeWorkspaceList(JsonElement element, Mode } } serializedAdditionalRawData = rawDataDictionary; - return new WorkspaceList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new WorkspaceList(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.cs index ddc55b1c292e..f7414fea7274 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspaceList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DesktopVirtualization.Models { @@ -46,25 +47,34 @@ internal partial class WorkspaceList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal WorkspaceList() + /// The Workspace items on this page. + /// is null. + internal WorkspaceList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of Workspace definitions. - /// Link to the next page of results. + /// The Workspace items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal WorkspaceList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal WorkspaceList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of Workspace definitions. + /// Initializes a new instance of for deserialization. + internal WorkspaceList() + { + } + + /// The Workspace items on this page. public IReadOnlyList Value { get; } - /// Link to the next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.Serialization.cs new file mode 100644 index 000000000000..f206440581b5 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.Serialization.cs @@ -0,0 +1,180 @@ +// 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 WorkspacePatchProperties : 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(WorkspacePatchProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FriendlyName)) + { + writer.WritePropertyName("friendlyName"u8); + writer.WriteStringValue(FriendlyName); + } + if (Optional.IsCollectionDefined(ApplicationGroupReferences)) + { + writer.WritePropertyName("applicationGroupReferences"u8); + writer.WriteStartArray(); + foreach (var item in ApplicationGroupReferences) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.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 + } + } + } + + WorkspacePatchProperties 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(WorkspacePatchProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkspacePatchProperties(document.RootElement, options); + } + + internal static WorkspacePatchProperties DeserializeWorkspacePatchProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string friendlyName = default; + IList applicationGroupReferences = default; + DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("friendlyName"u8)) + { + friendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("applicationGroupReferences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + applicationGroupReferences = array; + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new DesktopVirtualizationPublicNetworkAccess(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkspacePatchProperties(description, friendlyName, applicationGroupReferences ?? new ChangeTrackingList(), publicNetworkAccess, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WorkspacePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkspacePatchProperties 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 DeserializeWorkspacePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkspacePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.cs new file mode 100644 index 000000000000..ac7abd8af765 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Models/WorkspacePatchProperties.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; + +namespace Azure.ResourceManager.DesktopVirtualization.Models +{ + /// Workspace properties that can be patched. + public partial class WorkspacePatchProperties + { + /// + /// 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 WorkspacePatchProperties() + { + ApplicationGroupReferences = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Description of Workspace. + /// Friendly name of Workspace. + /// List of applicationGroup links. + /// Enabled to allow this resource to be access from the public network. + /// Keeps track of any properties unknown to the library. + internal WorkspacePatchProperties(string description, string friendlyName, IList applicationGroupReferences, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess, IDictionary serializedAdditionalRawData) + { + Description = description; + FriendlyName = friendlyName; + ApplicationGroupReferences = applicationGroupReferences; + PublicNetworkAccess = publicNetworkAccess; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of Workspace. + [WirePath("description")] + public string Description { get; set; } + /// Friendly name of Workspace. + [WirePath("friendlyName")] + public string FriendlyName { get; set; } + /// List of applicationGroup links. + [WirePath("applicationGroupReferences")] + public IList ApplicationGroupReferences { get; } + /// Enabled to allow this resource to be access from the public network. + [WirePath("publicNetworkAccess")] + public DesktopVirtualizationPublicNetworkAccess? PublicNetworkAccess { get; set; } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs index 4aa621f896fd..804ee9a79f49 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageCollection.cs @@ -56,7 +56,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -107,7 +107,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -203,7 +203,7 @@ public virtual async Task> GetAsync(string msixPac /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string msixPac /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -248,7 +248,7 @@ public virtual Response Get(string msixPackageFullName, Can /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages /// /// /// Operation Id @@ -256,7 +256,7 @@ public virtual Response Get(string msixPackageFullName, Can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -281,7 +281,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages /// /// /// Operation Id @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -314,7 +314,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> ExistsAsync(string msixPackageFullName /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string msixPackageFullName /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -400,7 +400,7 @@ public virtual Response Exists(string msixPackageFullName, CancellationTok /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -408,7 +408,7 @@ public virtual Response Exists(string msixPackageFullName, CancellationTok /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -445,7 +445,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -453,7 +453,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.Serialization.cs index 5d570cd20d94..437526a5a789 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageData.Serialization.cs @@ -58,15 +58,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsDefined(DisplayName)) { - if (DisplayName != null) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - else - { - writer.WriteNull("displayName"); - } + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); } if (Optional.IsDefined(PackageRelativePath)) { @@ -205,11 +198,6 @@ internal static MsixPackageData DeserializeMsixPackageData(JsonElement element, } if (property0.NameEquals("displayName"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - displayName = null; - continue; - } displayName = property0.Value.GetString(); continue; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs index 01d98bc9d831..668886d4af5c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/MsixPackageResource.cs @@ -30,7 +30,7 @@ public partial class MsixPackageResource : ArmResource /// The msixPackageFullName. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"; return new ResourceIdentifier(resourceId); } @@ -94,7 +94,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -134,7 +134,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -174,7 +174,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -218,7 +218,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -262,7 +262,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -278,7 +278,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing MSIX Package definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(MsixPackagePatch patch, CancellationToken cancellationToken = default) @@ -304,7 +304,7 @@ public virtual async Task> UpdateAsync(MsixPackage /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName} /// /// /// Operation Id @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(MsixPackage /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -320,7 +320,7 @@ public virtual async Task> UpdateAsync(MsixPackage /// /// /// - /// Object containing MSIX Package definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(MsixPackagePatch patch, CancellationToken cancellationToken = default) 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..1c31f385a8cd --- /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-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + 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; + } + + /// Operation to list the ActiveSessionHostConfigurations 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> 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); + } + } + + /// Operation to list the ActiveSessionHostConfigurations 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 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 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 a ActiveSessionHostConfiguration. + /// 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 a ActiveSessionHostConfiguration. + /// 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 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; + } + + /// Operation to list the ActiveSessionHostConfigurations associated with the 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: + { + 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); + } + } + + /// Operation to list the ActiveSessionHostConfigurations associated with the 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: + { + 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..44a7fecd5843 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -80,7 +80,7 @@ internal HttpMessage CreateImportRequest(string subscriptionId, string resourceG /// 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 URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -111,7 +111,7 @@ public async Task> ImportAsync(string subscriptio /// 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 URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -165,7 +165,7 @@ internal HttpMessage CreateImportNextPageRequest(string nextLink, string subscri /// 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 URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// , , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -198,7 +198,7 @@ public async Task> ImportNextPageAsync(string nex /// 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 URI to package image and other optional properties. + /// Information to import app attach package. /// The cancellation token to use. /// , , , or is null. /// , or is an empty string, and was expected to be non-empty. 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..fccd71d96176 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/AppAttachPackageRestOperations.cs @@ -32,25 +32,26 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter) { 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/appAttachPackages/", false); - uri.AppendPath(appAttachPackageName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,80 +60,71 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); - uri.AppendPath(appAttachPackageName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get an app attach package. + /// List App Attach packages in subscription. /// 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. + /// OData filter expression. Valid properties for filtering are package name, host pool, and 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 appAttachPackageName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, appAttachPackageName); + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AppAttachPackageData value = default; + AppAttachPackageList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((AppAttachPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get an app attach package. + /// List App Attach packages in subscription. /// 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. + /// OData filter expression. Valid properties for filtering are package name, host pool, and 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 appAttachPackageName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, appAttachPackageName); + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AppAttachPackageData value = default; + AppAttachPackageList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((AppAttachPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -140,61 +132,59 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); - uri.AppendPath(appAttachPackageName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + 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/appAttachPackages/", false); - uri.AppendPath(appAttachPackageName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, 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 an App Attach package. + /// 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. - /// The name of the App Attach package. - /// Object containing App Attach Package definitions. + /// OData filter expression. Valid properties for filtering are package name and 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> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - AppAttachPackageData value = default; + AppAttachPackageList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -202,31 +192,27 @@ public async Task> CreateOrUpdateAsync(string sub } } - /// Create or update an App Attach package. + /// 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. - /// The name of the App Attach package. - /// Object containing App Attach Package definitions. + /// OData filter expression. Valid properties for filtering are package name and host pool. /// 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 appAttachPackageName, AppAttachPackageData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - AppAttachPackageData value = default; + AppAttachPackageList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -234,7 +220,7 @@ public Response CreateOrUpdate(string subscriptionId, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -248,11 +234,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -268,57 +254,69 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Remove an App Attach Package. + /// 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 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> GetAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, 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 = CreateGetRequest(subscriptionId, resourceGroupName, appAttachPackageName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + AppAttachPackageData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AppAttachPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Remove an App Attach Package. + /// 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 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 Get(string subscriptionId, string resourceGroupName, string appAttachPackageName, 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 = CreateGetRequest(subscriptionId, resourceGroupName, appAttachPackageName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + AppAttachPackageData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AppAttachPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -332,11 +330,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -350,32 +348,33 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Update an App Attach Package. + /// 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. - /// Object containing App Attach Package definition. + /// Object containing App Attach Package definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { AppAttachPackageData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); @@ -387,26 +386,27 @@ public async Task> UpdateAsync(string subscriptio } } - /// Update an App Attach Package. + /// 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. - /// Object containing App Attach Package definition. + /// Object containing App Attach Package definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { AppAttachPackageData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); @@ -418,7 +418,7 @@ public Response Update(string subscriptionId, string resou } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -426,59 +426,60 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); + uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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/appAttachPackages", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); + uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, 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; } - /// List App Attach packages in resource group. + /// 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. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// The name of the App Attach package. + /// The resource properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AppAttachPackageList value = default; + AppAttachPackageData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); + value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -486,27 +487,30 @@ public async Task> ListByResourceGroupAsync(strin } } - /// List App Attach packages in resource group. + /// 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. - /// OData filter expression. Valid properties for filtering are package name and host pool. + /// The name of the App Attach package. + /// The resource properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string appAttachPackageName, AppAttachPackagePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appAttachPackageName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AppAttachPackageList value = default; + AppAttachPackageData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); + value = AppAttachPackageData.DeserializeAppAttachPackageData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -514,35 +518,41 @@ public Response ListByResourceGroup(string subscriptionId, } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); + uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) + if (force != null) { - uri.AppendQuery("$filter", filter, true); + uri.AppendQuery("force", force.Value, true); } return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string appAttachPackageName, bool? force) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/appAttachPackages/", false); + uri.AppendPath(appAttachPackageName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) + if (force != null) { - uri.AppendQuery("$filter", filter, true); + uri.AppendQuery("force", force.Value, true); } request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -550,59 +560,59 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, stri return message; } - /// List App Attach packages in subscription. + /// Remove an App Attach Package. /// 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. + /// The name of the resource group. The name is case insensitive. + /// The name of the App Attach package. + /// Allows force delete. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , 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, bool? force = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appAttachPackageName, nameof(appAttachPackageName)); - using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName, force); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - AppAttachPackageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List App Attach packages in subscription. + /// Remove an App Attach Package. /// 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. + /// The name of the resource group. The name is case insensitive. + /// The name of the App Attach package. + /// Allows force delete. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + 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 = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appAttachPackageName, force); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - AppAttachPackageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = AppAttachPackageList.DeserializeAppAttachPackageList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter) + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -610,7 +620,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -624,21 +634,19 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List App Attach packages in resource group. + /// 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. - /// 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, and 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> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -654,21 +662,19 @@ public async Task> ListByResourceGroupNextPageAsy } } - /// List App Attach packages in resource group. + /// 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. - /// 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, and resource group. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -684,7 +690,7 @@ public Response ListByResourceGroupNextPage(string nextLin } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter) + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -692,7 +698,7 @@ internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -706,19 +712,21 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st return message; } - /// List App Attach packages in subscription. + /// List App Attach packages in resource group. /// 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. + /// The name of the resource group. The name is case insensitive. + /// OData filter expression. Valid properties for filtering are package name and host pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -734,19 +742,21 @@ public async Task> ListBySubscriptionNextPageAsyn } } - /// List App Attach packages in subscription. + /// List App Attach packages in resource group. /// 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. + /// The name of the resource group. The name is case insensitive. + /// OData filter expression. Valid properties for filtering are package name and host pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..dde5bb2bd1da 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationGroupsRestOperations.cs @@ -32,25 +32,26 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter) { 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/applicationGroups/", false); - uri.AppendPath(applicationGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,80 +60,71 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); - uri.AppendPath(applicationGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get an application group. + /// List applicationGroups in subscription. /// 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 application group. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// 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 applicationGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName); + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VirtualApplicationGroupData value = default; + ApplicationGroupList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualApplicationGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get an application group. + /// List applicationGroups in subscription. /// 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 application group. + /// OData filter expression. Valid properties for filtering are applicationGroupType. /// 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 applicationGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName); + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VirtualApplicationGroupData value = default; + ApplicationGroupList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualApplicationGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -140,61 +132,86 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); - uri.AppendPath(applicationGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + 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/applicationGroups/", false); - uri.AppendPath(applicationGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, 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 an applicationGroup. + /// List applicationGroups. /// 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 application group. - /// Object containing ApplicationGroup definitions. + /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, VirtualApplicationGroupData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - VirtualApplicationGroupData value = default; + ApplicationGroupList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -202,31 +219,30 @@ public async Task> CreateOrUpdateAsync(str } } - /// Create or update an applicationGroup. + /// List applicationGroups. /// 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 application group. - /// Object containing ApplicationGroup definitions. + /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, VirtualApplicationGroupData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - VirtualApplicationGroupData value = default; + ApplicationGroupList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -234,7 +250,7 @@ public Response CreateOrUpdate(string subscriptionI } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -248,11 +264,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string applicationGroupName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -268,57 +284,69 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Remove an applicationGroup. + /// Get an application group. /// 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 application group. /// 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 applicationGroupName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + VirtualApplicationGroupData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VirtualApplicationGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Remove an applicationGroup. + /// Get an application group. /// 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 application group. /// 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 applicationGroupName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + VirtualApplicationGroupData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VirtualApplicationGroupData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -332,11 +360,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -350,32 +378,33 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Update an applicationGroup. + /// Create or update an applicationGroup. /// 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 application group. - /// Object containing ApplicationGroup definitions. + /// Object containing ApplicationGroup definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { VirtualApplicationGroupData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); @@ -387,26 +416,27 @@ public async Task> UpdateAsync(string subs } } - /// Update an applicationGroup. + /// Create or update an applicationGroup. /// 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 application group. - /// Object containing ApplicationGroup definitions. + /// Object containing ApplicationGroup definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { VirtualApplicationGroupData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); @@ -418,7 +448,7 @@ public Response Update(string subscriptionId, strin } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -426,86 +456,60 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); + uri.AppendPath(applicationGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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/applicationGroups", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); + uri.AppendPath(applicationGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, 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; } - /// List applicationGroups. + /// Update an applicationGroup. /// 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 applicationGroupType. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the application group. + /// The AppGroup properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ApplicationGroupList value = default; + VirtualApplicationGroupData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); + value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -513,30 +517,30 @@ public async Task> ListByResourceGroupAsync(strin } } - /// List applicationGroups. + /// Update an applicationGroup. /// 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 applicationGroupType. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the application group. + /// The AppGroup properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string applicationGroupName, VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ApplicationGroupList value = default; + VirtualApplicationGroupData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); + value = VirtualApplicationGroupData.DeserializeVirtualApplicationGroupData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -544,95 +548,91 @@ public Response ListByResourceGroup(string subscriptionId, } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string filter) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); + uri.AppendPath(applicationGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string applicationGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); + uri.AppendPath(applicationGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List applicationGroups in subscription. + /// Remove an applicationGroup. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// The name of the resource group. The name is case insensitive. + /// The name of the application group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ApplicationGroupList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List applicationGroups in subscription. + /// Remove an applicationGroup. /// The ID of the target subscription. The value must be an UUID. - /// OData filter expression. Valid properties for filtering are applicationGroupType. + /// The name of the resource group. The name is case insensitive. + /// The name of the application group. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string applicationGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ApplicationGroupList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ApplicationGroupList.DeserializeApplicationGroupList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -640,7 +640,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -654,24 +654,19 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List applicationGroups. + /// List applicationGroups in subscription. /// 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 applicationGroupType. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -687,24 +682,19 @@ public async Task> ListByResourceGroupNextPageAsy } } - /// List applicationGroups. + /// List applicationGroups in subscription. /// 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 applicationGroupType. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -720,7 +710,7 @@ public Response ListByResourceGroupNextPage(string nextLin } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string filter) + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -728,7 +718,7 @@ internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -742,19 +732,24 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st return message; } - /// List applicationGroups in subscription. + /// List applicationGroups. /// 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 applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -770,19 +765,24 @@ public async Task> ListBySubscriptionNextPageAsyn } } - /// List applicationGroups in subscription. + /// List applicationGroups. /// 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 applicationGroupType. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..9bf190cae299 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ApplicationsRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,13 +46,24 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/applications/", false); - uri.AppendPath(applicationName, true); + uri.AppendPath("/applications", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -65,82 +76,91 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/applications/", false); - uri.AppendPath(applicationName, true); + uri.AppendPath("/applications", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get an application. + /// List applications. /// 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 application group. - /// The name of the application within the specified application group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, string applicationName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VirtualApplicationData value = default; + ApplicationList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); + value = ApplicationList.DeserializeApplicationList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualApplicationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get an application. + /// List applications. /// 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 application group. - /// The name of the application within the specified application group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, string applicationName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VirtualApplicationData value = default; + ApplicationList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); + value = ApplicationList.DeserializeApplicationList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualApplicationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -156,11 +176,11 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -174,83 +194,77 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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 an application. + /// Get an application. /// 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 application group. /// The name of the application within the specified application group. - /// Object containing Application definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { VirtualApplicationData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualApplicationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create or update an application. + /// Get an application. /// 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 application group. /// The name of the application within the specified application group. - /// Object containing Application definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { VirtualApplicationData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualApplicationData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -266,11 +280,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -284,59 +298,77 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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; } - /// Remove an application. + /// Create or update an application. /// 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 application group. /// The name of the application within the specified application group. + /// Object containing Application definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + VirtualApplicationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove an application. + /// Create or update an application. /// 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 application group. /// The name of the application within the specified application group. + /// Object containing Application definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, VirtualApplicationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + VirtualApplicationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VirtualApplicationData.DeserializeVirtualApplicationData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -389,7 +421,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the application group. /// The name of the application within the specified application group. - /// Object containing Application definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -422,7 +454,7 @@ public async Task> UpdateAsync(string subscript /// The name of the resource group. The name is case insensitive. /// The name of the application group. /// The name of the application within the specified application group. - /// Object containing Application definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -450,7 +482,7 @@ public Response Update(string subscriptionId, string res } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -460,28 +492,17 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/applications", false); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -490,85 +511,64 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/applications", false); + uri.AppendPath("/applications/", false); + uri.AppendPath(applicationName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List applications. + /// Remove an application. /// 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 application group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the application within the specified application group. /// 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 applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ApplicationList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ApplicationList.DeserializeApplicationList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List applications. + /// Remove an application. /// 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 application group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the application within the specified application group. /// 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 applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string applicationGroupName, string applicationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNullOrEmpty(applicationName, nameof(applicationName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, applicationGroupName, applicationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ApplicationList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ApplicationList.DeserializeApplicationList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + 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..ce928963aaeb --- /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-04-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 actions on a session host update. + /// 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 content of the action request. + /// 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 actions on a session host update. + /// 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 content of the action request. + /// 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..d314d5e0b03f 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/DesktopsRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,13 +46,24 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/desktops/", false); - uri.AppendPath(desktopName, true); + uri.AppendPath("/desktops", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -65,82 +76,91 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/desktops/", false); - uri.AppendPath(desktopName, true); + uri.AppendPath("/desktops", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a desktop. + /// List desktops. /// 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 application group. - /// The name of the desktop within the specified desktop group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, string desktopName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VirtualDesktopData value = default; + DesktopList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); + value = DesktopList.DeserializeDesktopList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualDesktopData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a desktop. + /// List desktops. /// 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 application group. - /// The name of the desktop within the specified desktop group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 applicationGroupName, string desktopName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); - Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VirtualDesktopData value = default; + DesktopList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); + value = DesktopList.DeserializeDesktopList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualDesktopData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -156,11 +176,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -174,32 +194,26 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG 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 desktop. + /// Get a desktop. /// 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 application group. /// The name of the desktop within the specified desktop group. - /// Object containing Desktop definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -210,29 +224,29 @@ public async Task> UpdateAsync(string subscriptionI value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualDesktopData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Update a desktop. + /// Get a desktop. /// 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 application group. /// The name of the desktop within the specified desktop group. - /// Object containing Desktop definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -243,12 +257,14 @@ public Response Update(string subscriptionId, string resourc value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualDesktopData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -258,28 +274,17 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/desktops", false); + uri.AppendPath("/desktops/", false); + uri.AppendPath(desktopName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -288,51 +293,45 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/applicationGroups/", false); uri.AppendPath(applicationGroupName, true); - uri.AppendPath("/desktops", false); + uri.AppendPath("/desktops/", false); + uri.AppendPath(desktopName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, 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; } - /// List desktops. + /// Update a desktop. /// 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 application group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the desktop within the specified desktop group. + /// The resource properties to be updated. /// 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 applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - DesktopList value = default; + VirtualDesktopData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DesktopList.DeserializeDesktopList(document.RootElement); + value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -340,31 +339,32 @@ public async Task> ListAsync(string subscriptionId, string } } - /// List desktops. + /// Update a desktop. /// 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 application group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the desktop within the specified desktop group. + /// The resource properties to be updated. /// 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 applicationGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string applicationGroupName, string desktopName, VirtualDesktopPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(applicationGroupName, nameof(applicationGroupName)); + Argument.AssertNotNullOrEmpty(desktopName, nameof(desktopName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, applicationGroupName, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, applicationGroupName, desktopName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - DesktopList value = default; + VirtualDesktopData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DesktopList.DeserializeDesktopList(document.RootElement); + value = VirtualDesktopData.DeserializeVirtualDesktopData(document.RootElement); return Response.FromValue(value, message.Response); } default: 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..0d0ade2a2a4c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/HostPoolsRestOperations.cs @@ -32,11 +32,119 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + { + 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("/providers/Microsoft.DesktopVirtualization/hostPools", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List hostPools in subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, pageSize, isDescending, initialSkip); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HostPoolList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HostPoolList.DeserializeHostPoolList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List hostPools in subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, pageSize, isDescending, initialSkip); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HostPoolList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HostPoolList.DeserializeHostPoolList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,13 +152,24 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res 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("/providers/Microsoft.DesktopVirtualization/hostPools", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -61,78 +180,87 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/providers/Microsoft.DesktopVirtualization/hostPools", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a host pool. + /// List hostPools. /// 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. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, 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); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - HostPoolData value = default; + HostPoolList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = HostPoolData.DeserializeHostPoolData(document.RootElement); + value = HostPoolList.DeserializeHostPoolList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((HostPoolData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a host pool. + /// List hostPools. /// 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. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, 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); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - HostPoolData value = default; + HostPoolList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = HostPoolData.DeserializeHostPoolData(document.RootElement); + value = HostPoolList.DeserializeHostPoolList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((HostPoolData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -146,11 +274,11 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -162,79 +290,73 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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 host pool. + /// Get a host pool. /// 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 HostPool definitions. /// The cancellation token to use. - /// , , or is null. + /// , 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, HostPoolData data, CancellationToken cancellationToken = default) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { HostPoolData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = HostPoolData.DeserializeHostPoolData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((HostPoolData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create or update a host pool. + /// Get a host pool. /// 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 HostPool definitions. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData data, CancellationToken cancellationToken = default) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { HostPoolData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = HostPoolData.DeserializeHostPoolData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((HostPoolData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -245,18 +367,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, 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 hostPoolName, bool? force) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -266,63 +384,75 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, 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"); + 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; } - /// Remove a host pool. + /// Create or update a host pool. /// 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. - /// Force flag to delete sessionHost. + /// Object containing HostPool definitions. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force = null, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, force); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + HostPoolData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HostPoolData.DeserializeHostPoolData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a host pool. + /// Create or update a host pool. /// 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. - /// Force flag to delete sessionHost. + /// Object containing HostPool definitions. /// The cancellation token to use. - /// , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force = null, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, HostPoolData 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, force); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + HostPoolData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HostPoolData.DeserializeHostPoolData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -370,7 +500,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// 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 HostPool definitions. + /// The properties to be updated. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -401,7 +531,7 @@ public async Task> UpdateAsync(string subscriptionId, str /// 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 HostPool definitions. + /// The properties to be updated. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -428,7 +558,7 @@ public Response Update(string subscriptionId, string resourceGroup } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -436,47 +566,33 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) + if (force != null) { - uri.AppendQuery("initialSkip", initialSkip.Value, true); + uri.AppendQuery("force", force.Value, true); } return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; 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("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) + if (force != null) { - uri.AppendQuery("initialSkip", initialSkip.Value, true); + uri.AppendQuery("force", force.Value, true); } request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -484,139 +600,116 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str return message; } - /// List hostPools. + /// Remove a host pool. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the host pool within the specified resource group. + /// Force flag to delete sessionHost. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, force); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - HostPoolList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = HostPoolList.DeserializeHostPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List hostPools. + /// Remove a host pool. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the host pool within the specified resource group. + /// Force flag to delete sessionHost. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string hostPoolName, bool? force = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, force); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - HostPoolList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = HostPoolList.DeserializeHostPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + 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("/providers/Microsoft.DesktopVirtualization/hostPools", false); + 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); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListRegistrationTokensRequest(string subscriptionId, string resourceGroupName, string hostPoolName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools", false); + 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); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List hostPools in subscription. + /// Operation to list the RegistrationTokens associated with the HostPool. /// The ID of the target subscription. The value must be an UUID. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// 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. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , 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 = CreateListRequest(subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListRegistrationTokensRequest(subscriptionId, resourceGroupName, hostPoolName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - HostPoolList value = default; + RegistrationTokenList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = HostPoolList.DeserializeHostPoolList(document.RootElement); + value = RegistrationTokenList.DeserializeRegistrationTokenList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -624,27 +717,28 @@ public async Task> ListAsync(string subscriptionId, int? } } - /// List hostPools in subscription. + /// Operation to list the RegistrationTokens associated with the HostPool. /// The ID of the target subscription. The value must be an UUID. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// 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. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , 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 = CreateListRequest(subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListRegistrationTokensRequest(subscriptionId, resourceGroupName, hostPoolName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - HostPoolList value = default; + RegistrationTokenList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = HostPoolList.DeserializeHostPoolList(document.RootElement); + value = RegistrationTokenList.DeserializeRegistrationTokenList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -746,7 +840,7 @@ public Response RetrieveRegistrationToken(string subsc } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -754,7 +848,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -768,23 +862,21 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List hostPools. + /// List hostPools in subscription. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -800,23 +892,21 @@ public async Task> ListByResourceGroupNextPageAsync(strin } } - /// List hostPools. + /// List hostPools in subscription. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -832,7 +922,7 @@ public Response ListByResourceGroupNextPage(string nextLink, strin } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -840,7 +930,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -854,21 +944,23 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// List hostPools in subscription. + /// List hostPools. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -884,21 +976,23 @@ public async Task> ListNextPageAsync(string nextLink, str } } - /// List hostPools in subscription. + /// List hostPools. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..7ef5d20b9869 --- /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-04-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. + /// The resource properties to be updated. + /// 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. + /// The resource properties to be updated. + /// 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..ee9369964f24 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -76,11 +76,14 @@ internal HttpMessage CreateExpandRequest(string subscriptionId, string resourceG return message; } - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// /// 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 URI to MSIX Image. + /// Represents URI referring to MSIX Image. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -107,11 +110,14 @@ public async Task> ExpandAsync(string subscription } } - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// /// 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 URI to MSIX Image. + /// Represents URI referring to MSIX Image. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -160,12 +166,15 @@ internal HttpMessage CreateExpandNextPageRequest(string nextLink, string subscri return message; } - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// /// 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. - /// Object containing URI to MSIX Image. + /// Represents URI referring to MSIX Image. /// The cancellation token to use. /// , , , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -193,12 +202,15 @@ public async Task> ExpandNextPageAsync(string next } } - /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// + /// Expands and Lists MSIX packages in an Image, given the Image Path. + /// This action uses incorrect Msix casing intentionally to match the previous APIs. + /// /// 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. - /// Object containing URI to MSIX Image. + /// Represents URI referring to MSIX Image. /// The cancellation token to use. /// , , , or is null. /// , or is an empty string, and was expected to be non-empty. 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..acc9471f5ab8 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/MsixPackagesRestOperations.cs @@ -32,27 +32,38 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/msixPackages/", false); - uri.AppendPath(msixPackageFullName, true); + uri.AppendPath("/msixPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -61,92 +72,101 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/msixPackages/", false); - uri.AppendPath(msixPackageFullName, true); + uri.AppendPath("/msixPackages", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a msixpackage. + /// List MSIX packages in 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 version specific package full name of the MSIX package within specified hostpool. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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, string msixPackageFullName, CancellationToken cancellationToken = default) + /// , 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) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - MsixPackageData value = default; + MsixPackageList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); + value = MsixPackageList.DeserializeMsixPackageList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((MsixPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a msixpackage. + /// List MSIX packages in 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 version specific package full name of the MSIX package within specified hostpool. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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, string msixPackageFullName, CancellationToken cancellationToken = default) + /// , 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) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - MsixPackageData value = default; + MsixPackageList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); + value = MsixPackageList.DeserializeMsixPackageList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((MsixPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -156,16 +176,16 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + 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("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -174,89 +194,83 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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 MSIX package. + /// Get a msixpackage. /// 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 version specific package full name of the MSIX package within specified hostpool. - /// Object containing MSIX Package definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , 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, string msixPackageFullName, MsixPackageData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { MsixPackageData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((MsixPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create or update a MSIX package. + /// Get a msixpackage. /// 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 version specific package full name of the MSIX package within specified hostpool. - /// Object containing MSIX Package definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { MsixPackageData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((MsixPackageData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -266,16 +280,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + 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("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -284,59 +298,77 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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; } - /// Remove an MSIX Package. + /// Create or update a MSIX 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 host pool within the specified resource group. /// The version specific package full name of the MSIX package within specified hostpool. + /// Object containing MSIX Package definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + MsixPackageData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove an MSIX Package. + /// Create or update a MSIX 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 host pool within the specified resource group. /// The version specific package full name of the MSIX package within specified hostpool. + /// Object containing MSIX Package definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, MsixPackageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + MsixPackageData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = MsixPackageData.DeserializeMsixPackageData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -348,7 +380,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -367,7 +399,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); @@ -389,7 +421,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the host pool within the specified resource group. /// The version specific package full name of the MSIX package within specified hostpool. - /// Object containing MSIX Package definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -422,7 +454,7 @@ public async Task> UpdateAsync(string subscriptionId, /// The name of the resource group. The name is case insensitive. /// The name of the host pool within the specified resource group. /// The version specific package full name of the MSIX package within specified hostpool. - /// Object containing MSIX Package definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -450,125 +482,93 @@ public Response Update(string subscriptionId, string resourceGr } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/msixPackages", false); + uri.AppendPath("/msixPackages/", false); + uri.AppendPath(msixPackageFullName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/msixPackages", false); + uri.AppendPath("/msixPackages/", false); + uri.AppendPath(msixPackageFullName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List MSIX packages in hostpool. + /// Remove an MSIX 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 host pool within the specified resource group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The version specific package full name of the MSIX package within specified hostpool. /// 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) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - MsixPackageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MsixPackageList.DeserializeMsixPackageList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List MSIX packages in hostpool. + /// Remove an MSIX 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 host pool within the specified resource group. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The version specific package full name of the MSIX package within specified hostpool. /// 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) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string hostPoolName, string msixPackageFullName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(msixPackageFullName, nameof(msixPackageFullName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, msixPackageFullName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - MsixPackageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MsixPackageList.DeserializeMsixPackageList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } 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..4e0281a44c39 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,14 +44,26 @@ internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName) + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -62,30 +74,45 @@ internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List private endpoint connections. + /// List private endpoint connections associated with 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 workspace. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + /// , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -101,20 +128,23 @@ public async Task> L } } - /// List private endpoint connections. + /// List private endpoint connections associated with 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 workspace. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -130,7 +160,7 @@ public Response ListByWorkspa } } - internal RequestUriBuilder CreateGetByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateGetByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -138,15 +168,15 @@ internal RequestUriBuilder CreateGetByWorkspaceRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + internal HttpMessage CreateGetByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -157,8 +187,8 @@ internal HttpMessage CreateGetByWorkspaceRequest(string subscriptionId, string r uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -168,22 +198,22 @@ internal HttpMessage CreateGetByWorkspaceRequest(string subscriptionId, string r return message; } - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + using var message = CreateGetByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -201,22 +231,22 @@ public async Task Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + using var message = CreateGetByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -234,7 +264,7 @@ public Response GetByWor } } - internal RequestUriBuilder CreateDeleteByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateUpdateByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -242,91 +272,107 @@ internal RequestUriBuilder CreateDeleteByWorkspaceRequestUri(string subscription uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + internal HttpMessage CreateUpdateByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + 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/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); 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; } - /// Remove a connection. + /// Approve or reject a private endpoint connection. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + using var message = CreateUpdateByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + DesktopVirtualizationPrivateEndpointConnectionDataData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a connection. + /// Approve or reject a private endpoint connection. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + using var message = CreateUpdateByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + DesktopVirtualizationPrivateEndpointConnectionDataData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection) + internal RequestUriBuilder CreateDeleteByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -334,107 +380,91 @@ internal RequestUriBuilder CreateUpdateByWorkspaceRequestUri(string subscription uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpdateByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection) + internal HttpMessage CreateDeleteByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; 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/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); 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(connection, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Approve or reject a private endpoint connection. + /// Delete a PrivateEndpointConnectionWithSystemData. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); - using var message = CreateUpdateByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, connection); + using var message = CreateDeleteByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DesktopVirtualizationPrivateEndpointConnectionDataData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Approve or reject a private endpoint connection. + /// Delete a PrivateEndpointConnectionWithSystemData. /// 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 workspace. - /// The name of the private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name of the host pool within the specified resource group. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); - using var message = CreateUpdateByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, connection); + using var message = CreateDeleteByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DesktopVirtualizationPrivateEndpointConnectionDataData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -442,26 +472,14 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -472,45 +490,30 @@ internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string r 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List private endpoint connections associated with hostpool. + /// List private endpoint connections associated with Workspace. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -526,23 +529,20 @@ public async Task> L } } - /// List private endpoint connections associated with hostpool. + /// List private endpoint connections associated with Workspace. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -558,7 +558,7 @@ public Response ListByHostPoo } } - internal RequestUriBuilder CreateGetByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateGetByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -566,15 +566,15 @@ internal RequestUriBuilder CreateGetByHostPoolRequestUri(string subscriptionId, 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) + internal HttpMessage CreateGetByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -585,8 +585,8 @@ internal HttpMessage CreateGetByHostPoolRequest(string subscriptionId, string re 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -596,22 +596,22 @@ internal HttpMessage CreateGetByHostPoolRequest(string subscriptionId, string re return message; } - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData. /// 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 private endpoint connection associated with the Azure resource. + /// The name of the workspace. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); + using var message = CreateGetByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -629,22 +629,22 @@ public async Task Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData. /// 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 private endpoint connection associated with the Azure resource. + /// The name of the workspace. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response GetByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateGetByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); + using var message = CreateGetByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -662,7 +662,7 @@ public Response GetByHos } } - internal RequestUriBuilder CreateDeleteByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateUpdateByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -670,91 +670,107 @@ internal RequestUriBuilder CreateDeleteByHostPoolRequestUri(string subscriptionI 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName) + internal HttpMessage CreateUpdateByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); 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; } - /// Remove a connection. + /// Approve or reject a private endpoint connection. /// 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 private endpoint connection associated with the Azure resource. + /// The name of the workspace. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> UpdateByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); + using var message = CreateUpdateByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + DesktopVirtualizationPrivateEndpointConnectionDataData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a connection. + /// Approve or reject a private endpoint connection. /// 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 private endpoint connection associated with the Azure resource. + /// The name of the workspace. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DeleteByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response UpdateByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName); + using var message = CreateUpdateByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + DesktopVirtualizationPrivateEndpointConnectionDataData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection) + internal RequestUriBuilder CreateDeleteByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -762,107 +778,91 @@ internal RequestUriBuilder CreateUpdateByHostPoolRequestUri(string subscriptionI 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpdateByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection) + internal HttpMessage CreateDeleteByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateEndpointConnections/", false); uri.AppendPath(privateEndpointConnectionName, true); 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(connection, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Approve or reject a private endpoint connection. + /// Delete a PrivateEndpointConnectionWithSystemData. /// 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name of the workspace. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> UpdateByHostPoolAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); - using var message = CreateUpdateByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName, connection); + using var message = CreateDeleteByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - DesktopVirtualizationPrivateEndpointConnectionDataData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Approve or reject a private endpoint connection. + /// Delete a PrivateEndpointConnectionWithSystemData. /// 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name of the workspace. + /// The name parameter for private endpoint. /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UpdateByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response DeleteByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); - using var message = CreateUpdateByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, privateEndpointConnectionName, connection); + using var message = CreateDeleteByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - DesktopVirtualizationPrivateEndpointConnectionDataData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DesktopVirtualizationPrivateEndpointConnectionDataData.DeserializeDesktopVirtualizationPrivateEndpointConnectionDataData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -870,7 +870,7 @@ internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLi return uri; } - internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -884,22 +884,25 @@ internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, strin return message; } - /// List private endpoint connections. + /// List private endpoint connections associated with 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 workspace. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByWorkspaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -915,22 +918,25 @@ public async Task> L } } - /// List private endpoint connections. + /// List private endpoint connections associated with 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 workspace. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByWorkspaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -946,7 +952,7 @@ public Response ListByWorkspa } } - internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -954,7 +960,7 @@ internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLin return uri; } - internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -968,25 +974,22 @@ internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string return message; } - /// List private endpoint connections associated with hostpool. + /// List private endpoint connections associated with Workspace. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWorkspaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1002,25 +1005,22 @@ public async Task> L } } - /// List private endpoint connections associated with hostpool. + /// List private endpoint connections associated with Workspace. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWorkspaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..6653514cdcfa 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,8 +44,8 @@ internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); if (pageSize != null) @@ -63,7 +63,7 @@ internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId return uri; } - internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -74,8 +74,8 @@ internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); if (pageSize != null) @@ -96,23 +96,23 @@ internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string return message; } - /// List the private link resources available for this workspace. + /// List the private link resources available for this 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 workspace. + /// The name of the host pool within the specified resource group. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -128,23 +128,23 @@ public async Task> } } - /// List the private link resources available for this workspace. + /// List the private link resources available for this 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 workspace. + /// The name of the host pool within the specified resource group. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -160,7 +160,7 @@ public Response ListByWorksp } } - internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByWorkspaceRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -168,8 +168,8 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); if (pageSize != null) @@ -187,7 +187,7 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByWorkspaceRequest(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -198,8 +198,8 @@ internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string r 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("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendPath("/privateLinkResources", false); uri.AppendQuery("api-version", _apiVersion, true); if (pageSize != null) @@ -220,23 +220,23 @@ internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string r return message; } - /// List the private link resources available for this hostpool. + /// List the private link resources available for this workspace. /// 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 workspace. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWorkspaceAsync(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -252,23 +252,23 @@ public async Task> } } - /// List the private link resources available for this hostpool. + /// List the private link resources available for this workspace. /// 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 workspace. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWorkspace(string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceRequest(subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -284,7 +284,7 @@ public Response ListByHostPo } } - internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -292,7 +292,7 @@ internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLi return uri; } - internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -306,25 +306,25 @@ internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, strin return message; } - /// List the private link resources available for this workspace. + /// List the private link resources available for this 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 workspace. + /// The name of the host pool within the specified resource group. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByWorkspaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -340,25 +340,25 @@ public async Task> } } - /// List the private link resources available for this workspace. + /// List the private link resources available for this 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 workspace. + /// The name of the host pool within the specified resource group. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByWorkspaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -374,7 +374,7 @@ public Response ListByWorksp } } - internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByWorkspaceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -382,7 +382,7 @@ internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLin return uri; } - internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByWorkspaceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -396,25 +396,25 @@ internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string return message; } - /// List the private link resources available for this hostpool. + /// List the private link resources available for this workspace. /// 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 name of the workspace. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWorkspaceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -430,25 +430,25 @@ public async Task> } } - /// List the private link resources available for this hostpool. + /// List the private link resources available for this workspace. /// 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 name of the workspace. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWorkspaceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByWorkspaceNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..8c88a045ccae 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPersonalSchedulesRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,13 +46,24 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/personalSchedules/", false); - uri.AppendPath(scalingPlanScheduleName, true); + uri.AppendPath("/personalSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -65,82 +76,91 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/personalSchedules/", false); - uri.AppendPath(scalingPlanScheduleName, true); + uri.AppendPath("/personalSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a ScalingPlanPersonalSchedule. + /// List ScalingPlanPersonalSchedules. /// 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 scaling plan. - /// The name of the ScalingPlanSchedule. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScalingPlanPersonalScheduleData value = default; + ScalingPlanPersonalScheduleList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); + value = ScalingPlanPersonalScheduleList.DeserializeScalingPlanPersonalScheduleList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanPersonalScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a ScalingPlanPersonalSchedule. + /// List ScalingPlanPersonalSchedules. /// 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 scaling plan. - /// The name of the ScalingPlanSchedule. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScalingPlanPersonalScheduleData value = default; + ScalingPlanPersonalScheduleList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); + value = ScalingPlanPersonalScheduleList.DeserializeScalingPlanPersonalScheduleList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanPersonalScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -156,11 +176,11 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -174,83 +194,77 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG 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 ScalingPlanPersonalSchedule. + /// Get a ScalingPlanPersonalSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPersonalSchedule definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { ScalingPlanPersonalScheduleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanPersonalScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create or update a ScalingPlanPersonalSchedule. + /// Get a ScalingPlanPersonalSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPersonalSchedule definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { ScalingPlanPersonalScheduleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanPersonalScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -266,11 +280,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -284,59 +298,77 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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; } - /// Remove a ScalingPlanPersonalSchedule. + /// Create or update a ScalingPlanPersonalSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. + /// Object containing ScalingPlanPersonalSchedule definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + ScalingPlanPersonalScheduleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a ScalingPlanPersonalSchedule. + /// Create or update a ScalingPlanPersonalSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. + /// Object containing ScalingPlanPersonalSchedule definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPersonalScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + ScalingPlanPersonalScheduleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ScalingPlanPersonalScheduleData.DeserializeScalingPlanPersonalScheduleData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -389,7 +421,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPersonalSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -422,7 +454,7 @@ public async Task> UpdateAsync(string /// The name of the resource group. The name is case insensitive. /// The name of the scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPersonalSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -450,7 +482,7 @@ public Response Update(string subscriptionId, s } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -460,28 +492,17 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/personalSchedules", false); + uri.AppendPath("/personalSchedules/", false); + uri.AppendPath(scalingPlanScheduleName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -490,85 +511,64 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/personalSchedules", false); + uri.AppendPath("/personalSchedules/", false); + uri.AppendPath(scalingPlanScheduleName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List ScalingPlanPersonalSchedules. + /// Remove a ScalingPlanPersonalSchedule. /// 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 scaling plan. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the ScalingPlanSchedule. /// 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 scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ScalingPlanPersonalScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanPersonalScheduleList.DeserializeScalingPlanPersonalScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List ScalingPlanPersonalSchedules. + /// Remove a ScalingPlanPersonalSchedule. /// 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 scaling plan. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the ScalingPlanSchedule. /// 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 scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ScalingPlanPersonalScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanPersonalScheduleList.DeserializeScalingPlanPersonalScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } 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..0190eaf3bb5c 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlanPooledSchedulesRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,13 +46,24 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/pooledSchedules/", false); - uri.AppendPath(scalingPlanScheduleName, true); + uri.AppendPath("/pooledSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -65,82 +76,91 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/pooledSchedules/", false); - uri.AppendPath(scalingPlanScheduleName, true); + uri.AppendPath("/pooledSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a ScalingPlanPooledSchedule. + /// List ScalingPlanPooledSchedules. /// 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 scaling plan. - /// The name of the ScalingPlanSchedule. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScalingPlanPooledScheduleData value = default; + ScalingPlanPooledScheduleList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); + value = ScalingPlanPooledScheduleList.DeserializeScalingPlanPooledScheduleList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanPooledScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a ScalingPlanPooledSchedule. + /// List ScalingPlanPooledSchedules. /// 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 scaling plan. - /// The name of the ScalingPlanSchedule. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScalingPlanPooledScheduleData value = default; + ScalingPlanPooledScheduleList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); + value = ScalingPlanPooledScheduleList.DeserializeScalingPlanPooledScheduleList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanPooledScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -156,11 +176,11 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -174,83 +194,77 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG 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 ScalingPlanPooledSchedule. + /// Get a ScalingPlanPooledSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPooledSchedule definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { ScalingPlanPooledScheduleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanPooledScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Create or update a ScalingPlanPooledSchedule. + /// Get a ScalingPlanPooledSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPooledSchedule definitions. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { ScalingPlanPooledScheduleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanPooledScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -266,11 +280,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -284,59 +298,77 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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; } - /// Remove a ScalingPlanPooledSchedule. + /// Create or update a ScalingPlanPooledSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. + /// Object containing ScalingPlanPooledSchedule definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + ScalingPlanPooledScheduleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a ScalingPlanPooledSchedule. + /// Create or update a ScalingPlanPooledSchedule. /// 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 scaling plan. /// The name of the ScalingPlanSchedule. + /// Object containing ScalingPlanPooledSchedule definitions. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, ScalingPlanPooledScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + case 201: + { + ScalingPlanPooledScheduleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ScalingPlanPooledScheduleData.DeserializeScalingPlanPooledScheduleData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -389,7 +421,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The name of the resource group. The name is case insensitive. /// The name of the scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPooledSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -422,7 +454,7 @@ public async Task> UpdateAsync(string su /// The name of the resource group. The name is case insensitive. /// The name of the scaling plan. /// The name of the ScalingPlanSchedule. - /// Object containing ScalingPlanPooledSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -450,7 +482,7 @@ public Response Update(string subscriptionId, str } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -460,28 +492,17 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/pooledSchedules", false); + uri.AppendPath("/pooledSchedules/", false); + uri.AppendPath(scalingPlanScheduleName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -490,85 +511,64 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); uri.AppendPath(scalingPlanName, true); - uri.AppendPath("/pooledSchedules", false); + uri.AppendPath("/pooledSchedules/", false); + uri.AppendPath(scalingPlanScheduleName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List ScalingPlanPooledSchedules. + /// Remove a ScalingPlanPooledSchedule. /// 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 scaling plan. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the ScalingPlanSchedule. /// 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 scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ScalingPlanPooledScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanPooledScheduleList.DeserializeScalingPlanPooledScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List ScalingPlanPooledSchedules. + /// Remove a ScalingPlanPooledSchedule. /// 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 scaling plan. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the ScalingPlanSchedule. /// 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 scalingPlanName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string scalingPlanName, string scalingPlanScheduleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNullOrEmpty(scalingPlanScheduleName, nameof(scalingPlanScheduleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, scalingPlanName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName, scalingPlanScheduleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ScalingPlanPooledScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanPooledScheduleList.DeserializeScalingPlanPooledScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } 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..1b48d48034fa 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/ScalingPlansRestOperations.cs @@ -32,25 +32,34 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { 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/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,80 +68,83 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Get a scaling plan. + /// List scaling plans in subscription. /// 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 scaling plan. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName); + using var message = CreateListBySubscriptionRequest(subscriptionId, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScalingPlanData value = default; + ScalingPlanList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a scaling plan. + /// List scaling plans in subscription. /// 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 scaling plan. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName); + using var message = CreateListBySubscriptionRequest(subscriptionId, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScalingPlanData value = default; + ScalingPlanList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScalingPlanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data) + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -140,61 +152,83 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data) + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + 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/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); + uri.AppendPath(hostPoolName, true); + uri.AppendPath("/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, 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 scaling plan. + /// List scaling plan associated with 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 scaling plan. - /// Object containing scaling plan definitions. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data, CancellationToken cancellationToken = default) + /// , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, data); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - ScalingPlanData value = default; + ScalingPlanList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -202,31 +236,31 @@ public async Task> CreateAsync(string subscriptionId, } } - /// Create or update a scaling plan. + /// List scaling plan associated with 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 scaling plan. - /// Object containing scaling plan definitions. + /// The name of the host pool within the specified resource group. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, data); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - ScalingPlanData value = default; + ScalingPlanList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -234,7 +268,7 @@ public Response Create(string subscriptionId, string resourceGr } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -242,83 +276,115 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + 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/scalingPlans/", false); - uri.AppendPath(scalingPlanName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Remove a scaling plan. + /// List scaling plans. /// 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 scaling plan. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + ScalingPlanList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Remove a scaling plan. + /// List scaling plans. /// 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 scaling plan. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 scalingPlanName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + ScalingPlanList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -332,11 +398,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string scalingPlanName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -348,30 +414,24 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG 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 scaling plan. + /// Get a scaling plan. /// 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 scaling plan. - /// Object containing scaling plan definitions. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, scalingPlanName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -382,27 +442,27 @@ public async Task> UpdateAsync(string subscriptionId, value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Update a scaling plan. + /// Get a scaling plan. /// 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 scaling plan. - /// Object containing scaling plan definitions. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, scalingPlanName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, scalingPlanName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -413,12 +473,14 @@ public Response Update(string subscriptionId, string resourceGr value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScalingPlanData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -426,77 +488,61 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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/scalingPlans", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, 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; } - /// List scaling plans. + /// Create or update a scaling plan. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the scaling plan. + /// Object containing scaling plan definitions. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { - ScalingPlanList value = default; + ScalingPlanData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -504,29 +550,31 @@ public async Task> ListByResourceGroupAsync(string sub } } - /// List scaling plans. + /// Create or update a scaling plan. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the scaling plan. + /// Object containing scaling plan definitions. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, scalingPlanName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { - ScalingPlanList value = default; + ScalingPlanData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -534,79 +582,68 @@ public Response ListByResourceGroup(string subscriptionId, stri } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } + 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/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, 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; } - /// List scaling plans in subscription. + /// Update a scaling plan. /// The ID of the target subscription. The value must be an UUID. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the resource group. The name is case insensitive. + /// The name of the scaling plan. + /// The resource properties to be updated. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListBySubscriptionRequest(subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, scalingPlanName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScalingPlanList value = default; + ScalingPlanData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -614,27 +651,30 @@ public async Task> ListBySubscriptionAsync(string subs } } - /// List scaling plans in subscription. + /// Update a scaling plan. /// The ID of the target subscription. The value must be an UUID. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the resource group. The name is case insensitive. + /// The name of the scaling plan. + /// The resource properties to be updated. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string scalingPlanName, ScalingPlanPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListBySubscriptionRequest(subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, scalingPlanName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScalingPlanList value = default; + ScalingPlanData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); + value = ScalingPlanData.DeserializeScalingPlanData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -642,7 +682,7 @@ public Response ListBySubscription(string subscriptionId, int? } } - internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string scalingPlanName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -650,123 +690,83 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, 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("/scalingPlans", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string scalingPlanName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; 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("/scalingPlans", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/scalingPlans/", false); + uri.AppendPath(scalingPlanName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List scaling plan associated with hostpool. + /// Remove a scaling plan. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the scaling plan. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - ScalingPlanList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List scaling plan associated with hostpool. + /// Remove a scaling plan. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the scaling plan. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string scalingPlanName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(scalingPlanName, nameof(scalingPlanName)); - using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, scalingPlanName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - ScalingPlanList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScalingPlanList.DeserializeScalingPlanList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -774,7 +774,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -788,23 +788,21 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List scaling plans. + /// List scaling plans in subscription. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -820,23 +818,21 @@ public async Task> ListByResourceGroupNextPageAsync(st } } - /// List scaling plans. + /// List scaling plans in subscription. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -852,7 +848,7 @@ public Response ListByResourceGroupNextPage(string nextLink, st } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -860,7 +856,7 @@ internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -874,21 +870,25 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st return message; } - /// List scaling plans in subscription. + /// List scaling plan associated with 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = 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 = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -904,21 +904,25 @@ public async Task> ListBySubscriptionNextPageAsync(str } } - /// List scaling plans in subscription. + /// List scaling plan associated with 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = 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 = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -934,7 +938,7 @@ public Response ListBySubscriptionNextPage(string nextLink, str } } - internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -942,7 +946,7 @@ internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLin return uri; } - internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -956,25 +960,23 @@ internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string return message; } - /// List scaling plan associated with hostpool. + /// List scaling plans. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = 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 = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -990,25 +992,23 @@ public async Task> ListByHostPoolNextPageAsync(string } } - /// List scaling plan associated with hostpool. + /// List scaling plans. /// 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. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = 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 = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..7f065c1f981e --- /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-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + 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 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 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. + /// Resource create parameters. + /// 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. + /// Resource create parameters. + /// 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. + /// The resource properties to be updated. + /// 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. + /// The resource properties to be updated. + /// 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 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..acc3ed060675 --- /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-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + 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. + /// 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. + /// 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 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. + /// Resource create parameters. + /// 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. + /// Resource create parameters. + /// 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. + /// The properties to be updated. + /// 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. + /// The properties to be updated. + /// 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 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. + /// 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. + /// 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..86f691d512c3 --- /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-04-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 a SessionHostManagementUpdateStatus. + /// 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 a SessionHostManagementUpdateStatus. + /// 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/SessionHostsRestOperations.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs index 3e66d56c351b..d6c3529788eb 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/SessionHostsRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip, string vmPath) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,13 +46,28 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res 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("/sessionHosts", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } + if (vmPath != null) + { + uri.AppendQuery("vmPath", vmPath, true); + } return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) + 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; @@ -65,82 +80,97 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/sessionHosts", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + 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); return message; } - /// Get a session host. + /// List sessionHosts. /// 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. + /// 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> GetAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, CancellationToken cancellationToken = default) + /// , 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, string vmPath = null, 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 = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - SessionHostData value = default; + SessionHostList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SessionHostData.DeserializeSessionHostData(document.RootElement); + value = SessionHostList.DeserializeSessionHostList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((SessionHostData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a session host. + /// List sessionHosts. /// 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. + /// 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 Get(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, CancellationToken cancellationToken = default) + /// , 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, string vmPath = null, 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 = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, vmPath); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - SessionHostData value = default; + SessionHostList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SessionHostData.DeserializeSessionHostData(document.RootElement); + value = SessionHostList.DeserializeSessionHostList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((SessionHostData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, bool? force) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -153,18 +183,14 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/sessionHosts/", false); uri.AppendPath(sessionHostName, 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 hostPoolName, string sessionHostName, bool? force) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -176,67 +202,73 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/sessionHosts/", false); uri.AppendPath(sessionHostName, 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); return message; } - /// Remove a SessionHost. + /// Get a session host. /// 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. - /// Force flag to force sessionHost deletion even when userSession exists. /// 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 hostPoolName, string sessionHostName, bool? force = null, CancellationToken cancellationToken = default) + public async Task> GetAsync(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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, force); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + SessionHostData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SessionHostData.DeserializeSessionHostData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Remove a SessionHost. + /// Get a session host. /// 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. - /// Force flag to force sessionHost deletion even when userSession exists. /// 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 hostPoolName, string sessionHostName, bool? force = null, CancellationToken cancellationToken = default) + public Response Get(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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, force); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + SessionHostData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SessionHostData.DeserializeSessionHostData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SessionHostData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -297,7 +329,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// 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. - /// Object containing SessionHost definitions. + /// The resource properties to be updated. /// Force flag to update assign, unassign or reassign personal desktop. /// The cancellation token to use. /// , , , or is null. @@ -331,7 +363,7 @@ public async Task> UpdateAsync(string subscriptionId, /// 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. - /// Object containing SessionHost definitions. + /// The resource properties to be updated. /// Force flag to update assign, unassign or reassign personal desktop. /// The cancellation token to use. /// , , , or is null. @@ -360,7 +392,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 CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, bool? force) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -370,28 +402,21 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/sessionHosts", false); + uri.AppendPath("/sessionHosts/", false); + uri.AppendPath(sessionHostName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) + if (force != null) { - uri.AppendQuery("initialSkip", initialSkip.Value, true); + uri.AppendQuery("force", force.Value, true); } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, bool? force) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -400,91 +425,168 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DesktopVirtualization/hostPools/", false); uri.AppendPath(hostPoolName, true); - uri.AppendPath("/sessionHosts", false); + uri.AppendPath("/sessionHosts/", false); + uri.AppendPath(sessionHostName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) + if (force != null) { - uri.AppendQuery("pageSize", pageSize.Value, true); + uri.AppendQuery("force", force.Value, true); } - if (isDescending != null) + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Remove 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. + /// Force flag to force sessionHost deletion even when userSession exists. + /// 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 hostPoolName, string sessionHostName, bool? force = null, 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, force); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) { - uri.AppendQuery("isDescending", isDescending.Value, true); + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); } - if (initialSkip != null) + } + + /// Remove 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. + /// Force flag to force sessionHost deletion even when userSession exists. + /// 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 hostPoolName, string sessionHostName, bool? force = null, 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, force); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) { - uri.AppendQuery("initialSkip", initialSkip.Value, true); + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); } + } + + 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; } - /// List sessionHosts. + /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// 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> ListAsync(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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 = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateRetryProvisioningRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - SessionHostList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SessionHostList.DeserializeSessionHostList(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List sessionHosts. + /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// 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 List(string subscriptionId, string resourceGroupName, string hostPoolName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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 = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip); + using var message = CreateRetryProvisioningRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - SessionHostList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SessionHostList.DeserializeSessionHostList(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - 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 +594,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 +616,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 +651,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..d755739cd988 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-04-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..5a7ae0674da0 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/UserSessionsRestOperations.cs @@ -32,11 +32,11 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,10 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, 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("/userSessions", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } if (pageSize != null) { uri.AppendQuery("pageSize", pageSize.Value, true); @@ -67,7 +65,7 @@ internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -80,12 +78,10 @@ internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string r 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("/userSessions", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } if (pageSize != null) { uri.AppendQuery("pageSize", pageSize.Value, true); @@ -108,20 +104,21 @@ internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string r /// 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. - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// The name of the session host within the specified host pool. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, 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 = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -141,20 +138,21 @@ public async Task> ListByHostPoolAsync(string subscrip /// 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. - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// The name of the session host within the specified host pool. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, 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 = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -392,7 +390,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string h } } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateDisconnectRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -404,28 +402,18 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(hostPoolName, true); uri.AppendPath("/sessionHosts/", false); uri.AppendPath(sessionHostName, true); - uri.AppendPath("/userSessions", false); + uri.AppendPath("/userSessions/", false); + uri.AppendPath(userSessionId, true); + uri.AppendPath("/disconnect", false); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateDisconnectRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -436,95 +424,73 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(hostPoolName, true); uri.AppendPath("/sessionHosts/", false); uri.AppendPath(sessionHostName, true); - uri.AppendPath("/userSessions", false); + uri.AppendPath("/userSessions/", false); + uri.AppendPath(userSessionId, true); + uri.AppendPath("/disconnect", false); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List userSessions. + /// Disconnect a userSession. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the user session within the specified session host. /// 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DisconnectAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); + using var message = CreateDisconnectRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - UserSessionList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UserSessionList.DeserializeUserSessionList(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List userSessions. + /// Disconnect a userSession. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the user session within the specified session host. /// 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Disconnect(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); + Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); + using var message = CreateDisconnectRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - UserSessionList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UserSessionList.DeserializeUserSessionList(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDisconnectRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId) + internal RequestUriBuilder CreateSendMessageRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -538,12 +504,12 @@ internal RequestUriBuilder CreateDisconnectRequestUri(string subscriptionId, str uri.AppendPath(sessionHostName, true); uri.AppendPath("/userSessions/", false); uri.AppendPath(userSessionId, true); - uri.AppendPath("/disconnect", false); + uri.AppendPath("/sendMessage", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDisconnectRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId) + internal HttpMessage CreateSendMessageRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -560,24 +526,32 @@ internal HttpMessage CreateDisconnectRequest(string subscriptionId, string resou uri.AppendPath(sessionHostName, true); uri.AppendPath("/userSessions/", false); uri.AppendPath(userSessionId, true); - uri.AppendPath("/disconnect", false); + uri.AppendPath("/sendMessage", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + if (sendMessage != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(sendMessage, ModelSerializationExtensions.WireOptions); + request.Content = content; + } _userAgent.Apply(message); return message; } - /// Disconnect a userSession. + /// Send a message to a user. /// 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 name of the user session within the specified session host. + /// Represents message sent to a UserSession. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task DisconnectAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, CancellationToken cancellationToken = default) + public async Task SendMessageAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -585,7 +559,7 @@ public async Task DisconnectAsync(string subscriptionId, string resour Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateDisconnectRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId); + using var message = CreateSendMessageRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId, sendMessage); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -596,16 +570,17 @@ public async Task DisconnectAsync(string subscriptionId, string resour } } - /// Disconnect a userSession. + /// Send a message to a user. /// 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 name of the user session within the specified session host. + /// Represents message sent to a UserSession. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Disconnect(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, CancellationToken cancellationToken = default) + public Response SendMessage(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -613,7 +588,7 @@ public Response Disconnect(string subscriptionId, string resourceGroupName, stri Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateDisconnectRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId); + using var message = CreateSendMessageRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId, sendMessage); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -624,7 +599,7 @@ public Response Disconnect(string subscriptionId, string resourceGroupName, stri } } - internal RequestUriBuilder CreateSendMessageRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage) + internal RequestUriBuilder CreateListByHostPoolRequestUri(string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -634,20 +609,32 @@ internal RequestUriBuilder CreateSendMessageRequestUri(string subscriptionId, st 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("/userSessions/", false); - uri.AppendPath(userSessionId, true); - uri.AppendPath("/sendMessage", false); + uri.AppendPath("/userSessions", false); uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateSendMessageRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage) + internal HttpMessage CreateListByHostPoolRequest(string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -656,84 +643,97 @@ internal HttpMessage CreateSendMessageRequest(string subscriptionId, string reso 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("/userSessions/", false); - uri.AppendPath(userSessionId, true); - uri.AppendPath("/sendMessage", false); + uri.AppendPath("/userSessions", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (sendMessage != null) + if (filter != null) { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(sendMessage, ModelSerializationExtensions.WireOptions); - request.Content = content; + uri.AppendQuery("$filter", filter, true); } + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Send a message to a user. + /// A synchronous resource action. /// 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 name of the user session within the specified session host. - /// Object containing message includes title and message body. + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task SendMessageAsync(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) + /// , 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateSendMessageRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId, sendMessage); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - return message.Response; + { + UserSessionList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = UserSessionList.DeserializeUserSessionList(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Send a message to a user. + /// A synchronous resource action. /// 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 name of the user session within the specified session host. - /// Object containing message includes title and message body. + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response SendMessage(string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, string userSessionId, UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByHostPool(string subscriptionId, string resourceGroupName, string hostPoolName, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - Argument.AssertNotNullOrEmpty(userSessionId, nameof(userSessionId)); - using var message = CreateSendMessageRequest(subscriptionId, resourceGroupName, hostPoolName, sessionHostName, userSessionId, sendMessage); + using var message = CreateListByHostPoolRequest(subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - return message.Response; + { + UserSessionList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = UserSessionList.DeserializeUserSessionList(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, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -741,7 +741,7 @@ internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLin return uri; } - internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -760,21 +760,22 @@ internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string /// 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. - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// The name of the session host within the specified host pool. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -795,21 +796,22 @@ public async Task> ListByHostPoolNextPageAsync(string /// 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. - /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + /// The name of the session host within the specified host pool. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , , 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); + Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -825,7 +827,7 @@ public Response ListByHostPoolNextPage(string nextLink, string } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListByHostPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -833,7 +835,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string sessionHostName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListByHostPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string hostPoolName, string filter, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -847,27 +849,26 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// List userSessions. + /// A synchronous resource action. /// 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 name of the session host within the specified host pool. + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -883,27 +884,26 @@ public async Task> ListNextPageAsync(string nextLink, } } - /// List userSessions. + /// A synchronous resource action. /// 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 name of the session host within the specified host pool. + /// OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. /// Number of items per page. /// Indicates whether the collection is descending. /// Initial number of items to skip. /// 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, string sessionHostName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , 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, string filter = null, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(hostPoolName, nameof(hostPoolName)); - Argument.AssertNotNullOrEmpty(sessionHostName, nameof(sessionHostName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, sessionHostName, pageSize, isDescending, initialSkip); + using var message = CreateListByHostPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, hostPoolName, filter, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { 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..3628e4f04d3d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/RestOperations/WorkspacesRestOperations.cs @@ -32,25 +32,22 @@ 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-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) { 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/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -59,10 +56,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -70,69 +64,57 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get a workspace. + /// List workspaces in subscription. /// 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 workspace. /// 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 workspaceName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VirtualWorkspaceData value = default; + WorkspaceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualWorkspaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a workspace. + /// List workspaces in subscription. /// 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 workspace. /// 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 workspaceName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VirtualWorkspaceData value = default; + WorkspaceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((VirtualWorkspaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -140,61 +122,77 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, true); + } return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + 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/workspaces/", false); - uri.AppendPath(workspaceName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); uri.AppendQuery("api-version", _apiVersion, true); + if (pageSize != null) + { + uri.AppendQuery("pageSize", pageSize.Value, true); + } + if (isDescending != null) + { + uri.AppendQuery("isDescending", isDescending.Value, true); + } + if (initialSkip != null) + { + uri.AppendQuery("initialSkip", initialSkip.Value, 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 workspace. + /// List workspaces. /// 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 workspace. - /// Object containing Workspace definitions. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 workspaceName, VirtualWorkspaceData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - VirtualWorkspaceData value = default; + WorkspaceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -202,31 +200,29 @@ public async Task> CreateOrUpdateAsync(string sub } } - /// Create or update a workspace. + /// List workspaces. /// 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 workspace. - /// Object containing Workspace definitions. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// 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 workspaceName, VirtualWorkspaceData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - VirtualWorkspaceData value = default; + WorkspaceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -234,7 +230,7 @@ public Response CreateOrUpdate(string subscriptionId, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -248,11 +244,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -268,57 +264,69 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Remove a workspace. + /// Get a workspace. /// 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 workspace. /// 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 workspaceName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + VirtualWorkspaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VirtualWorkspaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Remove a workspace. + /// Get a workspace. /// 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 workspace. /// 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 workspaceName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + VirtualWorkspaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((VirtualWorkspaceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -332,11 +340,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -350,32 +358,33 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Update a workspace. + /// Create or update a workspace. /// 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 workspace. - /// Object containing Workspace definitions. + /// Object containing Workspace definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 201: { VirtualWorkspaceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); @@ -387,26 +396,27 @@ public async Task> UpdateAsync(string subscriptio } } - /// Update a workspace. + /// Create or update a workspace. /// 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 workspace. - /// Object containing Workspace definitions. + /// Object containing Workspace definitions. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspaceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 201: { VirtualWorkspaceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); @@ -418,7 +428,7 @@ public Response Update(string subscriptionId, string resou } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -426,77 +436,60 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, true); - } return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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/workspaces", false); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendQuery("api-version", _apiVersion, true); - if (pageSize != null) - { - uri.AppendQuery("pageSize", pageSize.Value, true); - } - if (isDescending != null) - { - uri.AppendQuery("isDescending", isDescending.Value, true); - } - if (initialSkip != null) - { - uri.AppendQuery("initialSkip", initialSkip.Value, 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; } - /// List workspaces. + /// Update a workspace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. + /// The resource properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkspaceList value = default; + VirtualWorkspaceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); + value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -504,29 +497,30 @@ public async Task> ListByResourceGroupAsync(string subsc } } - /// List workspaces. + /// Update a workspace. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. + /// The name of the workspace. + /// The resource properties to be updated. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string workspaceName, VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkspaceList value = default; + VirtualWorkspaceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); + value = VirtualWorkspaceData.DeserializeVirtualWorkspaceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -534,27 +528,33 @@ public Response ListByResourceGroup(string subscriptionId, string } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DesktopVirtualization/workspaces/", false); + uri.AppendPath(workspaceName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -562,57 +562,57 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) return message; } - /// List workspaces in subscription. + /// Remove a workspace. /// 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 workspace. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - WorkspaceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List workspaces in subscription. + /// Remove a workspace. /// 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 workspace. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - WorkspaceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = WorkspaceList.DeserializeWorkspaceList(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -620,7 +620,7 @@ internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string ne return uri; } - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -634,23 +634,18 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// List workspaces. + /// List workspaces in subscription. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -666,23 +661,18 @@ public async Task> ListByResourceGroupNextPageAsync(stri } } - /// List workspaces. + /// List workspaces in subscription. /// 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. - /// Number of items per page. - /// Indicates whether the collection is descending. - /// Initial number of items to skip. /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -698,7 +688,7 @@ public Response ListByResourceGroupNextPage(string nextLink, stri } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -706,7 +696,7 @@ internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize, bool? isDescending, int? initialSkip) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -720,18 +710,23 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st return message; } - /// List workspaces in subscription. + /// List workspaces. /// 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. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -747,18 +742,23 @@ public async Task> ListBySubscriptionNextPageAsync(strin } } - /// List workspaces in subscription. + /// List workspaces. /// 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. + /// Number of items per page. + /// Indicates whether the collection is descending. + /// Initial number of items to skip. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? pageSize = null, bool? isDescending = null, int? initialSkip = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, pageSize, isDescending, initialSkip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanCollection.cs index 31db3f619312..337aa73f1faf 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-04-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string scaling /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string scalingPlanName, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string scalingPlanName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string scalingPlanName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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 8ec5e42acd6a..5c495f8981d5 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.Serialization.cs @@ -39,36 +39,37 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ManagedBy)) - { - writer.WritePropertyName("managedBy"u8); - writer.WriteStringValue(ManagedBy); - } - if (Optional.IsDefined(Kind)) + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Kind)) { - writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); } - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(ManagedBy)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); + writer.WritePropertyName("managedBy"u8); + writer.WriteStringValue(ManagedBy); } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); JsonSerializer.Serialize(writer, Plan); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ObjectId)) @@ -141,12 +142,12 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, { return null; } - ResourceIdentifier managedBy = default; - string kind = default; - ETag? etag = default; ManagedServiceIdentity identity = default; - DesktopVirtualizationSku sku = default; + ETag? etag = default; + string kind = default; + string managedBy = default; ArmPlan plan = default; + DesktopVirtualizationSku sku = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -165,18 +166,14 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("managedBy"u8)) + if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - managedBy = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("etag"u8)) @@ -188,31 +185,32 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, etag = new ETag(property.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (property.NameEquals("kind"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + kind = property.Value.GetString(); continue; } - if (property.NameEquals("sku"u8)) + if (property.NameEquals("managedBy"u8)) + { + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("plan"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); + plan = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("plan"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - plan = JsonSerializer.Deserialize(property.Value.GetRawText()); + sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -345,6 +343,12 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, systemData, tags ?? new ChangeTrackingDictionary(), location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, description, friendlyName, @@ -353,12 +357,6 @@ internal static ScalingPlanData DeserializeScalingPlanData(JsonElement element, exclusionTag, schedules ?? new ChangeTrackingList(), hostPoolReferences ?? new ChangeTrackingList(), - managedBy, - kind, - etag, - identity, - sku, - plan, serializedAdditionalRawData); } @@ -445,18 +443,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" managedBy: "); + builder.Append(" identity: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ManagedBy)) + if (Optional.IsDefined(Identity)) { - builder.Append(" managedBy: "); - builder.AppendLine($"'{ManagedBy.ToString()}'"); + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); } } @@ -483,33 +496,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" etag: "); + builder.Append(" managedBy: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ETag)) + if (Optional.IsDefined(ManagedBy)) { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); + builder.Append(" managedBy: "); + if (ManagedBy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ManagedBy}'''"); + } + else + { + builder.AppendLine($"'{ManagedBy}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" identity: "); + builder.Append(" plan: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Plan)) { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + builder.Append(" plan: "); + BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); } } @@ -528,21 +549,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" plan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Plan)) - { - builder.Append(" plan: "); - BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); - } - } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs index 1590791c9bb0..1b5224782331 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanData.cs @@ -71,6 +71,12 @@ public ScalingPlanData(AzureLocation location, string timeZone) : base(location) /// The systemData. /// The tags. /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. /// ObjectId of scaling plan. (internal use). /// Description of scaling plan. /// User friendly name of scaling plan. @@ -79,15 +85,15 @@ public ScalingPlanData(AzureLocation location, string timeZone) : base(location) /// Exclusion tag for scaling plan. /// List of ScalingPlanPooledSchedule 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. - /// The resource model definition representing SKU. - /// Gets or sets the plan. /// 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) + internal ScalingPlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ETag? etag, string kind, string managedBy, ArmPlan plan, DesktopVirtualizationSku sku, string objectId, string description, string friendlyName, string timeZone, ScalingHostPoolType? scalingHostPoolType, string exclusionTag, IList schedules, IList hostPoolReferences, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Identity = identity; + ETag = etag; + Kind = kind; + ManagedBy = managedBy; + Plan = plan; + Sku = sku; ObjectId = objectId; Description = description; FriendlyName = friendlyName; @@ -96,12 +102,6 @@ internal ScalingPlanData(ResourceIdentifier id, string name, ResourceType resour ExclusionTag = exclusionTag; Schedules = schedules; HostPoolReferences = hostPoolReferences; - ManagedBy = managedBy; - Kind = kind; - ETag = etag; - Identity = identity; - Sku = sku; - Plan = plan; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -110,6 +110,24 @@ internal ScalingPlanData() { } + /// The managed service identities assigned to this resource. + [WirePath("identity")] + public ManagedServiceIdentity Identity { get; set; } + /// If etag is provided in the response body, it may 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; } + /// 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. + [WirePath("kind")] + public string Kind { 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 string ManagedBy { get; set; } + /// Details of the resource plan. + [WirePath("plan")] + public ArmPlan Plan { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + [WirePath("sku")] + public DesktopVirtualizationSku Sku { get; set; } /// ObjectId of scaling plan. (internal use). [WirePath("properties.objectId")] public string ObjectId { get; } @@ -134,23 +152,5 @@ internal ScalingPlanData() /// List of ScalingHostPoolReference definitions. [WirePath("properties.hostPoolReferences")] public IList HostPoolReferences { get; } - /// 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; } - /// 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. - [WirePath("kind")] - public string Kind { get; set; } - /// 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. - [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. - [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..fe0588994e41 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-04-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Cre /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string scalingP /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(in /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSiz /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string scalingPlanSchedule /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string scalingPlanScheduleName, Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPersonalScheduleResource.cs index 4b281661f966..a7c856c6f848 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-04-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationTok /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -278,7 +278,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing ScalingPlanPersonalSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(ScalingPlanPersonalSchedulePatch patch, CancellationToken cancellationToken = default) @@ -312,7 +312,7 @@ public virtual async Task> UpdateA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -320,7 +320,7 @@ public virtual async Task> UpdateA /// /// /// - /// Object containing ScalingPlanPersonalSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(ScalingPlanPersonalSchedulePatch patch, CancellationToken cancellationToken = default) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleCollection.cs index d05cbd661d11..eabed8c649d5 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-04-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string scalingPla /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string scalingPlanSchedule /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string scalingPlanScheduleName, Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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 2efc9cfc241d..1b967748edd3 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.Serialization.cs @@ -41,6 +41,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); @@ -51,6 +56,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); @@ -158,7 +180,10 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu string name = default; ResourceType type = default; SystemData systemData = default; + string name0 = default; IList daysOfWeek = default; + ScalingMethodType? scalingMethod = default; + CreateDeleteProperties createDelete = default; ScalingActionTime rampUpStartTime = default; SessionHostLoadBalancingAlgorithm? rampUpLoadBalancingAlgorithm = default; int? rampUpMinimumHostsPct = default; @@ -212,6 +237,11 @@ 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) @@ -226,6 +256,25 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu daysOfWeek = array; continue; } + if (property0.NameEquals("scalingMethod"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalingMethod = new ScalingMethodType(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) @@ -380,7 +429,10 @@ internal static ScalingPlanPooledScheduleData DeserializeScalingPlanPooledSchedu name, type, systemData, + name0, daysOfWeek ?? new ChangeTrackingList(), + scalingMethod, + createDelete, rampUpStartTime, rampUpLoadBalancingAlgorithm, rampUpMinimumHostsPct, @@ -466,6 +518,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 +564,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/ScalingPlanPooledScheduleData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs index 8fb91ded38fd..19978c2f448d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleData.cs @@ -62,7 +62,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 +83,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, ScalingMethodType? 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 +108,18 @@ internal ScalingPlanPooledScheduleData(ResourceIdentifier id, string name, Resou _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 ScalingMethodType? 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/ScalingPlanPooledScheduleResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanPooledScheduleResource.cs index b18eecd4a47e..18390092bb6d 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-04-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -278,7 +278,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing ScalingPlanPooledSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(ScalingPlanPooledSchedulePatch patch, CancellationToken cancellationToken = default) @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -320,7 +320,7 @@ public virtual async Task> UpdateAsy /// /// /// - /// Object containing ScalingPlanPooledSchedule definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(ScalingPlanPooledSchedulePatch patch, CancellationToken cancellationToken = default) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs index 71ccaf7c9ef1..56125e87683b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs @@ -90,31 +90,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of ScalingPlanPooledScheduleResources in the ScalingPlan. - /// An object representing collection of ScalingPlanPooledScheduleResources and their operations over a ScalingPlanPooledScheduleResource. - public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules() + /// Gets a collection of ScalingPlanPersonalScheduleResources in the ScalingPlan. + /// An object representing collection of ScalingPlanPersonalScheduleResources and their operations over a ScalingPlanPersonalScheduleResource. + public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSchedules() { - return GetCachedClient(client => new ScalingPlanPooledScheduleCollection(client, Id)); + return GetCachedClient(client => new ScalingPlanPersonalScheduleCollection(client, Id)); } /// - /// Get a ScalingPlanPooledSchedule. + /// Get a ScalingPlanPersonalSchedule. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName} /// /// /// Operation Id - /// ScalingPlanPooledSchedules_Get + /// ScalingPlanPersonalSchedules_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -123,29 +123,29 @@ public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetScalingPlanPooledScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public virtual async Task> GetScalingPlanPersonalScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { - return await GetScalingPlanPooledSchedules().GetAsync(scalingPlanScheduleName, cancellationToken).ConfigureAwait(false); + return await GetScalingPlanPersonalSchedules().GetAsync(scalingPlanScheduleName, cancellationToken).ConfigureAwait(false); } /// - /// Get a ScalingPlanPooledSchedule. + /// Get a ScalingPlanPersonalSchedule. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName} /// /// /// Operation Id - /// ScalingPlanPooledSchedules_Get + /// ScalingPlanPersonalSchedules_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -154,36 +154,36 @@ public virtual async Task> GetScalin /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetScalingPlanPooledSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public virtual Response GetScalingPlanPersonalSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { - return GetScalingPlanPooledSchedules().Get(scalingPlanScheduleName, cancellationToken); + return GetScalingPlanPersonalSchedules().Get(scalingPlanScheduleName, cancellationToken); } - /// Gets a collection of ScalingPlanPersonalScheduleResources in the ScalingPlan. - /// An object representing collection of ScalingPlanPersonalScheduleResources and their operations over a ScalingPlanPersonalScheduleResource. - public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSchedules() + /// Gets a collection of ScalingPlanPooledScheduleResources in the ScalingPlan. + /// An object representing collection of ScalingPlanPooledScheduleResources and their operations over a ScalingPlanPooledScheduleResource. + public virtual ScalingPlanPooledScheduleCollection GetScalingPlanPooledSchedules() { - return GetCachedClient(client => new ScalingPlanPersonalScheduleCollection(client, Id)); + return GetCachedClient(client => new ScalingPlanPooledScheduleCollection(client, Id)); } /// - /// Get a ScalingPlanPersonalSchedule. + /// Get a ScalingPlanPooledSchedule. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} /// /// /// Operation Id - /// ScalingPlanPersonalSchedules_Get + /// ScalingPlanPooledSchedules_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -192,29 +192,29 @@ public virtual ScalingPlanPersonalScheduleCollection GetScalingPlanPersonalSched /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetScalingPlanPersonalScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public virtual async Task> GetScalingPlanPooledScheduleAsync(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { - return await GetScalingPlanPersonalSchedules().GetAsync(scalingPlanScheduleName, cancellationToken).ConfigureAwait(false); + return await GetScalingPlanPooledSchedules().GetAsync(scalingPlanScheduleName, cancellationToken).ConfigureAwait(false); } /// - /// Get a ScalingPlanPersonalSchedule. + /// Get a ScalingPlanPooledSchedule. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/personalSchedules/{scalingPlanScheduleName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}/pooledSchedules/{scalingPlanScheduleName} /// /// /// Operation Id - /// ScalingPlanPersonalSchedules_Get + /// ScalingPlanPooledSchedules_Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource - /// + /// /// /// /// @@ -223,9 +223,9 @@ public virtual async Task> GetScal /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetScalingPlanPersonalSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) + public virtual Response GetScalingPlanPooledSchedule(string scalingPlanScheduleName, CancellationToken cancellationToken = default) { - return GetScalingPlanPersonalSchedules().Get(scalingPlanScheduleName, cancellationToken); + return GetScalingPlanPooledSchedules().Get(scalingPlanScheduleName, cancellationToken); } /// @@ -241,7 +241,7 @@ public virtual Response GetScalingPlanPerso /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -281,7 +281,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -321,7 +321,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -417,7 +417,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing scaling plan definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(ScalingPlanPatch patch, CancellationToken cancellationToken = default) @@ -451,7 +451,7 @@ public virtual async Task> UpdateAsync(ScalingPlan /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -459,7 +459,7 @@ public virtual async Task> UpdateAsync(ScalingPlan /// /// /// - /// Object containing scaling plan definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(ScalingPlanPatch patch, CancellationToken cancellationToken = default) @@ -493,7 +493,7 @@ public virtual Response Update(ScalingPlanPatch patch, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -555,7 +555,7 @@ public virtual async Task> AddTagAsync(string key, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -617,7 +617,7 @@ public virtual Response AddTag(string key, string value, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -674,7 +674,7 @@ public virtual async Task> SetTagsAsync(IDictionar /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -731,7 +731,7 @@ public virtual Response SetTags(IDictionary /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -791,7 +791,7 @@ public virtual async Task> RemoveTagAsync(string k /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..b05e6f54e3c5 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-04-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string session /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string sessionHostName, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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-04-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-04-01-preview /// /// /// Resource @@ -263,7 +265,7 @@ public virtual async Task> ExistsAsync(string sessionHostName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -306,7 +308,7 @@ public virtual Response Exists(string sessionHostName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -351,7 +353,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..53b3e96bdf89 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.Serialization.cs @@ -0,0 +1,792 @@ +// 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("VirtualMachineDiskType", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diskInfo: "); + builder.AppendLine("{"); + builder.AppendLine(" diskInfo: {"); + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + 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); + 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..d0061c583713 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostConfigurationData.cs @@ -0,0 +1,196 @@ +// 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. + /// Schema for SessionHostConfiguration properties. + /// + 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. + internal DiskInfoProperties DiskInfo { get; set; } + /// The disk type used by virtual machine in hostpool session host. + [WirePath("properties.diskInfo.type")] + public VirtualMachineDiskType? VirtualMachineDiskType + { + get => DiskInfo is null ? default(VirtualMachineDiskType?) : DiskInfo.VirtualMachineDiskType; + set + { + DiskInfo = value.HasValue ? new DiskInfoProperties(value.Value) : null; + } + } + + /// 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..14aa5f931a85 --- /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); + + SessionHostConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + 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..0690786c0022 --- /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-04-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-04-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-04-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. + /// The resource properties to be updated. + /// 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-04-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. + /// The resource properties to be updated. + /// 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-04-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. + /// Resource create parameters. + /// 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-04-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. + /// Resource create parameters. + /// 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 a157b18ef4a9..354aa18f00ef 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); @@ -106,7 +121,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("sxSStackVersion"u8); writer.WriteStringValue(SxsStackVersion); } - if (Optional.IsDefined(UpdateState)) + if (options.Format != "W" && Optional.IsDefined(UpdateState)) { writer.WritePropertyName("updateState"u8); writer.WriteStringValue(UpdateState.Value.ToString()); @@ -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..c459af047855 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; } @@ -143,13 +162,19 @@ internal SessionHostData(ResourceIdentifier id, string name, ResourceType resour public string SxsStackVersion { get; set; } /// Update state of a SessionHost. [WirePath("properties.updateState")] - public SessionHostUpdateState? UpdateState { get; set; } + public SessionHostUpdateState? UpdateState { get; } /// The timestamp of the last update. [WirePath("properties.lastUpdateTime")] public DateTimeOffset? LastUpdatedOn { get; } /// 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..19c999fdfb0f --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.Serialization.cs @@ -0,0 +1,284 @@ +// 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); + 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; + 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; + } + } + 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, + 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: "); + } + } + + 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); + 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..0551d1f655d2 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementData.cs @@ -0,0 +1,94 @@ +// 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. + /// Schema for SessionHostManagement properties. + /// + 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. + /// Keeps track of any properties unknown to the library. + internal SessionHostManagementData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string scheduledDateTimeZone, HostPoolUpdateConfigurationProperties update, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ScheduledDateTimeZone = scheduledDateTimeZone; + Update = update; + _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; } + } +} 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..a7f45d57026c --- /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); + + SessionHostManagementData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + 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..9662c4545a55 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostManagementResource.cs @@ -0,0 +1,585 @@ +// 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 _controlSessionHostUpdateClientDiagnostics; + private readonly ControlSessionHostUpdateRestOperations _controlSessionHostUpdateRestClient; + private readonly ClientDiagnostics _initiateSessionHostUpdateClientDiagnostics; + private readonly InitiateSessionHostUpdateRestOperations _initiateSessionHostUpdateRestClient; + private readonly ClientDiagnostics _sessionHostManagementsUpdateStatusClientDiagnostics; + private readonly SessionHostManagementsUpdateStatusRestOperations _sessionHostManagementsUpdateStatusRestClient; + 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); + _controlSessionHostUpdateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _controlSessionHostUpdateRestClient = new ControlSessionHostUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _initiateSessionHostUpdateClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _initiateSessionHostUpdateRestClient = new InitiateSessionHostUpdateRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _sessionHostManagementsUpdateStatusClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DesktopVirtualization", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _sessionHostManagementsUpdateStatusRestClient = new SessionHostManagementsUpdateStatusRestOperations(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-04-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-04-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-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The properties to be updated. + /// 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-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The properties to be updated. + /// 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-04-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. + /// Resource create parameters. + /// 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-04-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. + /// Resource create parameters. + /// 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; + } + } + + /// + /// Control actions on a session host update. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate + /// + /// + /// Operation Id + /// ControlSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-04-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. + /// The content of the action request. + /// 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 actions on a session host update. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate + /// + /// + /// Operation Id + /// ControlSessionHostUpdate_Post + /// + /// + /// Default Api Version + /// 2025-04-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. + /// The content of the action request. + /// 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; + } + } + + /// + /// 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-04-01-preview + /// + /// + /// + /// The resource properties to be updated. + /// 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-04-01-preview + /// + /// + /// + /// The resource properties to be updated. + /// 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; + } + } + + /// + /// Get a SessionHostManagementUpdateStatus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default + /// + /// + /// Operation Id + /// SessionHostManagementsUpdateStatus_Get + /// + /// + /// Default Api Version + /// 2025-04-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 a SessionHostManagementUpdateStatus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default + /// + /// + /// Operation Id + /// SessionHostManagementsUpdateStatus_Get + /// + /// + /// Default Api Version + /// 2025-04-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; + } + } + } +} diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs index 4a4feebf385e..a9214f8f689a 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs @@ -109,7 +109,7 @@ public virtual UserSessionCollection GetUserSessions() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetUserSessionAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -171,7 +171,7 @@ public virtual Response GetUserSession(string userSessionId /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -251,7 +251,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -296,7 +296,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -341,7 +341,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -349,7 +349,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// - /// Object containing SessionHost definitions. + /// The resource properties to be updated. /// Force flag to update assign, unassign or reassign personal desktop. /// The cancellation token to use. /// is null. @@ -384,7 +384,7 @@ public virtual async Task> UpdateAsync(SessionHost /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -392,7 +392,7 @@ public virtual async Task> UpdateAsync(SessionHost /// /// /// - /// Object containing SessionHost definitions. + /// The resource properties to be updated. /// Force flag to update assign, unassign or reassign personal desktop. /// The cancellation token to use. /// is null. @@ -413,5 +413,81 @@ 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 + /// SessionHosts_RetryProvisioning + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task RetryProvisioningAsync(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostResource.RetryProvisioning"); + 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 + /// SessionHosts_RetryProvisioning + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response RetryProvisioning(CancellationToken cancellationToken = default) + { + using var scope = _sessionHostClientDiagnostics.CreateScope("SessionHostResource.RetryProvisioning"); + 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..c5979308595c 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-04-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string userSes /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string userSessionId, Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -187,7 +187,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = nu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(int? pageSize = null, bool? /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -263,7 +263,7 @@ public virtual async Task> ExistsAsync(string userSessionId, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Response Exists(string userSessionId, CancellationToken can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..220e8e69e755 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-04-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -228,7 +228,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -273,7 +273,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? force = null, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task DisconnectAsync(CancellationToken cancellati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -349,7 +349,7 @@ public virtual Response Disconnect(CancellationToken cancellationToken = default /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -357,7 +357,7 @@ public virtual Response Disconnect(CancellationToken cancellationToken = default /// /// /// - /// Object containing message includes title and message body. + /// Represents message sent to a UserSession. /// The cancellation token to use. public virtual async Task SendMessageAsync(UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) { @@ -388,7 +388,7 @@ public virtual async Task SendMessageAsync(UserSessionMessage sendMess /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -396,7 +396,7 @@ public virtual async Task SendMessageAsync(UserSessionMessage sendMess /// /// /// - /// Object containing message includes title and message body. + /// Represents message sent to a UserSession. /// The cancellation token to use. public virtual Response SendMessage(UserSessionMessage sendMessage = null, CancellationToken cancellationToken = default) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationCollection.cs index 84122d060881..8eb5ba5ede6b 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-04-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpda /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string applicationName, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -289,7 +289,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSi /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? pageSize = null, /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string applicationName, Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string applicationName, CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> GetIfExi /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationData.Serialization.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationData.Serialization.cs index e0fa0c6b3eb6..27ef0f344937 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationData.Serialization.cs @@ -62,27 +62,13 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsDefined(MsixPackageFamilyName)) { - if (MsixPackageFamilyName != null) - { - writer.WritePropertyName("msixPackageFamilyName"u8); - writer.WriteStringValue(MsixPackageFamilyName); - } - else - { - writer.WriteNull("msixPackageFamilyName"); - } + writer.WritePropertyName("msixPackageFamilyName"u8); + writer.WriteStringValue(MsixPackageFamilyName); } if (Optional.IsDefined(MsixPackageApplicationId)) { - if (MsixPackageApplicationId != null) - { - writer.WritePropertyName("msixPackageApplicationId"u8); - writer.WriteStringValue(MsixPackageApplicationId); - } - else - { - writer.WriteNull("msixPackageApplicationId"); - } + writer.WritePropertyName("msixPackageApplicationId"u8); + writer.WriteStringValue(MsixPackageApplicationId); } if (Optional.IsDefined(ApplicationType)) { @@ -228,21 +214,11 @@ internal static VirtualApplicationData DeserializeVirtualApplicationData(JsonEle } if (property0.NameEquals("msixPackageFamilyName"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - msixPackageFamilyName = null; - continue; - } msixPackageFamilyName = property0.Value.GetString(); continue; } if (property0.NameEquals("msixPackageApplicationId"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - msixPackageApplicationId = null; - continue; - } msixPackageApplicationId = property0.Value.GetString(); continue; } diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupCollection.cs index db5f602715d8..befc5101826a 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-04-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateO /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(Wait /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(st /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string applicationG /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -291,7 +291,7 @@ public virtual AsyncPageable GetAllAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -325,7 +325,7 @@ public virtual Pageable GetAll(string filter = /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -368,7 +368,7 @@ public virtual async Task> ExistsAsync(string applicationGroupNam /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -411,7 +411,7 @@ public virtual Response Exists(string applicationGroupName, CancellationTo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -456,7 +456,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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 7295dcaa7c88..0a9d423fd707 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.Serialization.cs @@ -39,36 +39,37 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ManagedBy)) - { - writer.WritePropertyName("managedBy"u8); - writer.WriteStringValue(ManagedBy); - } - if (Optional.IsDefined(Kind)) + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Kind)) { - writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); } - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(ManagedBy)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); + writer.WritePropertyName("managedBy"u8); + writer.WriteStringValue(ManagedBy); } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); JsonSerializer.Serialize(writer, Plan); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ObjectId)) @@ -104,15 +105,8 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteStringValue(ApplicationGroupType.ToString()); if (options.Format != "W" && Optional.IsDefined(IsCloudPCResource)) { - if (IsCloudPCResource != null) - { - writer.WritePropertyName("cloudPcResource"u8); - writer.WriteBooleanValue(IsCloudPCResource.Value); - } - else - { - writer.WriteNull("cloudPcResource"); - } + writer.WritePropertyName("cloudPcResource"u8); + writer.WriteBooleanValue(IsCloudPCResource.Value); } if (Optional.IsDefined(ShowInFeed)) { @@ -142,12 +136,12 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa { return null; } - ResourceIdentifier managedBy = default; - string kind = default; - ETag? etag = default; ManagedServiceIdentity identity = default; - DesktopVirtualizationSku sku = default; + ETag? etag = default; + string kind = default; + string managedBy = default; ArmPlan plan = default; + DesktopVirtualizationSku sku = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -166,18 +160,14 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("managedBy"u8)) + if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - managedBy = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("etag"u8)) @@ -189,31 +179,32 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa etag = new ETag(property.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (property.NameEquals("kind"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + kind = property.Value.GetString(); continue; } - if (property.NameEquals("sku"u8)) + if (property.NameEquals("managedBy"u8)) + { + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("plan"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); + plan = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("plan"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - plan = JsonSerializer.Deserialize(property.Value.GetRawText()); + sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -307,7 +298,6 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa { if (property0.Value.ValueKind == JsonValueKind.Null) { - cloudPCResource = null; continue; } cloudPCResource = property0.Value.GetBoolean(); @@ -338,6 +328,12 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa systemData, tags ?? new ChangeTrackingDictionary(), location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, description, friendlyName, @@ -346,12 +342,6 @@ internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupDa applicationGroupType, cloudPCResource, showInFeed, - managedBy, - kind, - etag, - identity, - sku, - plan, serializedAdditionalRawData); } @@ -438,18 +428,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" managedBy: "); + builder.Append(" identity: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ManagedBy)) + if (Optional.IsDefined(Identity)) { - builder.Append(" managedBy: "); - builder.AppendLine($"'{ManagedBy.ToString()}'"); + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); } } @@ -476,33 +481,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" etag: "); + builder.Append(" managedBy: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ETag)) + if (Optional.IsDefined(ManagedBy)) { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); + builder.Append(" managedBy: "); + if (ManagedBy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ManagedBy}'''"); + } + else + { + builder.AppendLine($"'{ManagedBy}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" identity: "); + builder.Append(" plan: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Plan)) { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + builder.Append(" plan: "); + BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); } } @@ -521,21 +534,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" plan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Plan)) - { - builder.Append(" plan: "); - BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); - } - } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs index f5ff1a068478..77f04f54cd99 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupData.cs @@ -71,6 +71,12 @@ public VirtualApplicationGroupData(AzureLocation location, ResourceIdentifier ho /// The systemData. /// The tags. /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. /// ObjectId of ApplicationGroup. (internal use). /// Description of ApplicationGroup. /// Friendly name of ApplicationGroup. @@ -79,15 +85,15 @@ public VirtualApplicationGroupData(AzureLocation location, ResourceIdentifier ho /// Resource Type of ApplicationGroup. /// Is cloud pc resource. /// Boolean representing whether the applicationGroup is show in the feed. - /// 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. /// 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) + internal VirtualApplicationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ETag? etag, string kind, string managedBy, ArmPlan plan, DesktopVirtualizationSku sku, string objectId, string description, string friendlyName, ResourceIdentifier hostPoolId, ResourceIdentifier workspaceId, VirtualApplicationGroupType applicationGroupType, bool? isCloudPCResource, bool? showInFeed, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Identity = identity; + ETag = etag; + Kind = kind; + ManagedBy = managedBy; + Plan = plan; + Sku = sku; ObjectId = objectId; Description = description; FriendlyName = friendlyName; @@ -96,12 +102,6 @@ internal VirtualApplicationGroupData(ResourceIdentifier id, string name, Resourc ApplicationGroupType = applicationGroupType; IsCloudPCResource = isCloudPCResource; ShowInFeed = showInFeed; - ManagedBy = managedBy; - Kind = kind; - ETag = etag; - Identity = identity; - Sku = sku; - Plan = plan; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -110,6 +110,24 @@ internal VirtualApplicationGroupData() { } + /// The managed service identities assigned to this resource. + [WirePath("identity")] + public ManagedServiceIdentity Identity { get; set; } + /// If etag is provided in the response body, it may 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; } + /// 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. + [WirePath("kind")] + public string Kind { 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 string ManagedBy { get; set; } + /// Details of the resource plan. + [WirePath("plan")] + public ArmPlan Plan { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + [WirePath("sku")] + public DesktopVirtualizationSku Sku { get; set; } /// ObjectId of ApplicationGroup. (internal use). [WirePath("properties.objectId")] public string ObjectId { get; } @@ -134,23 +152,5 @@ internal VirtualApplicationGroupData() /// Boolean representing whether the applicationGroup is show in the feed. [WirePath("properties.showInFeed")] public bool? ShowInFeed { 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; } - /// 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. - [WirePath("kind")] - public string Kind { get; set; } - /// 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. - [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. - [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..664be336dd83 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-04-01-preview /// /// /// Resource @@ -146,7 +146,7 @@ public virtual async Task> GetVirtualApplic /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -184,7 +184,7 @@ public virtual VirtualDesktopCollection GetVirtualDesktops() /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -215,7 +215,7 @@ public virtual async Task> GetVirtualDesktopAsy /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -246,7 +246,7 @@ public virtual Response GetVirtualDesktop(string desktop /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -286,7 +286,7 @@ public virtual async Task> GetAsync(Ca /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -326,7 +326,7 @@ public virtual Response Get(CancellationToken c /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -370,7 +370,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -414,7 +414,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -422,7 +422,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing ApplicationGroup definitions. + /// The AppGroup properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) @@ -456,7 +456,7 @@ public virtual async Task> UpdateAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -464,7 +464,7 @@ public virtual async Task> UpdateAsync /// /// /// - /// Object containing ApplicationGroup definitions. + /// The AppGroup properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(VirtualApplicationGroupPatch patch, CancellationToken cancellationToken = default) @@ -498,7 +498,7 @@ public virtual Response Update(VirtualApplicati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// @@ -527,7 +527,7 @@ public virtual AsyncPageable GetStartMenuIte /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// @@ -556,7 +556,7 @@ public virtual Pageable GetStartMenuItems(in /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -618,7 +618,7 @@ public virtual async Task> AddTagAsync /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -680,7 +680,7 @@ public virtual Response AddTag(string key, stri /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -737,7 +737,7 @@ public virtual async Task> SetTagsAsyn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -794,7 +794,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -854,7 +854,7 @@ public virtual async Task> RemoveTagAs /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..4f35bbffc285 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-04-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -278,7 +278,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing Application definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(VirtualApplicationPatch patch, CancellationToken cancellationToken = default) @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(Virt /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -320,7 +320,7 @@ public virtual async Task> UpdateAsync(Virt /// /// /// - /// Object containing Application definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(VirtualApplicationPatch patch, CancellationToken cancellationToken = default) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualDesktopCollection.cs index ea22250af43c..9838ae13951b 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-04-01-preview /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task> GetAsync(string desk /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(string desktopName, Cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -187,7 +187,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize = /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(int? pageSize = null, boo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -263,7 +263,7 @@ public virtual async Task> ExistsAsync(string desktopName, Cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Response Exists(string desktopName, CancellationToken cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -351,7 +351,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..86f01eac34a8 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-04-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -190,7 +190,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// - /// Object containing Desktop definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(VirtualDesktopPatch patch, CancellationToken cancellationToken = default) @@ -224,7 +224,7 @@ public virtual async Task> UpdateAsync(VirtualD /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -232,7 +232,7 @@ public virtual async Task> UpdateAsync(VirtualD /// /// /// - /// Object containing Desktop definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(VirtualDesktopPatch patch, CancellationToken cancellationToken = default) diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceCollection.cs index 9a803d5ff4f8..0f5c0b075718 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-04-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string wo /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string workspaceName, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual AsyncPageable GetAllAsync(int? pageSize /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -323,7 +323,7 @@ public virtual Pageable GetAll(int? pageSize = null, b /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -366,7 +366,7 @@ public virtual async Task> ExistsAsync(string workspaceName, Canc /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -409,7 +409,7 @@ public virtual Response Exists(string workspaceName, CancellationToken can /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> GetIfExist /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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 8086e65d7896..d182d193a5b7 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.Serialization.cs @@ -39,36 +39,37 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(ManagedBy)) - { - writer.WritePropertyName("managedBy"u8); - writer.WriteStringValue(ManagedBy); - } - if (Optional.IsDefined(Kind)) + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); } if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Kind)) { - writer.WritePropertyName("identity"u8); - JsonSerializer.Serialize(writer, Identity); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); } - if (Optional.IsDefined(Sku)) + if (Optional.IsDefined(ManagedBy)) { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); + writer.WritePropertyName("managedBy"u8); + writer.WriteStringValue(ManagedBy); } if (Optional.IsDefined(Plan)) { writer.WritePropertyName("plan"u8); JsonSerializer.Serialize(writer, Plan); } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ObjectId)) @@ -88,61 +89,33 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } if (Optional.IsCollectionDefined(ApplicationGroupReferences)) { - if (ApplicationGroupReferences != null) + writer.WritePropertyName("applicationGroupReferences"u8); + writer.WriteStartArray(); + foreach (var item in ApplicationGroupReferences) { - writer.WritePropertyName("applicationGroupReferences"u8); - writer.WriteStartArray(); - foreach (var item in ApplicationGroupReferences) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("applicationGroupReferences"); + writer.WriteStringValue(item); } + writer.WriteEndArray(); } if (options.Format != "W" && Optional.IsDefined(IsCloudPCResource)) { - if (IsCloudPCResource != null) - { - writer.WritePropertyName("cloudPcResource"u8); - writer.WriteBooleanValue(IsCloudPCResource.Value); - } - else - { - writer.WriteNull("cloudPcResource"); - } + writer.WritePropertyName("cloudPcResource"u8); + writer.WriteBooleanValue(IsCloudPCResource.Value); } if (Optional.IsDefined(PublicNetworkAccess)) { - if (PublicNetworkAccess != null) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - else - { - writer.WriteNull("publicNetworkAccess"); - } + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) { - if (PrivateEndpointConnections != null) + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) { - writer.WritePropertyName("privateEndpointConnections"u8); - writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteNull("privateEndpointConnections"); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); } writer.WriteEndObject(); } @@ -167,12 +140,12 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { return null; } - ResourceIdentifier managedBy = default; - string kind = default; - ETag? etag = default; ManagedServiceIdentity identity = default; - DesktopVirtualizationSku sku = default; + ETag? etag = default; + string kind = default; + string managedBy = default; ArmPlan plan = default; + DesktopVirtualizationSku sku = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -190,18 +163,14 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("managedBy"u8)) + if (property.NameEquals("identity"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - managedBy = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); continue; } if (property.NameEquals("etag"u8)) @@ -213,31 +182,32 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement etag = new ETag(property.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (property.NameEquals("kind"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + kind = property.Value.GetString(); continue; } - if (property.NameEquals("sku"u8)) + if (property.NameEquals("managedBy"u8)) + { + managedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("plan"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); + plan = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("plan"u8)) + if (property.NameEquals("sku"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - plan = JsonSerializer.Deserialize(property.Value.GetRawText()); + sku = DesktopVirtualizationSku.DeserializeDesktopVirtualizationSku(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -311,7 +281,6 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { if (property0.Value.ValueKind == JsonValueKind.Null) { - applicationGroupReferences = null; continue; } List array = new List(); @@ -326,7 +295,6 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { if (property0.Value.ValueKind == JsonValueKind.Null) { - cloudPCResource = null; continue; } cloudPCResource = property0.Value.GetBoolean(); @@ -336,7 +304,6 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { if (property0.Value.ValueKind == JsonValueKind.Null) { - publicNetworkAccess = null; continue; } publicNetworkAccess = new DesktopVirtualizationPublicNetworkAccess(property0.Value.GetString()); @@ -346,7 +313,6 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement { if (property0.Value.ValueKind == JsonValueKind.Null) { - privateEndpointConnections = null; continue; } List array = new List(); @@ -373,6 +339,12 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement systemData, tags ?? new ChangeTrackingDictionary(), location, + identity, + etag, + kind, + managedBy, + plan, + sku, objectId, description, friendlyName, @@ -380,12 +352,6 @@ internal static VirtualWorkspaceData DeserializeVirtualWorkspaceData(JsonElement cloudPCResource, publicNetworkAccess, privateEndpointConnections ?? new ChangeTrackingList(), - managedBy, - kind, - etag, - identity, - sku, - plan, serializedAdditionalRawData); } @@ -472,18 +438,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" managedBy: "); + builder.Append(" identity: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ManagedBy)) + if (Optional.IsDefined(Identity)) { - builder.Append(" managedBy: "); - builder.AppendLine($"'{ManagedBy.ToString()}'"); + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); } } @@ -510,33 +491,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedBy), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" etag: "); + builder.Append(" managedBy: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ETag)) + if (Optional.IsDefined(ManagedBy)) { - builder.Append(" etag: "); - builder.AppendLine($"'{ETag.Value.ToString()}'"); + builder.Append(" managedBy: "); + if (ManagedBy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ManagedBy}'''"); + } + else + { + builder.AppendLine($"'{ManagedBy}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" identity: "); + builder.Append(" plan: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Plan)) { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + builder.Append(" plan: "); + BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); } } @@ -555,21 +544,6 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Plan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" plan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Plan)) - { - builder.Append(" plan: "); - BicepSerializationHelpers.AppendChildObject(builder, Plan, options, 2, false, " plan: "); - } - } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs index 907903d5edc7..123e82c11e8b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceData.cs @@ -66,6 +66,12 @@ public VirtualWorkspaceData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. + /// The managed service identities assigned to this resource. + /// If etag is provided in the response body, it may 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. + /// 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 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. + /// Details of the resource plan. + /// The SKU (Stock Keeping Unit) assigned to this resource. /// ObjectId of Workspace. (internal use). /// Description of Workspace. /// Friendly name of Workspace. @@ -73,15 +79,15 @@ public VirtualWorkspaceData(AzureLocation location) : base(location) /// 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. /// 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. /// 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) + internal VirtualWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, ETag? etag, string kind, string managedBy, ArmPlan plan, DesktopVirtualizationSku sku, string objectId, string description, string friendlyName, IList applicationGroupReferences, bool? isCloudPCResource, DesktopVirtualizationPublicNetworkAccess? publicNetworkAccess, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { + Identity = identity; + ETag = etag; + Kind = kind; + ManagedBy = managedBy; + Plan = plan; + Sku = sku; ObjectId = objectId; Description = description; FriendlyName = friendlyName; @@ -89,12 +95,6 @@ internal VirtualWorkspaceData(ResourceIdentifier id, string name, ResourceType r IsCloudPCResource = isCloudPCResource; PublicNetworkAccess = publicNetworkAccess; PrivateEndpointConnections = privateEndpointConnections; - ManagedBy = managedBy; - Kind = kind; - ETag = etag; - Identity = identity; - Sku = sku; - Plan = plan; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -103,6 +103,24 @@ internal VirtualWorkspaceData() { } + /// The managed service identities assigned to this resource. + [WirePath("identity")] + public ManagedServiceIdentity Identity { get; set; } + /// If etag is provided in the response body, it may 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; } + /// 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. + [WirePath("kind")] + public string Kind { 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 string ManagedBy { get; set; } + /// Details of the resource plan. + [WirePath("plan")] + public ArmPlan Plan { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + [WirePath("sku")] + public DesktopVirtualizationSku Sku { get; set; } /// ObjectId of Workspace. (internal use). [WirePath("properties.objectId")] public string ObjectId { get; } @@ -114,7 +132,7 @@ internal VirtualWorkspaceData() public string FriendlyName { get; set; } /// List of applicationGroup resource Ids. [WirePath("properties.applicationGroupReferences")] - public IList ApplicationGroupReferences { get; set; } + public IList ApplicationGroupReferences { get; } /// Is cloud pc resource. [WirePath("properties.cloudPcResource")] public bool? IsCloudPCResource { get; } @@ -124,23 +142,5 @@ internal VirtualWorkspaceData() /// List of private endpoint connection associated with the specified resource. [WirePath("properties.privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } - /// 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; } - /// 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. - [WirePath("kind")] - public string Kind { get; set; } - /// 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. - [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. - [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..327994c44bb7 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualWorkspaceResource.cs @@ -103,7 +103,7 @@ public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateE } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -115,7 +115,7 @@ public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateE /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -123,7 +123,7 @@ public virtual WorkspacePrivateEndpointConnectionCollection GetWorkspacePrivateE /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -134,7 +134,7 @@ public virtual async Task> } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -146,7 +146,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -154,7 +154,7 @@ public virtual async Task> /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -177,7 +177,7 @@ public virtual Response GetWorkspace /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -217,7 +217,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -301,7 +301,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -345,7 +345,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -353,7 +353,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// - /// Object containing Workspace definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual async Task> UpdateAsync(VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) @@ -387,7 +387,7 @@ public virtual async Task> UpdateAsync(Virtua /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -395,7 +395,7 @@ public virtual async Task> UpdateAsync(Virtua /// /// /// - /// Object containing Workspace definitions. + /// The resource properties to be updated. /// The cancellation token to use. /// is null. public virtual Response Update(VirtualWorkspacePatch patch, CancellationToken cancellationToken = default) @@ -429,7 +429,7 @@ public virtual Response Update(VirtualWorkspacePatch p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// @@ -458,7 +458,7 @@ public virtual AsyncPageable GetPr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// @@ -487,7 +487,7 @@ public virtual Pageable GetPrivate /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -549,7 +549,7 @@ public virtual async Task> AddTagAsync(string /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -611,7 +611,7 @@ public virtual Response AddTag(string key, string valu /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -668,7 +668,7 @@ public virtual async Task> SetTagsAsync(IDict /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -725,7 +725,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -785,7 +785,7 @@ public virtual async Task> RemoveTagAsync(str /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-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..f4821c121658 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionCollection.cs @@ -14,7 +14,6 @@ using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DesktopVirtualization.Models; namespace Azure.ResourceManager.DesktopVirtualization { @@ -65,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -74,22 +73,22 @@ 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("WorkspacePrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection, cancellationToken).ConfigureAwait(false); - var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection); + var response = await _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); + var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new WorkspacePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -116,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -125,22 +124,22 @@ public virtual async Task /// /// 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 private endpoint connection associated with the Azure resource. - /// Object containing the updated connection. + /// The name parameter for private endpoint. + /// Resource create parameters. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("WorkspacePrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection, cancellationToken); - var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, connection); + var response = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); + var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new WorkspacePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -155,7 +154,7 @@ public virtual ArmOperation CreateOr } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -167,7 +166,7 @@ public virtual ArmOperation CreateOr /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -175,7 +174,7 @@ public virtual ArmOperation CreateOr /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -200,7 +199,7 @@ public virtual async Task> } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -212,7 +211,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -220,7 +219,7 @@ public virtual async Task> /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -245,7 +244,7 @@ public virtual Response Get(string p } /// - /// List private endpoint connections. + /// List private endpoint connections associated with Workspace. /// /// /// Request Path @@ -257,7 +256,7 @@ public virtual Response Get(string p /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -275,7 +274,7 @@ public virtual AsyncPageable GetAllA } /// - /// List private endpoint connections. + /// List private endpoint connections associated with Workspace. /// /// /// Request Path @@ -287,7 +286,7 @@ public virtual AsyncPageable GetAllA /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -317,7 +316,7 @@ public virtual Pageable GetAll(Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -325,7 +324,7 @@ public virtual Pageable GetAll(Cance /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -360,7 +359,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -368,7 +367,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -403,7 +402,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -411,7 +410,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -448,7 +447,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -456,7 +455,7 @@ public virtual async Task /// /// - /// The name of the private endpoint connection associated with the Azure resource. + /// The name parameter for private endpoint. /// 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/WorkspacePrivateEndpointConnectionResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs index d7cc80f7a684..45b49add0263 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/WorkspacePrivateEndpointConnectionResource.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DesktopVirtualization.Models; namespace Azure.ResourceManager.DesktopVirtualization { @@ -90,7 +89,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -102,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -130,7 +129,7 @@ public virtual async Task> } /// - /// Get a private endpoint connection. + /// Get a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -142,7 +141,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -170,7 +169,7 @@ public virtual Response Get(Cancella } /// - /// Remove a connection. + /// Delete a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -182,7 +181,7 @@ public virtual Response Get(Cancella /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -214,7 +213,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Remove a connection. + /// Delete a PrivateEndpointConnectionWithSystemData /// /// /// Request Path @@ -226,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -270,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -279,19 +278,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// 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 the updated connection. + /// Resource create parameters. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("WorkspacePrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = await _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection, cancellationToken).ConfigureAwait(false); - var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection); + var response = await _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspaceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new WorkspacePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -318,7 +317,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-04-03 + /// 2025-04-01-preview /// /// /// Resource @@ -327,19 +326,19 @@ public virtual async Task /// /// 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 the updated connection. + /// Resource create parameters. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnection connection, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DesktopVirtualizationPrivateEndpointConnectionDataData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(connection, nameof(connection)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("WorkspacePrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection, cancellationToken); - var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, connection); + var response = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateByWorkspace(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _workspacePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateByWorkspaceRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new DesktopVirtualizationArmOperation(Response.FromValue(new WorkspacePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) 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..dbb1335aca5d --- /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_ActiveSessionHostConfigurationsGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-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..b5190094eee7 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-04-01-preview/examples/AppAttachPackage_CreateOrUpdate.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 @@ -41,7 +41,7 @@ public async Task CreateOrUpdate_AppAttachPackageCreate() // invoke the operation string appAttachPackageName = "msixpackagefullname"; - AppAttachPackageData data = new AppAttachPackageData(new AzureLocation("southcentralus"), new AppAttachPackageProperties + AppAttachPackageData data = new AppAttachPackageData(new AzureLocation("southcentralus")) { Image = new AppAttachPackageInfoProperties { @@ -76,9 +76,9 @@ public async Task CreateOrUpdate_AppAttachPackageCreate() CertificateExpireOn = DateTimeOffset.Parse("2023-01-02T17:18:19.1234567Z"), }, HostPoolReferences = { }, - KeyVaultUri = new Uri(""), + KeyVaultURL = "", FailHealthCheckOnStagingFailure = FailHealthCheckOnStagingFailure.NeedsAssistance, - }); + }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, appAttachPackageName, data); AppAttachPackageResource result = lro.Value; @@ -93,7 +93,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-04-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 +126,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-04-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 +162,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-04-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 +191,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-04-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..6b1f9a78e348 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-04-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-04-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-04-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 @@ -93,7 +93,47 @@ public async Task Update_AppAttachPackageUpdate() AppAttachPackageResource appAttachPackage = client.GetAppAttachPackageResource(appAttachPackageResourceId); // invoke the operation - AppAttachPackagePatch patch = new AppAttachPackagePatch(); + AppAttachPackagePatch patch = new AppAttachPackagePatch + { + Properties = new AppAttachPackagePatchProperties + { + Image = new AppAttachPackageInfoProperties + { + PackageAlias = "msixpackagealias", + ImagePath = "imagepath", + PackageName = "MsixPackageName", + PackageFamilyName = "MsixPackage_FamilyName", + PackageFullName = "MsixPackage_FullName", + DisplayName = "displayname", + PackageRelativePath = "packagerelativepath", + IsRegularRegistration = false, + IsActive = false, + PackageDependencies = {new MsixPackageDependencies +{ +DependencyName = "MsixPackage_Dependency_Name", +Publisher = "MsixPackage_Dependency_Publisher", +MinVersion = "packageDep_version", +}}, + Version = "packageversion", + LastUpdatedOn = DateTimeOffset.Parse("2008-09-22T14:01:54.9571247Z"), + PackageApplications = {new MsixPackageApplications +{ +AppId = "AppId", +Description = "PackageApplicationDescription", +AppUserModelId = "AppUserModelId", +FriendlyName = "FriendlyName", +IconImageName = "Iconimagename", +RawIcon = BinaryData.FromObjectAsJson("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), +RawPng = BinaryData.FromObjectAsJson("VGhpcyBpcyBhIHN0cmluZyB0byBoYXNo"), +}}, + CertificateName = "certName", + CertificateExpireOn = DateTimeOffset.Parse("2023-01-02T17:18:19.1234567Z"), + }, + HostPoolReferences = { new ResourceIdentifier("/subscriptions/d15725f7-6577-4a8c-95f1-3da903b42364/resourcegroups/charlesk-southcentralus/providers/Microsoft.DesktopVirtualization/hostPool/hp1"), new ResourceIdentifier("/subscriptions/d15725f7-6577-4a8c-95f1-3da903b42364/resourcegroups/charlesk-southcentralus/providers/Microsoft.DesktopVirtualization/hostPool/hp2") }, + KeyVaultUri = new Uri("url"), + FailHealthCheckOnStagingFailure = FailHealthCheckOnStagingFailure.DoNotFail, + }, + }; AppAttachPackageResource result = await appAttachPackage.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well 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..b4eba95264a6 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 @@ -19,9 +19,9 @@ public partial class Sample_HostPoolCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_HostPoolCreate() + public async Task CreateOrUpdate_HostPoolsCreateOrUpdate() { - // 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-04-01-preview/examples/HostPool_CreateOrUpdate.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 @@ -74,6 +74,11 @@ public async Task CreateOrUpdate_HostPoolCreate() DayOfWeek = DesktopVirtualizationDayOfWeek.Saturday, }}, }, + ManagedPrivateUDP = ManagedPrivateUDP.Enabled, + DirectUDP = DirectUDP.Enabled, + PublicUDP = PublicUDP.Enabled, + RelayUDP = RelayUDP.Enabled, + ManagementType = ManagementType.Automated, Tags = { ["tag1"] = "value1", @@ -92,9 +97,9 @@ public async Task CreateOrUpdate_HostPoolCreate() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_HostPoolGet() + public async Task Get_HostPoolsGet() { - // 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-04-01-preview/examples/HostPools_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 @@ -125,9 +130,9 @@ public async Task Get_HostPoolGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_HostPoolListByResourceGroup() + public async Task GetAll_HostPoolsListByResourceGroup() { - // 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-04-01-preview/examples/HostPools_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 @@ -163,9 +168,9 @@ public async Task GetAll_HostPoolListByResourceGroup() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_HostPoolGet() + public async Task Exists_HostPoolsGet() { - // 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-04-01-preview/examples/HostPools_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 @@ -192,9 +197,9 @@ public async Task Exists_HostPoolGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_HostPoolGet() + public async Task GetIfExists_HostPoolsGet() { - // 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-04-01-preview/examples/HostPools_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..7577dcf705ff 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 @@ -18,9 +18,9 @@ public partial class Sample_HostPoolPrivateEndpointConnectionCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() + public async Task CreateOrUpdate_PrivateEndpointConnectionsUpdateByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -41,7 +41,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() // invoke the operation string privateEndpointConnectionName = "hostPool1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; - DesktopVirtualizationPrivateEndpointConnection connection = new DesktopVirtualizationPrivateEndpointConnection + DesktopVirtualizationPrivateEndpointConnectionDataData data = new DesktopVirtualizationPrivateEndpointConnectionDataData { ConnectionState = new DesktopVirtualizationPrivateLinkServiceConnectionState { @@ -50,7 +50,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() ActionsRequired = "None", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, connection); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); HostPoolPrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -62,9 +62,9 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_PrivateEndpointConnectionGetByHostPool() + public async Task Get_PrivateEndpointConnectionsGetByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -96,9 +96,9 @@ public async Task Get_PrivateEndpointConnectionGetByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_PrivateEndpointConnectionListByHostPool() + public async Task GetAll_PrivateEndpointConnectionsListByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -132,9 +132,9 @@ public async Task GetAll_PrivateEndpointConnectionListByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_PrivateEndpointConnectionGetByHostPool() + public async Task Exists_PrivateEndpointConnectionsGetByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -162,9 +162,9 @@ public async Task Exists_PrivateEndpointConnectionGetByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_PrivateEndpointConnectionGetByHostPool() + public async Task GetIfExists_PrivateEndpointConnectionsGetByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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..c01e1c6c444c 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 @@ -18,9 +18,9 @@ public partial class Sample_HostPoolPrivateEndpointConnectionResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_PrivateEndpointConnectionGetByHostPool() + public async Task Get_PrivateEndpointConnectionsGetByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -49,9 +49,9 @@ public async Task Get_PrivateEndpointConnectionGetByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_PrivateEndpointConnectionDeleteByHostPool() + public async Task Delete_PrivateEndpointConnectionsDeleteByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -76,9 +76,9 @@ public async Task Delete_PrivateEndpointConnectionDeleteByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_PrivateEndpointConnectionUpdateByHostPool() + public async Task Update_PrivateEndpointConnectionsUpdateByHostPool() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -96,7 +96,7 @@ public async Task Update_PrivateEndpointConnectionUpdateByHostPool() HostPoolPrivateEndpointConnectionResource hostPoolPrivateEndpointConnection = client.GetHostPoolPrivateEndpointConnectionResource(hostPoolPrivateEndpointConnectionResourceId); // invoke the operation - DesktopVirtualizationPrivateEndpointConnection connection = new DesktopVirtualizationPrivateEndpointConnection + DesktopVirtualizationPrivateEndpointConnectionDataData data = new DesktopVirtualizationPrivateEndpointConnectionDataData { ConnectionState = new DesktopVirtualizationPrivateLinkServiceConnectionState { @@ -105,7 +105,7 @@ public async Task Update_PrivateEndpointConnectionUpdateByHostPool() ActionsRequired = "None", }, }; - ArmOperation lro = await hostPoolPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, connection); + ArmOperation lro = await hostPoolPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); HostPoolPrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well 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..7abab911a541 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 @@ -18,9 +18,9 @@ public partial class Sample_HostPoolResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_HostPoolGet() + public async Task Get_HostPoolsGet() { - // 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-04-01-preview/examples/HostPools_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 @@ -48,9 +48,9 @@ public async Task Get_HostPoolGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_HostPoolDelete() + public async Task Delete_HostPoolsDelete() { - // 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-04-01-preview/examples/HostPools_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 @@ -75,9 +75,9 @@ public async Task Delete_HostPoolDelete() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_HostPoolUpdate() + public async Task Update_HostPoolsUpdate() { - // 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-04-01-preview/examples/HostPools_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 @@ -101,29 +101,31 @@ public async Task Update_HostPoolUpdate() ["tag1"] = "value1", ["tag2"] = "value2" }, - FriendlyName = "friendly", - Description = "des1", - CustomRdpProperty = null, - MaxSessionLimit = 999999, - PersonalDesktopAssignmentType = PersonalDesktopAssignmentType.Automatic, - LoadBalancerType = HostPoolLoadBalancerType.BreadthFirst, - RegistrationInfo = new HostPoolRegistrationInfoPatch + Properties = new HostPoolPatchProperties { - ExpireOn = DateTimeOffset.Parse("2020-10-01T15:01:54.9571247Z"), - RegistrationTokenOperation = HostPoolRegistrationTokenOperation.Update, - }, - VmTemplate = "{json:json}", - SsoAdfsAuthority = "https://adfs", - SsoClientId = "client", - SsoClientSecretKeyVaultPath = "https://keyvault/secret", - SsoSecretType = HostPoolSsoSecretType.SharedKey, - StartVmOnConnect = false, - AgentUpdate = new SessionHostAgentUpdatePatchProperties - { - UpdateType = SessionHostComponentUpdateType.Scheduled, - DoesUseSessionHostLocalTime = false, - MaintenanceWindowTimeZone = "Alaskan Standard Time", - MaintenanceWindows = {new MaintenanceWindowPatchProperties + FriendlyName = "friendly", + Description = "des1", + CustomRdpProperty = null, + MaxSessionLimit = 999999, + PersonalDesktopAssignmentType = PersonalDesktopAssignmentType.Automatic, + LoadBalancerType = HostPoolLoadBalancerType.BreadthFirst, + RegistrationInfo = new HostPoolRegistrationInfoPatch + { + ExpireOn = DateTimeOffset.Parse("2020-10-01T15:01:54.9571247Z"), + RegistrationTokenOperation = HostPoolRegistrationTokenOperation.Update, + }, + VmTemplate = "{json:json}", + SsoadfsAuthority = "https://adfs", + SsoClientId = "client", + SsoClientSecretKeyVaultPath = "https://keyvault/secret", + SsoSecretType = HostPoolSsoSecretType.SharedKey, + StartVmOnConnect = false, + AgentUpdate = new SessionHostAgentUpdatePatchProperties + { + UpdateType = SessionHostComponentUpdateType.Scheduled, + DoesUseSessionHostLocalTime = false, + MaintenanceWindowTimeZone = "Alaskan Standard Time", + MaintenanceWindows = {new MaintenanceWindowPatchProperties { Hour = 7, DayOfWeek = DesktopVirtualizationDayOfWeek.Friday, @@ -132,6 +134,11 @@ public async Task Update_HostPoolUpdate() Hour = 8, DayOfWeek = DesktopVirtualizationDayOfWeek.Saturday, }}, + }, + ManagedPrivateUDP = ManagedPrivateUDP.Enabled, + DirectUDP = DirectUDP.Enabled, + PublicUDP = PublicUDP.Enabled, + RelayUDP = RelayUDP.Enabled, }, }; HostPoolResource result = await hostPool.UpdateAsync(patch); @@ -145,10 +152,10 @@ public async Task Update_HostPoolUpdate() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() + public async Task GetRegistrationTokens_HostPoolsListRegistrationTokens() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/HostPools_ListRegistrationTokens.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(); @@ -164,7 +171,7 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); // invoke the operation and iterate over the result - await foreach (DesktopVirtualizationPrivateLinkResourceData item in hostPool.GetPrivateLinkResourcesAsync()) + await foreach (RegistrationTokenMinimal item in hostPool.GetRegistrationTokensAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -174,9 +181,35 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetScalingPlans_ScalingPlanListByHostPool() + public async Task RetrieveRegistrationToken_HostPoolsRetrieveRegistrationToken() { - // 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-04-01-preview/examples/HostPools_RetrieveRegistrationToken.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 + 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 + HostPoolRegistrationInfo result = await hostPool.RetrieveRegistrationTokenAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetScalingPlans_ScalingPlansListByHostPool() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/ScalingPlans_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 @@ -210,10 +243,10 @@ public async Task GetScalingPlans_ScalingPlanListByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task RetrieveRegistrationToken_HostPoolsRetrieveRegistrationTokenPost() + public async Task ExpandMsixImages_MsixImagesExpand() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/MsixImages_Expand.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 TokenCredential cred = new DefaultAzureCredential(); @@ -224,22 +257,29 @@ public async Task RetrieveRegistrationToken_HostPoolsRetrieveRegistrationTokenPo // 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"; + string hostPoolName = "hostpool1"; ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); - // invoke the operation - HostPoolRegistrationInfo result = await hostPool.RetrieveRegistrationTokenAsync(); + // invoke the operation and iterate over the result + MsixImageUri msixImageUri = new MsixImageUri + { + Uri = new Uri("https://url.com/imagePath"), + }; + await foreach (ExpandMsixImage item in hostPool.ExpandMsixImagesAsync(msixImageUri)) + { + Console.WriteLine($"Succeeded: {item}"); + } - Console.WriteLine($"Succeeded: {result}"); + Console.WriteLine("Succeeded"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task GetUserSessions_UserSessionListByHostPool() + public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/AppAttachPackageInfo_Import.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 TokenCredential cred = new DefaultAzureCredential(); @@ -250,20 +290,21 @@ public async Task GetUserSessions_UserSessionListByHostPool() // 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"; + string hostPoolName = "hostpool1"; ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); // invoke the operation and iterate over the result - string filter = "userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"; - int? pageSize = 10; - bool? isDescending = true; - int? initialSkip = 0; - await foreach (UserSessionResource item in hostPool.GetUserSessionsAsync(filter: filter, pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) + ImportPackageInfoContent content = new ImportPackageInfoContent + { + Path = "https://url.com/imagePath", + PackageArchitecture = AppAttachPackageArchitecture.X64, + }; + await foreach (AppAttachPackageResource item in hostPool.ImportAppAttachPackageInfosAsync(content)) { // the variable item 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 - UserSessionData resourceData = item.Data; + AppAttachPackageData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -273,10 +314,10 @@ public async Task GetUserSessions_UserSessionListByHostPool() [Test] [Ignore("Only validating compilation of examples")] - public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() + public async Task GetPrivateLinkResources_PrivateLinkResourcesListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-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 TokenCredential cred = new DefaultAzureCredential(); @@ -287,23 +328,14 @@ public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() // 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"; + string hostPoolName = "hostPool1"; ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); // invoke the operation and iterate over the result - ImportPackageInfoContent content = new ImportPackageInfoContent - { - Path = "imagepath", - PackageArchitecture = AppAttachPackageArchitecture.X64, - }; - await foreach (AppAttachPackageResource item in hostPool.ImportAppAttachPackageInfosAsync(content)) + await foreach (DesktopVirtualizationPrivateLinkResourceData item in hostPool.GetPrivateLinkResourcesAsync()) { - // the variable item 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 - AppAttachPackageData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); @@ -311,10 +343,10 @@ public async Task ImportAppAttachPackageInfos_AppAttachPackageInfoImport() [Test] [Ignore("Only validating compilation of examples")] - public async Task ExpandMsixImages_MsixImageExpand() + public async Task GetUserSessions_UserSessionListByHostPool() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/UserSessions_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 TokenCredential cred = new DefaultAzureCredential(); @@ -325,18 +357,22 @@ public async Task ExpandMsixImages_MsixImageExpand() // 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"; + string hostPoolName = "hostPool1"; ResourceIdentifier hostPoolResourceId = HostPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, hostPoolName); HostPoolResource hostPool = client.GetHostPoolResource(hostPoolResourceId); // invoke the operation and iterate over the result - MsixImageUri msixImageUri = new MsixImageUri - { - Uri = new Uri("imagepath"), - }; - await foreach (ExpandMsixImage item in hostPool.ExpandMsixImagesAsync(msixImageUri)) + string filter = "userPrincipalName eq 'user1@microsoft.com' and state eq 'active'"; + int? pageSize = 10; + bool? isDescending = true; + int? initialSkip = 0; + await foreach (UserSessionResource item in hostPool.GetUserSessionsAsync(filter: filter, pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) { - Console.WriteLine($"Succeeded: {item}"); + // the variable item 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 + UserSessionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); 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..4a7a9cf8100d 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 @@ -18,9 +18,9 @@ public partial class Sample_MsixPackageCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_MSIXPackageCreate() + public async Task CreateOrUpdate_MSIXPackagesCreate() { - // 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-04-01-preview/examples/MSIXPackages_CreateOrUpdate.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 @@ -81,9 +81,9 @@ public async Task CreateOrUpdate_MSIXPackageCreate() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_MSIXPackageGet() + public async Task Get_MSIXPackagesGet() { - // 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-04-01-preview/examples/MSIXPackages_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 @@ -115,9 +115,9 @@ public async Task Get_MSIXPackageGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_MSIXPackageList() + public async Task GetAll_MSIXPackagesList() { - // 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-04-01-preview/examples/MSIXPackages_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 @@ -154,9 +154,9 @@ public async Task GetAll_MSIXPackageList() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_MSIXPackageGet() + public async Task Exists_MSIXPackagesGet() { - // 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-04-01-preview/examples/MSIXPackages_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 @@ -184,9 +184,9 @@ public async Task Exists_MSIXPackageGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_MSIXPackageGet() + public async Task GetIfExists_MSIXPackagesGet() { - // 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-04-01-preview/examples/MSIXPackages_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..43081f53c2ea 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 @@ -18,9 +18,9 @@ public partial class Sample_MsixPackageResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_MSIXPackageGet() + public async Task Get_MSIXPackagesGet() { - // 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-04-01-preview/examples/MSIXPackages_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 @@ -49,9 +49,9 @@ public async Task Get_MSIXPackageGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_MSIXPackageDelete() + public async Task Delete_MSIXPackagesDelete() { - // 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-04-01-preview/examples/MSIXPackages_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-04-01-preview/examples/MSIXPackages_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 @@ -98,9 +98,12 @@ public async Task Update_MSIXPackageUpdate() // invoke the operation MsixPackagePatch patch = new MsixPackagePatch { - IsActive = true, - IsRegularRegistration = false, - DisplayName = "displayname", + Properties = new MsixPackagePatchProperties + { + IsActive = true, + IsRegularRegistration = false, + DisplayName = "displayname", + }, }; MsixPackageResource result = await msixPackage.UpdateAsync(patch); 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..69ff9221e14c 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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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..fc3f18d5b0de 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-04-01-preview/examples/ScalingPlanPersonalSchedules_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 @@ -84,7 +84,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-04-01-preview/examples/ScalingPlanPersonalSchedules_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 +118,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-04-01-preview/examples/ScalingPlanPersonalSchedules_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 +157,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-04-01-preview/examples/ScalingPlanPersonalSchedules_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 +187,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-04-01-preview/examples/ScalingPlanPersonalSchedules_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..e8e0d31e0ad7 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-04-01-preview/examples/ScalingPlanPersonalSchedules_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-04-01-preview/examples/ScalingPlanPersonalSchedules_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-04-01-preview/examples/ScalingPlanPersonalSchedules_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 @@ -98,22 +98,25 @@ public async Task Update_ScalingPlanPersonalSchedulesUpdate() // invoke the operation ScalingPlanPersonalSchedulePatch patch = new ScalingPlanPersonalSchedulePatch { - PeakStartTime = new ScalingActionTime(8, 0), - PeakActionOnDisconnect = SessionHandlingOperation.None, - PeakMinutesToWaitOnDisconnect = 10, - PeakActionOnLogoff = SessionHandlingOperation.Deallocate, - PeakMinutesToWaitOnLogoff = 10, - RampDownStartTime = new ScalingActionTime(18, 0), - RampDownActionOnDisconnect = SessionHandlingOperation.None, - RampDownMinutesToWaitOnDisconnect = 10, - RampDownActionOnLogoff = SessionHandlingOperation.Deallocate, - RampDownMinutesToWaitOnLogoff = 10, - OffPeakStartTime = new ScalingActionTime(20, 0), - OffPeakStartVmOnConnect = SetStartVmOnConnect.Disable, - OffPeakActionOnDisconnect = SessionHandlingOperation.None, - OffPeakMinutesToWaitOnDisconnect = 10, - OffPeakActionOnLogoff = SessionHandlingOperation.Deallocate, - OffPeakMinutesToWaitOnLogoff = 10, + Properties = new ScalingPlanPersonalSchedulePatchProperties + { + PeakStartTime = new ScalingActionTime(8, 0), + PeakActionOnDisconnect = SessionHandlingOperation.None, + PeakMinutesToWaitOnDisconnect = 10, + PeakActionOnLogoff = SessionHandlingOperation.Deallocate, + PeakMinutesToWaitOnLogoff = 10, + RampDownStartTime = new ScalingActionTime(18, 0), + RampDownActionOnDisconnect = SessionHandlingOperation.None, + RampDownMinutesToWaitOnDisconnect = 10, + RampDownActionOnLogoff = SessionHandlingOperation.Deallocate, + RampDownMinutesToWaitOnLogoff = 10, + OffPeakStartTime = new ScalingActionTime(20, 0), + OffPeakStartVmOnConnect = SetStartVmOnConnect.Disable, + OffPeakActionOnDisconnect = SessionHandlingOperation.None, + OffPeakMinutesToWaitOnDisconnect = 10, + OffPeakActionOnLogoff = SessionHandlingOperation.Deallocate, + OffPeakMinutesToWaitOnLogoff = 10, + }, }; ScalingPlanPersonalScheduleResource result = await scalingPlanPersonalSchedule.UpdateAsync(patch); 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..bf5b96d5c760 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 @@ -20,7 +20,7 @@ public partial class Sample_ScalingPlanPooledScheduleCollection [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-04-01-preview/examples/ScalingPlanPooledSchedules_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 @@ -70,11 +70,71 @@ public async Task CreateOrUpdate_ScalingPlanPooledSchedulesCreate() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ScalingPlanPooledSchedulesCreateUsingCreateDelete() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/ScalingPlanPooledSchedules_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 + { + DaysOfWeek = { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, + ScalingMethod = ScalingMethodType.CreateDeletePowerManage, + CreateDelete = new CreateDeleteProperties + { + RampUpMaximumHostPoolSize = 10, + RampUpMinimumHostPoolSize = 5, + RampDownMaximumHostPoolSize = 7, + RampDownMinimumHostPoolSize = 2, + }, + RampUpStartTime = new ScalingActionTime(6, 0), + RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + RampUpCapacityThresholdPct = 80, + PeakStartTime = new ScalingActionTime(8, 0), + PeakLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.BreadthFirst, + RampDownStartTime = new ScalingActionTime(18, 0), + RampDownLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + 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); + 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 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-04-01-preview/examples/ScalingPlanPooledSchedules_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-04-01-preview/examples/ScalingPlanPooledSchedules_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-04-01-preview/examples/ScalingPlanPooledSchedules_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-04-01-preview/examples/ScalingPlanPooledSchedules_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..bec2d0d8d2dd 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-04-01-preview/examples/ScalingPlanPooledSchedules_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-04-01-preview/examples/ScalingPlanPooledSchedules_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-04-01-preview/examples/ScalingPlanPooledSchedules_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 @@ -98,13 +98,16 @@ public async Task Update_ScalingPlanPooledSchedulesUpdate() // invoke the operation ScalingPlanPooledSchedulePatch patch = new ScalingPlanPooledSchedulePatch { - DaysOfWeek = { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, - RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, - RampUpCapacityThresholdPct = 80, - PeakStartTime = new ScalingActionTime(8, 0), - RampDownLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, - RampDownMinimumHostsPct = 20, - RampDownWaitTimeMinutes = 30, + Properties = new ScalingPlanPooledSchedulePatchProperties + { + DaysOfWeek = { DesktopVirtualizationDayOfWeek.Monday, DesktopVirtualizationDayOfWeek.Tuesday, DesktopVirtualizationDayOfWeek.Wednesday, DesktopVirtualizationDayOfWeek.Thursday, DesktopVirtualizationDayOfWeek.Friday }, + RampUpLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + RampUpCapacityThresholdPct = 80, + PeakStartTime = new ScalingActionTime(8, 0), + RampDownLoadBalancingAlgorithm = SessionHostLoadBalancingAlgorithm.DepthFirst, + RampDownMinimumHostsPct = 20, + RampDownWaitTimeMinutes = 30, + }, }; ScalingPlanPooledScheduleResource result = await scalingPlanPooledSchedule.UpdateAsync(patch); 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..3b52dbbc2413 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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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-04-01-preview/examples/ScalingPlans_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 @@ -93,7 +93,46 @@ public async Task Update_ScalingPlansUpdate() ScalingPlanResource scalingPlan = client.GetScalingPlanResource(scalingPlanResourceId); // invoke the operation - ScalingPlanPatch patch = new ScalingPlanPatch(); + ScalingPlanPatch patch = new ScalingPlanPatch + { + Tags = +{ +["tag1"] = "value1", +["tag2"] = "value2" +}, + Properties = new ScalingPlanPatchProperties + { + Description = "Description of Scaling Plan", + FriendlyName = "Scaling Plan 1", + TimeZone = "Central Standard Time", + ExclusionTag = "value", + Schedules = {new ScalingSchedule +{ +Name = "schedule1", +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, +}}, + HostPoolReferences = {new ScalingHostPoolReference +{ +HostPoolId = new ResourceIdentifier("/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1"), +IsScalingPlanEnabled = true, +}}, + }, + }; ScalingPlanResource result = await scalingPlan.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well 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..ac2ef4f39ef3 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-04-01-preview/examples/SessionHosts_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-04-01-preview/examples/SessionHosts_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-04-01-preview/examples/SessionHosts_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-04-01-preview/examples/SessionHosts_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..1ebb21fc411d --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostConfigurationResource.cs @@ -0,0 +1,213 @@ +// 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-04-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-04-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 + { + Properties = new SessionHostConfigurationPatchProperties + { + 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", + VirtualMachineDiskType = VirtualMachineDiskType.StandardLRS, + 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-04-01-preview/examples/SessionHostConfigurations_CreateOrUpdate.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.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..da03181ae8f0 --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_SessionHostManagementResource.cs @@ -0,0 +1,223 @@ +// 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-04-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-04-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 + { + Properties = new SessionHostManagementPatchProperties + { + 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-04-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 PostControlSessionHostUpdate_SessionHostManagementsControlSessionHostUpdatePost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-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 PostInitiateSessionHostUpdate_SessionHostManagementsUpdateSessionHostsPost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-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 GetSessionHostManagementsUpdateStatu_SessionHostManagementsUpdateStatusGet() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/SessionHostManagementsUpdateStatus_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}"); + } + } +} 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..17b7ca84d6a9 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-04-01-preview/examples/SessionHosts_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-04-01-preview/examples/SessionHosts_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-04-01-preview/examples/SessionHosts_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 @@ -99,9 +99,12 @@ public async Task Update_SessionHostUpdate() // invoke the operation SessionHostPatch patch = new SessionHostPatch { - AllowNewSession = true, - AssignedUser = "user1@microsoft.com", - FriendlyName = "friendly", + Properties = new SessionHostPatchProperties + { + AllowNewSession = true, + AssignedUser = "user1@microsoft.com", + FriendlyName = "friendly", + }, }; bool? force = true; SessionHostResource result = await sessionHost.UpdateAsync(patch, force: force); @@ -112,5 +115,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 RetryProvisioning_SessionHostsRetryProvisioningPost() + { + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/SessionHost_RetryProvisioning_Post.json + // this example is just showing the usage of "SessionHosts_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.RetryProvisioningAsync(); + + 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..5360ee40022f 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 @@ -18,10 +18,10 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVirtualWorkspaces_WorkspaceListBySubscription() + public async Task GetAppAttachPackages_AppAttachPackageListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-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 TokenCredential cred = new DefaultAzureCredential(); @@ -35,11 +35,12 @@ public async Task GetVirtualWorkspaces_WorkspaceListBySubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (VirtualWorkspaceResource item in subscriptionResource.GetVirtualWorkspacesAsync()) + string filter = "HostPoolName eq 'hostpool1'"; + await foreach (AppAttachPackageResource item in subscriptionResource.GetAppAttachPackagesAsync(filter: filter)) { // the variable item 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 - VirtualWorkspaceData resourceData = item.Data; + AppAttachPackageData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -49,10 +50,10 @@ public async Task GetVirtualWorkspaces_WorkspaceListBySubscription() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetScalingPlans_ScalingPlansListBySubscription() + public async Task GetVirtualApplicationGroups_ApplicationGroupList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/ApplicationGroups_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 TokenCredential cred = new DefaultAzureCredential(); @@ -66,14 +67,12 @@ public async Task GetScalingPlans_ScalingPlansListBySubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - int? pageSize = 10; - bool? isDescending = true; - int? initialSkip = 0; - await foreach (ScalingPlanResource item in subscriptionResource.GetScalingPlansAsync(pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) + string filter = "applicationGroupType eq 'RailApplication'"; + await foreach (VirtualApplicationGroupResource item in subscriptionResource.GetVirtualApplicationGroupsAsync(filter: filter)) { // the variable item 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 - ScalingPlanData resourceData = item.Data; + VirtualApplicationGroupData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -83,10 +82,10 @@ public async Task GetScalingPlans_ScalingPlansListBySubscription() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVirtualApplicationGroups_ApplicationGroupList() + public async Task GetHostPools_HostPoolList() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/HostPool_Lists.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 TokenCredential cred = new DefaultAzureCredential(); @@ -100,12 +99,14 @@ public async Task GetVirtualApplicationGroups_ApplicationGroupList() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - string filter = "applicationGroupType eq 'RailApplication'"; - await foreach (VirtualApplicationGroupResource item in subscriptionResource.GetVirtualApplicationGroupsAsync(filter: filter)) + int? pageSize = 10; + bool? isDescending = true; + int? initialSkip = 0; + await foreach (HostPoolResource item in subscriptionResource.GetHostPoolsAsync(pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) { // the variable item 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 - VirtualApplicationGroupData resourceData = item.Data; + HostPoolData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -115,10 +116,10 @@ public async Task GetVirtualApplicationGroups_ApplicationGroupList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetHostPools_HostPoolList() + public async Task GetScalingPlans_ScalingPlansListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/ScalingPlans_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 TokenCredential cred = new DefaultAzureCredential(); @@ -135,11 +136,11 @@ public async Task GetHostPools_HostPoolList() int? pageSize = 10; bool? isDescending = true; int? initialSkip = 0; - await foreach (HostPoolResource item in subscriptionResource.GetHostPoolsAsync(pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) + await foreach (ScalingPlanResource item in subscriptionResource.GetScalingPlansAsync(pageSize: pageSize, isDescending: isDescending, initialSkip: initialSkip)) { // the variable item 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 - HostPoolData resourceData = item.Data; + ScalingPlanData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -149,10 +150,10 @@ public async Task GetHostPools_HostPoolList() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAppAttachPackages_AppAttachPackageListBySubscription() + public async Task GetVirtualWorkspaces_WorkspacesListBySubscription() { - // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/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. + // Generated from example definition: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2025-04-01-preview/examples/Workspaces_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 TokenCredential cred = new DefaultAzureCredential(); @@ -166,12 +167,11 @@ public async Task GetAppAttachPackages_AppAttachPackageListBySubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - string filter = "HostPoolName eq 'hostpool1'"; - await foreach (AppAttachPackageResource item in subscriptionResource.GetAppAttachPackagesAsync(filter: filter)) + await foreach (VirtualWorkspaceResource item in subscriptionResource.GetVirtualWorkspacesAsync()) { // the variable item 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 - AppAttachPackageData resourceData = item.Data; + VirtualWorkspaceData resourceData = item.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_UserSessionCollection.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/tests/Generated/Samples/Sample_UserSessionCollection.cs index 32d5e11c7f8c..986665624de8 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 @@ -17,9 +17,9 @@ public partial class Sample_UserSessionCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_UserSessionGet() + public async Task Get_UserSessionsGet() { - // 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-04-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-04-01-preview/examples/UserSessions_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 @@ -92,9 +92,9 @@ public async Task GetAll_UserSessionList() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_UserSessionGet() + public async Task Exists_UserSessionsGet() { - // 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-04-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 @@ -123,9 +123,9 @@ public async Task Exists_UserSessionGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_UserSessionGet() + public async Task GetIfExists_UserSessionsGet() { - // 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-04-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..91c2df15993f 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 @@ -18,9 +18,9 @@ public partial class Sample_UserSessionResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_UserSessionGet() + public async Task Get_UserSessionsGet() { - // 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-04-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-04-01-preview/examples/UserSessions_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-04-01-preview/examples/UserSessions_Disconnect.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-04-01-preview/examples/UserSessions_SendMessage.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..5d6a6c55212c 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 @@ -18,9 +18,9 @@ public partial class Sample_VirtualApplicationCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_ApplicationCreate() + public async Task CreateOrUpdate_ApplicationsCreateOrUpdate() { - // 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-04-01-preview/examples/Applications_CreateOrUpdate.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 @@ -63,9 +63,9 @@ public async Task CreateOrUpdate_ApplicationCreate() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_ApplicationGet() + public async Task Get_ApplicationsGet() { - // 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-04-01-preview/examples/Applications_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-04-01-preview/examples/Applications_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 @@ -136,9 +136,9 @@ public async Task GetAll_ApplicationsList() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_ApplicationGet() + public async Task Exists_ApplicationsGet() { - // 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-04-01-preview/examples/Applications_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 @@ -166,9 +166,9 @@ public async Task Exists_ApplicationGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_ApplicationGet() + public async Task GetIfExists_ApplicationsGet() { - // 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-04-01-preview/examples/Applications_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..ed21ba56d713 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-04-01-preview/examples/ApplicationGroups_CreateOrUpdate.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-04-01-preview/examples/ApplicationGroups_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-04-01-preview/examples/ApplicationGroups_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-04-01-preview/examples/ApplicationGroups_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-04-01-preview/examples/ApplicationGroups_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..181c430ad70d 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-04-01-preview/examples/ApplicationGroups_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 @@ -48,9 +48,9 @@ public async Task Get_ApplicationGroupGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_ApplicationGroupDelete() + public async Task Delete_ApplicationGroupsDelete() { - // 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-04-01-preview/examples/ApplicationGroups_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 @@ -74,9 +74,9 @@ public async Task Delete_ApplicationGroupDelete() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_ApplicationGroupsUpdate() + public async Task Update_ApplicationGroupUpdate() { - // 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-04-01-preview/examples/ApplicationGroups_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 @@ -100,9 +100,12 @@ public async Task Update_ApplicationGroupsUpdate() ["tag1"] = "value1", ["tag2"] = "value2" }, - Description = "des1", - FriendlyName = "friendly", - ShowInFeed = true, + Properties = new ApplicationGroupPatchProperties + { + Description = "des1", + FriendlyName = "friendly", + ShowInFeed = true, + }, }; VirtualApplicationGroupResource result = await virtualApplicationGroup.UpdateAsync(patch); @@ -115,9 +118,9 @@ public async Task Update_ApplicationGroupsUpdate() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetStartMenuItems_StartMenuItemList() + public async Task GetStartMenuItems_StartMenuItemsList() { - // 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-04-01-preview/examples/StartMenuItems_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..e89ae5858700 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 @@ -18,9 +18,9 @@ public partial class Sample_VirtualApplicationResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_ApplicationGet() + public async Task Get_ApplicationsGet() { - // 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-04-01-preview/examples/Applications_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 @@ -49,9 +49,9 @@ public async Task Get_ApplicationGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_ApplicationDelete() + public async Task Delete_ApplicationsDelete() { - // 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-04-01-preview/examples/Applications_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 @@ -76,9 +76,9 @@ public async Task Delete_ApplicationDelete() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_ApplicationUpdate() + public async Task Update_ApplicationsUpdate() { - // 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-04-01-preview/examples/Applications_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 @@ -98,17 +98,20 @@ public async Task Update_ApplicationUpdate() // invoke the operation VirtualApplicationPatch patch = new VirtualApplicationPatch { - Description = "des1", - FriendlyName = "friendly", - FilePath = "path", - CommandLineSetting = VirtualApplicationCommandLineSetting.Allow, - CommandLineArguments = "arguments", - ShowInPortal = true, - IconPath = "icon", - IconIndex = 1, - MsixPackageFamilyName = null, - MsixPackageApplicationId = null, - ApplicationType = RemoteApplicationType.InBuilt, + Properties = new ApplicationPatchProperties + { + Description = "des1", + FriendlyName = "friendly", + FilePath = "path", + CommandLineSetting = VirtualApplicationCommandLineSetting.Allow, + CommandLineArguments = "arguments", + ShowInPortal = true, + IconPath = "icon", + IconIndex = 1, + MsixPackageFamilyName = null, + MsixPackageApplicationId = null, + ApplicationType = RemoteApplicationType.InBuilt, + }, }; VirtualApplicationResource result = await virtualApplication.UpdateAsync(patch); 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..c3ce9d1e9d15 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 @@ -17,9 +17,9 @@ public partial class Sample_VirtualDesktopCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_DesktopGet() + public async Task Get_DesktopsGet() { - // 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-04-01-preview/examples/Desktops_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,9 +51,9 @@ public async Task Get_DesktopGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_DesktopList() + public async Task GetAll_DesktopsList() { - // 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-04-01-preview/examples/Desktops_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 @@ -90,9 +90,9 @@ public async Task GetAll_DesktopList() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_DesktopGet() + public async Task Exists_DesktopsGet() { - // 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-04-01-preview/examples/Desktops_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 @@ -120,9 +120,9 @@ public async Task Exists_DesktopGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_DesktopGet() + public async Task GetIfExists_DesktopsGet() { - // 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-04-01-preview/examples/Desktops_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..e2900c887634 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 @@ -18,9 +18,9 @@ public partial class Sample_VirtualDesktopResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_DesktopGet() + public async Task Get_DesktopsGet() { - // 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-04-01-preview/examples/Desktops_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 @@ -49,9 +49,9 @@ public async Task Get_DesktopGet() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_DesktopUpdate() + public async Task Update_DesktopsUpdate() { - // 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-04-01-preview/examples/Desktops_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 @@ -71,8 +71,11 @@ public async Task Update_DesktopUpdate() // invoke the operation VirtualDesktopPatch patch = new VirtualDesktopPatch { - Description = "des1", - FriendlyName = "friendly", + Properties = new DesktopPatchProperties + { + Description = "des1", + FriendlyName = "friendly", + }, }; VirtualDesktopResource result = await virtualDesktop.UpdateAsync(patch); 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..24afadda5072 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-04-01-preview/examples/Workspaces_CreateOrUpdate.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-04-01-preview/examples/Workspaces_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-04-01-preview/examples/Workspaces_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-04-01-preview/examples/Workspaces_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-04-01-preview/examples/Workspaces_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..93f4b01ac005 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-04-01-preview/examples/Workspaces_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-04-01-preview/examples/Workspaces_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-04-01-preview/examples/Workspaces_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 @@ -100,8 +100,11 @@ public async Task Update_WorkspaceUpdate() ["tag1"] = "value1", ["tag2"] = "value2" }, - Description = "des1", - FriendlyName = "friendly", + Properties = new WorkspacePatchProperties + { + Description = "des1", + FriendlyName = "friendly", + }, }; VirtualWorkspaceResource result = await virtualWorkspace.UpdateAsync(patch); @@ -116,7 +119,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-04-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..80da576523ca 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 @@ -18,9 +18,9 @@ public partial class Sample_WorkspacePrivateEndpointConnectionCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() + public async Task CreateOrUpdate_PrivateEndpointConnectionsUpdateByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -41,7 +41,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() // invoke the operation string privateEndpointConnectionName = "workspace1.377103f1-5179-4bdf-8556-4cdd3207cc5b"; - DesktopVirtualizationPrivateEndpointConnection connection = new DesktopVirtualizationPrivateEndpointConnection + DesktopVirtualizationPrivateEndpointConnectionDataData data = new DesktopVirtualizationPrivateEndpointConnectionDataData { ConnectionState = new DesktopVirtualizationPrivateLinkServiceConnectionState { @@ -50,7 +50,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() ActionsRequired = "None", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, connection); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); WorkspacePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -62,9 +62,9 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionUpdateByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_PrivateEndpointConnectionGetByWorkspace() + public async Task Get_PrivateEndpointConnectionsGetByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -96,9 +96,9 @@ public async Task Get_PrivateEndpointConnectionGetByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetAll_PrivateEndpointConnectionListByWorkspace() + public async Task GetAll_PrivateEndpointConnectionsListByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -132,9 +132,9 @@ public async Task GetAll_PrivateEndpointConnectionListByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task Exists_PrivateEndpointConnectionGetByWorkspace() + public async Task Exists_PrivateEndpointConnectionsGetByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -162,9 +162,9 @@ public async Task Exists_PrivateEndpointConnectionGetByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_PrivateEndpointConnectionGetByWorkspace() + public async Task GetIfExists_PrivateEndpointConnectionsGetByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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..8166a9ed41ba 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 @@ -18,9 +18,9 @@ public partial class Sample_WorkspacePrivateEndpointConnectionResource { [Test] [Ignore("Only validating compilation of examples")] - public async Task Get_PrivateEndpointConnectionGetByWorkspace() + public async Task Get_PrivateEndpointConnectionsGetByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -49,9 +49,9 @@ public async Task Get_PrivateEndpointConnectionGetByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task Delete_PrivateEndpointConnectionDeleteByWorkspace() + public async Task Delete_PrivateEndpointConnectionsDeleteByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -76,9 +76,9 @@ public async Task Delete_PrivateEndpointConnectionDeleteByWorkspace() [Test] [Ignore("Only validating compilation of examples")] - public async Task Update_PrivateEndpointConnectionUpdateByWorkspace() + public async Task Update_PrivateEndpointConnectionsUpdateByWorkspace() { - // 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-04-01-preview/examples/PrivateEndpointConnections_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 @@ -96,7 +96,7 @@ public async Task Update_PrivateEndpointConnectionUpdateByWorkspace() WorkspacePrivateEndpointConnectionResource workspacePrivateEndpointConnection = client.GetWorkspacePrivateEndpointConnectionResource(workspacePrivateEndpointConnectionResourceId); // invoke the operation - DesktopVirtualizationPrivateEndpointConnection connection = new DesktopVirtualizationPrivateEndpointConnection + DesktopVirtualizationPrivateEndpointConnectionDataData data = new DesktopVirtualizationPrivateEndpointConnectionDataData { ConnectionState = new DesktopVirtualizationPrivateLinkServiceConnectionState { @@ -105,7 +105,7 @@ public async Task Update_PrivateEndpointConnectionUpdateByWorkspace() ActionsRequired = "None", }, }; - ArmOperation lro = await workspacePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, connection); + ArmOperation lro = await workspacePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); WorkspacePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well 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/