diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/ArmStandbyPoolModelFactory.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/ArmStandbyPoolModelFactory.cs deleted file mode 100644 index 2f219f8c8459..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/ArmStandbyPoolModelFactory.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - /// Model factory for models. - public static partial class ArmStandbyPoolModelFactory - { - /// Initializes a new instance of . - /// The count of pooled resources in each state. - /// A new instance for mocking. - public static ContainerGroupInstanceCountSummary ContainerGroupInstanceCountSummary(IEnumerable instanceCountsByState = null) - { - instanceCountsByState ??= new List(); - - return new ContainerGroupInstanceCountSummary(instanceCountsByState?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The state that the pooled resources count is for. - /// The count of pooled resources in the given state. - /// A new instance for mocking. - public static PoolResourceStateCount PoolResourceStateCount(string state = null, long count = default) - { - return new PoolResourceStateCount(state, count, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The zone that the provided counts are in. This is null if zones are not enabled on the attached VMSS. - /// The count of pooled resources in each state for the given zone. - /// A new instance for mocking. - public static StandbyVirtualMachineInstanceCountSummary StandbyVirtualMachineInstanceCountSummary(long? zone = null, IEnumerable instanceCountsByState = null) - { - instanceCountsByState ??= new List(); - return new StandbyVirtualMachineInstanceCountSummary(zone, instanceCountsByState?.ToList(), serializedAdditionalRawData: null); - } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.Serialization.cs deleted file mode 100644 index 2cc6238601c8..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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.Runtime.CompilerServices; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - [CodeGenSerialization(nameof(StandbyContainerGroupInstanceCountsByState), SerializationValueHook = nameof(InstanceCountsByStateSerial))] - public partial class ContainerGroupInstanceCountSummary - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void InstanceCountsByStateSerial(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - if (StandbyContainerGroupInstanceCountsByState == null) - { - writer.WriteStartArray(); - foreach (var item in InstanceCountsByState) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteStartArray(); - foreach (var item in StandbyContainerGroupInstanceCountsByState) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.cs deleted file mode 100644 index 363bbda24a2a..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/ContainerGroupInstanceCountSummary.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - /// Displays the counts of container groups in each state, as known by the StandbyPool resource provider. - public partial class ContainerGroupInstanceCountSummary - { - /// Initializes a new instance of . - /// The count of pooled resources in each state. - /// Keeps track of any properties unknown to the library. - [EditorBrowsable(EditorBrowsableState.Never)] - internal ContainerGroupInstanceCountSummary(IReadOnlyList instanceCountsByState, IDictionary serializedAdditionalRawData) - { - InstanceCountsByState = instanceCountsByState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - /// The count of pooled resources in each state. - [EditorBrowsable(EditorBrowsableState.Never)] - public IReadOnlyList InstanceCountsByState { get; } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.Serialization.cs deleted file mode 100644 index 3904535cdf7b..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.Serialization.cs +++ /dev/null @@ -1,132 +0,0 @@ -// 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.StandbyPool.Models -{ - public partial class PoolResourceStateCount : 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(PoolResourceStateCount)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State); - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count); - 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 - } - } - } - - PoolResourceStateCount 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(PoolResourceStateCount)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePoolResourceStateCount(document.RootElement, options); - } - - internal static PoolResourceStateCount DeserializePoolResourceStateCount(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string state = default; - long count = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("state"u8)) - { - state = property.Value.GetString(); - continue; - } - if (property.NameEquals("count"u8)) - { - count = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PoolResourceStateCount(state, count, 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, AzureResourceManagerStandbyPoolContext.Default); - default: - throw new FormatException($"The model {nameof(PoolResourceStateCount)} does not support writing '{options.Format}' format."); - } - } - - PoolResourceStateCount 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 DeserializePoolResourceStateCount(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PoolResourceStateCount)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.cs deleted file mode 100644 index 2c3ad0896748..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/PoolResourceStateCount.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.ComponentModel; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - /// Displays the counts of pooled resources in each state, as known by the StandbyPool resource provider. - [EditorBrowsable(EditorBrowsableState.Never)] - public partial class PoolResourceStateCount - { - /// - /// 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 state that the pooled resources count is for. - /// The count of pooled resources in the given state. - /// is null. - internal PoolResourceStateCount(string state, long count) - { - Argument.AssertNotNull(state, nameof(state)); - - State = state; - Count = count; - } - - /// Initializes a new instance of . - /// The state that the pooled resources count is for. - /// The count of pooled resources in the given state. - /// Keeps track of any properties unknown to the library. - internal PoolResourceStateCount(string state, long count, IDictionary serializedAdditionalRawData) - { - State = state; - Count = count; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PoolResourceStateCount() - { - } - - /// The state that the pooled resources count is for. - public string State { get; } - /// The count of pooled resources in the given state. - public long Count { get; } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyContainerGroupPoolUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyContainerGroupPoolUpdateProperties.cs deleted file mode 100644 index 9b7d6c943133..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyContainerGroupPoolUpdateProperties.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.StandbyPool.Models -{ - [CodeGenModel("StandbyContainerGroupPoolResourceUpdateProperties")] - public partial class StandbyContainerGroupPoolUpdateProperties - { - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs deleted file mode 100644 index c5fa95371fe4..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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.Runtime.CompilerServices; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - [CodeGenSerialization(nameof(StandbyVirtualMachineInstanceCountsByState), SerializationValueHook = nameof(InstanceCountsByStateSerial))] - public partial class StandbyVirtualMachineInstanceCountSummary - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void InstanceCountsByStateSerial(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - if (StandbyVirtualMachineInstanceCountsByState == null) - { - writer.WriteStartArray(); - foreach (var item in InstanceCountsByState) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - else - { - writer.WriteStartArray(); - foreach (var item in StandbyVirtualMachineInstanceCountsByState) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.cs deleted file mode 100644 index 4229d3b6c0a6..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachineInstanceCountSummary.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; - -namespace Azure.ResourceManager.StandbyPool.Models -{ - /// - /// Contains the counts of VMs in each power state in a given zone, fault domain, as known by the StandbyPool resource provider. - /// Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. - /// Note: any resources in the Running state may still be installing extensions / not fully provisioned. - /// - public partial class StandbyVirtualMachineInstanceCountSummary - { - /// Initializes a new instance of . - /// The zone that the provided counts are in. This is null if zones are not enabled on the attached VMSS. - /// The count of pooled resources in each state for the given zone. - /// Keeps track of any properties unknown to the library. - [EditorBrowsable(EditorBrowsableState.Never)] - internal StandbyVirtualMachineInstanceCountSummary(long? zone, IReadOnlyList instanceCountsByState, IDictionary serializedAdditionalRawData) - { - Zone = zone; - InstanceCountsByState = instanceCountsByState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - /// The count of pooled virtual machines in each state for the given zone. - [EditorBrowsable(EditorBrowsableState.Never)] - public IReadOnlyList InstanceCountsByState { get; } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachinePoolUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachinePoolUpdateProperties.cs deleted file mode 100644 index c5492194b7be..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Custom/Models/StandbyVirtualMachinePoolUpdateProperties.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.StandbyPool.Models -{ - [CodeGenModel("StandbyVirtualMachinePoolResourceUpdateProperties")] - public partial class StandbyVirtualMachinePoolUpdateProperties - { - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs index 3575cd0b2ffa..5e9d462b8a37 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ArmStandbyPoolModelFactory.cs @@ -7,284 +7,290 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmStandbyPoolModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + + /// A StandbyVirtualMachinePoolResource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static StandbyVirtualMachinePoolData StandbyVirtualMachinePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, StandbyVirtualMachinePoolProperties properties = null) + public static StandbyVirtualMachinePoolData StandbyVirtualMachinePoolData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, StandbyVirtualMachinePoolProperties properties = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new StandbyVirtualMachinePoolData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - properties, - serializedAdditionalRawData: null); + properties); } - /// Initializes a new instance of . + /// Details of the StandbyVirtualMachinePool. /// Specifies the elasticity profile of the standby virtual machine pools. /// Specifies the desired state of virtual machines in the pool. /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. /// The status of the last operation. /// A new instance for mocking. - public static StandbyVirtualMachinePoolProperties StandbyVirtualMachinePoolProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile = null, StandbyVirtualMachineState virtualMachineState = default, ResourceIdentifier attachedVirtualMachineScaleSetId = null, StandbyProvisioningState? provisioningState = null) + public static StandbyVirtualMachinePoolProperties StandbyVirtualMachinePoolProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile = default, StandbyVirtualMachineState virtualMachineState = default, ResourceIdentifier attachedVirtualMachineScaleSetId = default, StandbyProvisioningState? provisioningState = default) + { + return new StandbyVirtualMachinePoolProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, provisioningState, additionalBinaryDataProperties: null); + } + + /// The type used for update operations of the StandbyVirtualMachinePoolResource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static StandbyVirtualMachinePoolPatch StandbyVirtualMachinePoolPatch(IDictionary tags = default, StandbyVirtualMachinePoolResourceUpdateProperties properties = default) { - return new StandbyVirtualMachinePoolProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, provisioningState, serializedAdditionalRawData: null); + tags ??= new ChangeTrackingDictionary(); + + return new StandbyVirtualMachinePoolPatch(tags, properties, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static StandbyVirtualMachineData StandbyVirtualMachineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, StandbyVirtualMachineProperties properties = null) + public static StandbyVirtualMachineData StandbyVirtualMachineData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, StandbyVirtualMachineProperties properties = default) { return new StandbyVirtualMachineData( id, name, resourceType, systemData, - properties, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); } - /// Initializes a new instance of . + /// Details of the StandbyVirtualMachine. /// Resource id of the virtual machine. /// The status of the last operation. /// A new instance for mocking. - public static StandbyVirtualMachineProperties StandbyVirtualMachineProperties(ResourceIdentifier virtualMachineResourceId = null, StandbyProvisioningState? provisioningState = null) + public static StandbyVirtualMachineProperties StandbyVirtualMachineProperties(ResourceIdentifier virtualMachineResourceId = default, StandbyProvisioningState? provisioningState = default) { - return new StandbyVirtualMachineProperties(virtualMachineResourceId, provisioningState, serializedAdditionalRawData: null); + return new StandbyVirtualMachineProperties(virtualMachineResourceId, provisioningState, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Contains information about a standby virtual machine pool as last known by the StandbyPool resource provider. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static StandbyVirtualMachinePoolRuntimeViewData StandbyVirtualMachinePoolRuntimeViewData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, StandbyVirtualMachinePoolRuntimeViewProperties properties = null) + public static StandbyVirtualMachinePoolRuntimeViewData StandbyVirtualMachinePoolRuntimeViewData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, StandbyVirtualMachinePoolRuntimeViewProperties properties = default) { return new StandbyVirtualMachinePoolRuntimeViewData( id, name, resourceType, systemData, - properties, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); } - /// Initializes a new instance of . + /// Contains information about a standby pool as last known by the StandbyPool resource provider. /// A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known by the StandbyPool resource provider. If zones are not enabled on the attached VMSS, the list will contain a single entry without zone values. Note: any resources in the Running state may still be installing extensions / not fully provisioned. /// Display status of the standby pool. /// Displays the provisioning state of the standby pool. /// Displays prediction information of the standby pool. /// A new instance for mocking. - public static StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable instanceCountSummary = null, StandbyPoolStatus status = null, StandbyProvisioningState? provisioningState = null, StandbyVirtualMachinePoolPrediction prediction = null) + public static StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable instanceCountSummary = default, StandbyPoolStatus status = default, StandbyProvisioningState? provisioningState = default, StandbyVirtualMachinePoolPrediction prediction = default) { - instanceCountSummary ??= new List(); + instanceCountSummary ??= new ChangeTrackingList(); - return new StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary?.ToList(), status, provisioningState, prediction, serializedAdditionalRawData: null); + return new StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary.ToList(), status, provisioningState, prediction, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Contains the counts of VMs in each power state in a given zone, fault domain, as known by the StandbyPool resource provider. Note: any resources in the Running state may still be installing extensions / not fully provisioned. /// The zone that the provided counts are in. It will not have a value if zones are not enabled on the attached VMSS. /// The count of pooled virtual machines in each state for the given zone. /// A new instance for mocking. - public static StandbyVirtualMachineInstanceCountSummary StandbyVirtualMachineInstanceCountSummary(long? zone = null, IEnumerable standbyVirtualMachineInstanceCountsByState = null) + public static StandbyVirtualMachineInstanceCountSummary StandbyVirtualMachineInstanceCountSummary(long? zone = default, IEnumerable standbyVirtualMachineInstanceCountsByState = default) { - standbyVirtualMachineInstanceCountsByState ??= new List(); + standbyVirtualMachineInstanceCountsByState ??= new ChangeTrackingList(); - return new StandbyVirtualMachineInstanceCountSummary(zone, standbyVirtualMachineInstanceCountsByState?.ToList(), serializedAdditionalRawData: null); + return new StandbyVirtualMachineInstanceCountSummary(zone, standbyVirtualMachineInstanceCountsByState.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Displays the counts of pooled virtual machines in each state, as known by the StandbyPool resource provider. /// The state that the pooled virtual machines count is for. /// The count of pooled virtual machines in the given state. /// A new instance for mocking. public static PoolVirtualMachineStateCount PoolVirtualMachineStateCount(PoolVirtualMachineState state = default, long count = default) { - return new PoolVirtualMachineStateCount(state, count, serializedAdditionalRawData: null); + return new PoolVirtualMachineStateCount(state, count, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Displays StandbyPool status. /// Displays the healthy state of the StandbyPool. /// Displays the StandbyPool health state details. /// A new instance for mocking. - public static StandbyPoolStatus StandbyPoolStatus(StandbyPoolHealthStateCode code = default, string message = null) + public static StandbyPoolStatus StandbyPoolStatus(StandbyPoolHealthStateCode code = default, string message = default) { - return new StandbyPoolStatus(code, message, serializedAdditionalRawData: null); + return new StandbyPoolStatus(code, message, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Displays the forecast information of the standby pool. + /// Displays the predicted count of instances to be requested from the standby pool. /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. /// Displays additional information for the prediction of the standby pool. /// A new instance for mocking. - public static StandbyVirtualMachinePoolPrediction StandbyVirtualMachinePoolPrediction(IEnumerable forecastValuesInstancesRequestedCount = null, DateTimeOffset forecastStartOn = default, string forecastInfo = null) + public static StandbyVirtualMachinePoolPrediction StandbyVirtualMachinePoolPrediction(IEnumerable forecastValuesInstancesRequestedCount = default, DateTimeOffset forecastStartOn = default, string forecastInfo = default) { - forecastValuesInstancesRequestedCount ??= new List(); - - return new StandbyVirtualMachinePoolPrediction(forecastValuesInstancesRequestedCount != null ? new StandbyVirtualMachinePoolForecastValues(forecastValuesInstancesRequestedCount?.ToList(), serializedAdditionalRawData: null) : null, forecastStartOn, forecastInfo, serializedAdditionalRawData: null); + return new StandbyVirtualMachinePoolPrediction(forecastValuesInstancesRequestedCount is null ? default : new StandbyVirtualMachinePoolForecastValues((forecastValuesInstancesRequestedCount ?? new ChangeTrackingList()).ToList(), null), forecastStartOn, forecastInfo, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// A StandbyContainerGroupPoolResource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static StandbyContainerGroupPoolData StandbyContainerGroupPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, StandbyContainerGroupPoolProperties properties = null) + public static StandbyContainerGroupPoolData StandbyContainerGroupPoolData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, StandbyContainerGroupPoolProperties properties = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new StandbyContainerGroupPoolData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - properties, - serializedAdditionalRawData: null); + properties); } - /// Initializes a new instance of . + /// Details of the StandbyContainerGroupPool. /// Specifies elasticity profile of standby container group pools. /// Specifies container group properties of standby container group pools. /// Specifies zones of standby container group pools. /// The status of the last operation. /// A new instance for mocking. - public static StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile = null, StandbyContainerGroupProperties containerGroupProperties = null, IEnumerable zones = null, StandbyProvisioningState? provisioningState = null) + public static StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile = default, StandbyContainerGroupProperties containerGroupProperties = default, IEnumerable zones = default, StandbyProvisioningState? provisioningState = default) + { + zones ??= new ChangeTrackingList(); + + return new StandbyContainerGroupPoolProperties(elasticityProfile, containerGroupProperties, zones.ToList(), provisioningState, additionalBinaryDataProperties: null); + } + + /// Details of the ContainerGroupProperties. + /// Specifies container group profile of standby container groups. + /// Specifies subnet Ids for container group. + /// A new instance for mocking. + public static StandbyContainerGroupProperties StandbyContainerGroupProperties(StandbyContainerGroupProfile containerGroupProfile = default, IEnumerable subnetIds = default) { - zones ??= new List(); + subnetIds ??= new ChangeTrackingList(); - return new StandbyContainerGroupPoolProperties(elasticityProfile, containerGroupProperties, zones?.ToList(), provisioningState, serializedAdditionalRawData: null); + return new StandbyContainerGroupProperties(containerGroupProfile, subnetIds.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// The type used for update operations of the StandbyContainerGroupPoolResource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static StandbyContainerGroupPoolPatch StandbyContainerGroupPoolPatch(IDictionary tags = default, StandbyContainerGroupPoolResourceUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new StandbyContainerGroupPoolPatch(tags, properties, additionalBinaryDataProperties: null); + } + + /// The updatable properties of the StandbyContainerGroupPoolResource. + /// Specifies elasticity profile of standby container group pools. + /// Specifies container group properties of standby container group pools. + /// Specifies zones of standby container group pools. + /// A new instance for mocking. + public static StandbyContainerGroupPoolResourceUpdateProperties StandbyContainerGroupPoolResourceUpdateProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile = default, StandbyContainerGroupProperties containerGroupProperties = default, IEnumerable zones = default) + { + zones ??= new ChangeTrackingList(); + + return new StandbyContainerGroupPoolResourceUpdateProperties(elasticityProfile, containerGroupProperties, zones.ToList(), additionalBinaryDataProperties: null); + } + + /// Contains information about a standby container group pool as last known by the StandbyPool resource provider. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static StandbyContainerGroupPoolRuntimeViewData StandbyContainerGroupPoolRuntimeViewData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, StandbyContainerGroupPoolRuntimeViewProperties properties = null) + public static StandbyContainerGroupPoolRuntimeViewData StandbyContainerGroupPoolRuntimeViewData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, StandbyContainerGroupPoolRuntimeViewProperties properties = default) { return new StandbyContainerGroupPoolRuntimeViewData( id, name, resourceType, systemData, - properties, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); } - /// Initializes a new instance of . + /// Contains information about a standby pool as last known by the StandbyPool resource provider. /// A list containing the counts of container groups in each possible state, as known by the StandbyPool resource provider. /// Display status of the standby pool. /// Displays the provisioning state of the standby pool. /// Displays prediction information of the standby pool. /// A new instance for mocking. - public static StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable instanceCountSummary = null, StandbyPoolStatus status = null, StandbyProvisioningState? provisioningState = null, StandbyContainerGroupPoolPrediction prediction = null) + public static StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable instanceCountSummary = default, StandbyPoolStatus status = default, StandbyProvisioningState? provisioningState = default, StandbyContainerGroupPoolPrediction prediction = default) { - instanceCountSummary ??= new List(); + instanceCountSummary ??= new ChangeTrackingList(); - return new StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary?.ToList(), status, provisioningState, prediction, serializedAdditionalRawData: null); + return new StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary.ToList(), status, provisioningState, prediction, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Displays the counts of container groups in each state, as known by the StandbyPool resource provider. /// The zone that the provided counts are in. It will not have a value if zones are not enabled. /// The count of pooled container groups in each state for the given zone. /// A new instance for mocking. - public static ContainerGroupInstanceCountSummary ContainerGroupInstanceCountSummary(long? zone = null, IEnumerable standbyContainerGroupInstanceCountsByState = null) + public static ContainerGroupInstanceCountSummary ContainerGroupInstanceCountSummary(long? zone = default, IEnumerable standbyContainerGroupInstanceCountsByState = default) { - standbyContainerGroupInstanceCountsByState ??= new List(); + standbyContainerGroupInstanceCountsByState ??= new ChangeTrackingList(); - return new ContainerGroupInstanceCountSummary(zone, standbyContainerGroupInstanceCountsByState?.ToList(), serializedAdditionalRawData: null); + return new ContainerGroupInstanceCountSummary(zone, standbyContainerGroupInstanceCountsByState.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Displays the counts of pooled container groups in each state, as known by the StandbyPool resource provider. /// The state that the pooled container groups count is for. /// The count of pooled container groups in the given state. /// A new instance for mocking. public static PoolContainerGroupStateCount PoolContainerGroupStateCount(PoolContainerGroupState state = default, long count = default) { - return new PoolContainerGroupStateCount(state, count, serializedAdditionalRawData: null); + return new PoolContainerGroupStateCount(state, count, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Displays the forecast information of the standby pool. + /// Displays the predicted count of instances to be requested from the standby pool. /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. /// Displays additional information for the prediction of the standby pool. /// A new instance for mocking. - public static StandbyContainerGroupPoolPrediction StandbyContainerGroupPoolPrediction(IEnumerable forecastValuesInstancesRequestedCount = null, DateTimeOffset forecastStartOn = default, string forecastInfo = null) - { - forecastValuesInstancesRequestedCount ??= new List(); - - return new StandbyContainerGroupPoolPrediction(forecastValuesInstancesRequestedCount != null ? new StandbyContainerGroupPoolForecastValues(forecastValuesInstancesRequestedCount?.ToList(), serializedAdditionalRawData: null) : null, forecastStartOn, forecastInfo, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// A list containing the counts of container groups in each possible state, as known by the StandbyPool resource provider. - /// Displays the provisioning state of the standby pool. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyContainerGroupPoolRuntimeViewProperties StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable instanceCountSummary, StandbyProvisioningState? provisioningState) - { - return StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary: instanceCountSummary, status: default, provisioningState: provisioningState, prediction: default); - } - - /// Initializes a new instance of . - /// Specifies elasticity profile of standby container group pools. - /// Specifies container group properties of standby container group pools. - /// The status of the last operation. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyContainerGroupPoolProperties StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, StandbyProvisioningState? provisioningState) - { - return StandbyContainerGroupPoolProperties(elasticityProfile: elasticityProfile, containerGroupProperties: containerGroupProperties, zones: default, provisioningState: provisioningState); - } - - /// Initializes a new instance of . - /// - /// A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known by the StandbyPool resource provider. - /// If zones are not enabled on the attached VMSS, the list will contain a single entry with null zone values. - /// Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. - /// Note: any resources in the Running state may still be installing extensions / not fully provisioned. - /// - /// Displays the provisioning state of the standby pool. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static StandbyVirtualMachinePoolRuntimeViewProperties StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable instanceCountSummary, StandbyProvisioningState? provisioningState) + public static StandbyContainerGroupPoolPrediction StandbyContainerGroupPoolPrediction(IEnumerable forecastValuesInstancesRequestedCount = default, DateTimeOffset forecastStartOn = default, string forecastInfo = default) { - return StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary: instanceCountSummary, status: default, provisioningState: provisioningState, prediction: default); + return new StandbyContainerGroupPoolPrediction(forecastValuesInstancesRequestedCount is null ? default : new StandbyContainerGroupPoolForecastValues((forecastValuesInstancesRequestedCount ?? new ChangeTrackingList()).ToList(), null), forecastStartOn, forecastInfo, additionalBinaryDataProperties: null); } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..12b77e251c67 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyContainerGroupPoolRuntimeViews _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyContainerGroupPoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPoolRuntimeViews client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby container group pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT(StandbyContainerGroupPoolRuntimeViews client, Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyContainerGroupPoolName = standbyContainerGroupPoolName; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolRuntimeViewResourceListResult result = StandbyContainerGroupPoolRuntimeViewResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyContainerGroupPoolName, _context) : _client.CreateGetByStandbyPoolRequest(_subscriptionId, _resourceGroupName, _standbyContainerGroupPoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs new file mode 100644 index 000000000000..f448abf27c28 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT : Pageable + { + private readonly StandbyContainerGroupPoolRuntimeViews _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyContainerGroupPoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPoolRuntimeViews client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby container group pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT(StandbyContainerGroupPoolRuntimeViews client, Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyContainerGroupPoolName = standbyContainerGroupPoolName; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolRuntimeViewResourceListResult result = StandbyContainerGroupPoolRuntimeViewResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyContainerGroupPoolName, _context) : _client.CreateGetByStandbyPoolRequest(_subscriptionId, _resourceGroupName, _standbyContainerGroupPoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..88c558f78365 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyContainerGroupPools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT(StandbyContainerGroupPools client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolResourceListResult result = StandbyContainerGroupPoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..a5885ed92825 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT.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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly StandbyContainerGroupPools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT(StandbyContainerGroupPools client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolResourceListResult result = StandbyContainerGroupPoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..0eb2fd933aab --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyContainerGroupPools _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT(StandbyContainerGroupPools client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolResourceListResult result = StandbyContainerGroupPoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableStandbyPoolSubscriptionResource.GetStandbyContainerGroupPools"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..5dddcd98735c --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT.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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly StandbyContainerGroupPools _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyContainerGroupPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT(StandbyContainerGroupPools client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyContainerGroupPoolResourceListResult result = StandbyContainerGroupPoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableStandbyPoolSubscriptionResource.GetStandbyContainerGroupPools"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..7f327b7149d3 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyVirtualMachinePoolRuntimeViews _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyVirtualMachinePoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePoolRuntimeViews client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby virtual machine pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT(StandbyVirtualMachinePoolRuntimeViews client, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyVirtualMachinePoolName = standbyVirtualMachinePoolName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolRuntimeViewResourceListResult result = StandbyVirtualMachinePoolRuntimeViewResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context) : _client.CreateGetByStandbyPoolRequest(_subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs new file mode 100644 index 000000000000..17fb7021c548 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT : Pageable + { + private readonly StandbyVirtualMachinePoolRuntimeViews _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyVirtualMachinePoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePoolRuntimeViews client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby virtual machine pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT(StandbyVirtualMachinePoolRuntimeViews client, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyVirtualMachinePoolName = standbyVirtualMachinePoolName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolRuntimeViewResourceListResult result = StandbyVirtualMachinePoolRuntimeViewResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context) : _client.CreateGetByStandbyPoolRequest(_subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..3bf95c0da11c --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyVirtualMachinePools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT(StandbyVirtualMachinePools client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolResourceListResult result = StandbyVirtualMachinePoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..b8be71c8f725 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT.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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly StandbyVirtualMachinePools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT(StandbyVirtualMachinePools client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolResourceListResult result = StandbyVirtualMachinePoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..d6980e7f479f --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyVirtualMachinePools _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT(StandbyVirtualMachinePools client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolResourceListResult result = StandbyVirtualMachinePoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableStandbyPoolSubscriptionResource.GetStandbyVirtualMachinePools"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..ed62098acb95 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT.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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly StandbyVirtualMachinePools _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachinePools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT(StandbyVirtualMachinePools client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyVirtualMachinePoolResourceListResult result = StandbyVirtualMachinePoolResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableStandbyPoolSubscriptionResource.GetStandbyVirtualMachinePools"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..2d114b9d72b4 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT : AsyncPageable + { + private readonly StandbyVirtualMachines _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyVirtualMachinePoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachines client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby virtual machine pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT(StandbyVirtualMachines client, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyVirtualMachinePoolName = standbyVirtualMachinePoolName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + StandbyVirtualMachineResourceListResult result = StandbyVirtualMachineResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyVirtualMachinePoolResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context) : _client.CreateGetByStandbyVirtualMachinePoolResourceRequest(_subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT.cs new file mode 100644 index 000000000000..d0bc50b525f5 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/CollectionResults/StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.StandbyPool.Models; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT : Pageable + { + private readonly StandbyVirtualMachines _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _standbyVirtualMachinePoolName; + private readonly RequestContext _context; + + /// Initializes a new instance of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The StandbyVirtualMachines client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the standby virtual machine pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT(StandbyVirtualMachines client, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _standbyVirtualMachinePoolName = standbyVirtualMachinePoolName; + _context = context; + } + + /// Gets the pages of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + StandbyVirtualMachineResourceListResult result = StandbyVirtualMachineResourceListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByStandbyVirtualMachinePoolResourceRequest(nextLink, _subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context) : _client.CreateGetByStandbyVirtualMachinePoolResourceRequest(_subscriptionId, _resourceGroupName, _standbyVirtualMachinePoolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolArmClient.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolArmClient.cs index cc854e4de6b5..7a040e950059 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolArmClient.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableStandbyPoolArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableStandbyPoolArmClient for mocking. protected MockableStandbyPoolArmClient() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableStandbyPoolArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableStandbyPoolArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// 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. /// The resource ID of the resource to get. /// Returns a object. public virtual StandbyVirtualMachinePoolResource GetStandbyVirtualMachinePoolResource(ResourceIdentifier id) @@ -46,10 +35,7 @@ public virtual StandbyVirtualMachinePoolResource GetStandbyVirtualMachinePoolRes return new StandbyVirtualMachinePoolResource(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. /// The resource ID of the resource to get. /// Returns a object. public virtual StandbyVirtualMachineResource GetStandbyVirtualMachineResource(ResourceIdentifier id) @@ -58,10 +44,7 @@ public virtual StandbyVirtualMachineResource GetStandbyVirtualMachineResource(Re return new StandbyVirtualMachineResource(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. /// The resource ID of the resource to get. /// Returns a object. public virtual StandbyVirtualMachinePoolRuntimeViewResource GetStandbyVirtualMachinePoolRuntimeViewResource(ResourceIdentifier id) @@ -70,10 +53,7 @@ public virtual StandbyVirtualMachinePoolRuntimeViewResource GetStandbyVirtualMac return new StandbyVirtualMachinePoolRuntimeViewResource(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. /// The resource ID of the resource to get. /// Returns a object. public virtual StandbyContainerGroupPoolResource GetStandbyContainerGroupPoolResource(ResourceIdentifier id) @@ -82,10 +62,7 @@ public virtual StandbyContainerGroupPoolResource GetStandbyContainerGroupPoolRes return new StandbyContainerGroupPoolResource(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. /// The resource ID of the resource to get. /// Returns a object. public virtual StandbyContainerGroupPoolRuntimeViewResource GetStandbyContainerGroupPoolRuntimeViewResource(ResourceIdentifier id) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolResourceGroupResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolResourceGroupResource.cs index 3ab3c3783f88..d653e79a7888 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolResourceGroupResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolResourceGroupResource.cs @@ -8,33 +8,31 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableStandbyPoolResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableStandbyPoolResourceGroupResource for mocking. protected MockableStandbyPoolResourceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableStandbyPoolResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of StandbyVirtualMachinePoolResources in the ResourceGroupResource. - /// An object representing collection of StandbyVirtualMachinePoolResources and their operations over a StandbyVirtualMachinePoolResource. + /// Gets a collection of StandbyVirtualMachinePools in the . + /// An object representing collection of StandbyVirtualMachinePools and their operations over a StandbyVirtualMachinePoolResource. public virtual StandbyVirtualMachinePoolCollection GetStandbyVirtualMachinePools() { return GetCachedClient(client => new StandbyVirtualMachinePoolCollection(client, Id)); @@ -44,20 +42,16 @@ public virtual StandbyVirtualMachinePoolCollection GetStandbyVirtualMachinePools /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -68,6 +62,8 @@ public virtual StandbyVirtualMachinePoolCollection GetStandbyVirtualMachinePools [ForwardsClientCalls] public virtual async Task> GetStandbyVirtualMachinePoolAsync(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); + return await GetStandbyVirtualMachinePools().GetAsync(standbyVirtualMachinePoolName, cancellationToken).ConfigureAwait(false); } @@ -75,20 +71,16 @@ public virtual async Task> GetStandb /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -99,11 +91,13 @@ public virtual async Task> GetStandb [ForwardsClientCalls] public virtual Response GetStandbyVirtualMachinePool(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); + return GetStandbyVirtualMachinePools().Get(standbyVirtualMachinePoolName, cancellationToken); } - /// Gets a collection of StandbyContainerGroupPoolResources in the ResourceGroupResource. - /// An object representing collection of StandbyContainerGroupPoolResources and their operations over a StandbyContainerGroupPoolResource. + /// Gets a collection of StandbyContainerGroupPools in the . + /// An object representing collection of StandbyContainerGroupPools and their operations over a StandbyContainerGroupPoolResource. public virtual StandbyContainerGroupPoolCollection GetStandbyContainerGroupPools() { return GetCachedClient(client => new StandbyContainerGroupPoolCollection(client, Id)); @@ -113,20 +107,16 @@ public virtual StandbyContainerGroupPoolCollection GetStandbyContainerGroupPools /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -137,6 +127,8 @@ public virtual StandbyContainerGroupPoolCollection GetStandbyContainerGroupPools [ForwardsClientCalls] public virtual async Task> GetStandbyContainerGroupPoolAsync(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); + return await GetStandbyContainerGroupPools().GetAsync(standbyContainerGroupPoolName, cancellationToken).ConfigureAwait(false); } @@ -144,20 +136,16 @@ public virtual async Task> GetStandb /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -168,6 +156,8 @@ public virtual async Task> GetStandb [ForwardsClientCalls] public virtual Response GetStandbyContainerGroupPool(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); + return GetStandbyContainerGroupPools().Get(standbyContainerGroupPoolName, cancellationToken); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolSubscriptionResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolSubscriptionResource.cs index fa791bfdf53f..46e5bd371f2e 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolSubscriptionResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/MockableStandbyPoolSubscriptionResource.cs @@ -5,92 +5,87 @@ #nullable disable +using System; using System.Threading; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableStandbyPoolSubscriptionResource : ArmResource { - private ClientDiagnostics _standbyVirtualMachinePoolClientDiagnostics; - private StandbyVirtualMachinePoolsRestOperations _standbyVirtualMachinePoolRestClient; - private ClientDiagnostics _standbyContainerGroupPoolClientDiagnostics; - private StandbyContainerGroupPoolsRestOperations _standbyContainerGroupPoolRestClient; + private ClientDiagnostics _standbyVirtualMachinePoolsClientDiagnostics; + private StandbyVirtualMachinePools _standbyVirtualMachinePoolsRestClient; + private ClientDiagnostics _standbyContainerGroupPoolsClientDiagnostics; + private StandbyContainerGroupPools _standbyContainerGroupPoolsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableStandbyPoolSubscriptionResource for mocking. protected MockableStandbyPoolSubscriptionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableStandbyPoolSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics StandbyVirtualMachinePoolClientDiagnostics => _standbyVirtualMachinePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachinePoolResource.ResourceType.Namespace, Diagnostics); - private StandbyVirtualMachinePoolsRestOperations StandbyVirtualMachinePoolRestClient => _standbyVirtualMachinePoolRestClient ??= new StandbyVirtualMachinePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StandbyVirtualMachinePoolResource.ResourceType)); - private ClientDiagnostics StandbyContainerGroupPoolClientDiagnostics => _standbyContainerGroupPoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyContainerGroupPoolResource.ResourceType.Namespace, Diagnostics); - private StandbyContainerGroupPoolsRestOperations StandbyContainerGroupPoolRestClient => _standbyContainerGroupPoolRestClient ??= new StandbyContainerGroupPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(StandbyContainerGroupPoolResource.ResourceType)); + private ClientDiagnostics StandbyVirtualMachinePoolsClientDiagnostics => _standbyVirtualMachinePoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StandbyPool.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private StandbyVirtualMachinePools StandbyVirtualMachinePoolsRestClient => _standbyVirtualMachinePoolsRestClient ??= new StandbyVirtualMachinePools(StandbyVirtualMachinePoolsClientDiagnostics, Pipeline, Endpoint, "2025-10-01"); + + private ClientDiagnostics StandbyContainerGroupPoolsClientDiagnostics => _standbyContainerGroupPoolsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.StandbyPool.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private StandbyContainerGroupPools StandbyContainerGroupPoolsRestClient => _standbyContainerGroupPoolsRestClient ??= new StandbyContainerGroupPools(StandbyContainerGroupPoolsClientDiagnostics, Pipeline, Endpoint, "2025-10-01"); /// /// List StandbyVirtualMachinePoolResource resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListBySubscription + /// Operation Id. + /// StandbyVirtualMachinePools_ListBySubscription. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetStandbyVirtualMachinePoolsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StandbyVirtualMachinePoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StandbyVirtualMachinePoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolResource(Client, StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(e)), StandbyVirtualMachinePoolClientDiagnostics, Pipeline, "MockableStandbyPoolSubscriptionResource.GetStandbyVirtualMachinePools", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyVirtualMachinePoolsGetBySubscriptionAsyncCollectionResultOfT(StandbyVirtualMachinePoolsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new StandbyVirtualMachinePoolResource(Client, data)); } /// /// List StandbyVirtualMachinePoolResource resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListBySubscription + /// Operation Id. + /// StandbyVirtualMachinePools_ListBySubscription. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -98,59 +93,55 @@ public virtual AsyncPageable GetStandbyVirtua /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetStandbyVirtualMachinePools(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StandbyVirtualMachinePoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StandbyVirtualMachinePoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolResource(Client, StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(e)), StandbyVirtualMachinePoolClientDiagnostics, Pipeline, "MockableStandbyPoolSubscriptionResource.GetStandbyVirtualMachinePools", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyVirtualMachinePoolsGetBySubscriptionCollectionResultOfT(StandbyVirtualMachinePoolsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new StandbyVirtualMachinePoolResource(Client, data)); } /// /// List StandbyContainerGroupPoolResource resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetStandbyContainerGroupPoolsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StandbyContainerGroupPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StandbyContainerGroupPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolResource(Client, StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(e)), StandbyContainerGroupPoolClientDiagnostics, Pipeline, "MockableStandbyPoolSubscriptionResource.GetStandbyContainerGroupPools", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyContainerGroupPoolsGetBySubscriptionAsyncCollectionResultOfT(StandbyContainerGroupPoolsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new StandbyContainerGroupPoolResource(Client, data)); } /// /// List StandbyContainerGroupPoolResource resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -158,9 +149,11 @@ public virtual AsyncPageable GetStandbyContai /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetStandbyContainerGroupPools(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StandbyContainerGroupPoolRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StandbyContainerGroupPoolRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolResource(Client, StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(e)), StandbyContainerGroupPoolClientDiagnostics, Pipeline, "MockableStandbyPoolSubscriptionResource.GetStandbyContainerGroupPools", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyContainerGroupPoolsGetBySubscriptionCollectionResultOfT(StandbyContainerGroupPoolsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new StandbyContainerGroupPoolResource(Client, data)); } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/StandbyPoolExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/StandbyPoolExtensions.cs index 008b35543a53..f0dfa77d44fd 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/StandbyPoolExtensions.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Extensions/StandbyPoolExtensions.cs @@ -8,7 +8,9 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; using Azure.ResourceManager.StandbyPool.Mocking; @@ -17,30 +19,32 @@ namespace Azure.ResourceManager.StandbyPool /// A class to add extension methods to Azure.ResourceManager.StandbyPool. public static partial class StandbyPoolExtensions { + /// private static MockableStandbyPoolArmClient GetMockableStandbyPoolArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableStandbyPoolArmClient(client0)); + return client.GetCachedClient(client0 => new MockableStandbyPoolArmClient(client0, ResourceIdentifier.Root)); } - private static MockableStandbyPoolResourceGroupResource GetMockableStandbyPoolResourceGroupResource(ArmResource resource) + /// + private static MockableStandbyPoolResourceGroupResource GetMockableStandbyPoolResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableStandbyPoolResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableStandbyPoolResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableStandbyPoolSubscriptionResource GetMockableStandbyPoolSubscriptionResource(ArmResource resource) + /// + private static MockableStandbyPoolSubscriptionResource GetMockableStandbyPoolSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableStandbyPoolSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableStandbyPoolSubscriptionResource(client, subscriptionResource.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. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -52,14 +56,13 @@ public static StandbyVirtualMachinePoolResource GetStandbyVirtualMachinePoolReso } /// - /// 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. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -71,14 +74,13 @@ public static StandbyVirtualMachineResource GetStandbyVirtualMachineResource(thi } /// - /// 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. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -90,14 +92,13 @@ public static StandbyVirtualMachinePoolRuntimeViewResource GetStandbyVirtualMach } /// - /// 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. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -109,14 +110,13 @@ public static StandbyContainerGroupPoolResource GetStandbyContainerGroupPoolReso } /// - /// 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. /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -128,15 +128,15 @@ public static StandbyContainerGroupPoolRuntimeViewResource GetStandbyContainerGr } /// - /// Gets a collection of StandbyVirtualMachinePoolResources in the ResourceGroupResource. + /// Gets a collection of StandbyVirtualMachinePools in the /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// is null. - /// An object representing collection of StandbyVirtualMachinePoolResources and their operations over a StandbyVirtualMachinePoolResource. + /// An object representing collection of StandbyVirtualMachinePools and their operations over a StandbyVirtualMachinePoolResource. public static StandbyVirtualMachinePoolCollection GetStandbyVirtualMachinePools(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -146,34 +146,15 @@ public static StandbyVirtualMachinePoolCollection GetStandbyVirtualMachinePools( /// /// Get a StandbyVirtualMachinePoolResource - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static async Task> GetStandbyVirtualMachinePoolAsync(this ResourceGroupResource resourceGroupResource, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { @@ -184,34 +165,15 @@ public static async Task> GetStandby /// /// Get a StandbyVirtualMachinePoolResource - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static Response GetStandbyVirtualMachinePool(this ResourceGroupResource resourceGroupResource, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { @@ -221,15 +183,15 @@ public static Response GetStandbyVirtualMachi } /// - /// Gets a collection of StandbyContainerGroupPoolResources in the ResourceGroupResource. + /// Gets a collection of StandbyContainerGroupPools in the /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// is null. - /// An object representing collection of StandbyContainerGroupPoolResources and their operations over a StandbyContainerGroupPoolResource. + /// An object representing collection of StandbyContainerGroupPools and their operations over a StandbyContainerGroupPoolResource. public static StandbyContainerGroupPoolCollection GetStandbyContainerGroupPools(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -239,34 +201,15 @@ public static StandbyContainerGroupPoolCollection GetStandbyContainerGroupPools( /// /// Get a StandbyContainerGroupPoolResource - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the standby container group pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static async Task> GetStandbyContainerGroupPoolAsync(this ResourceGroupResource resourceGroupResource, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { @@ -277,34 +220,15 @@ public static async Task> GetStandby /// /// Get a StandbyContainerGroupPoolResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the standby container group pool. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static Response GetStandbyContainerGroupPool(this ResourceGroupResource resourceGroupResource, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { @@ -315,33 +239,15 @@ public static Response GetStandbyContainerGro /// /// List StandbyVirtualMachinePoolResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStandbyVirtualMachinePoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -351,30 +257,12 @@ public static AsyncPageable GetStandbyVirtual /// /// List StandbyVirtualMachinePoolResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. @@ -387,33 +275,15 @@ public static Pageable GetStandbyVirtualMachi /// /// List StandbyContainerGroupPoolResource resources by subscription ID - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public static AsyncPageable GetStandbyContainerGroupPoolsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -423,30 +293,12 @@ public static AsyncPageable GetStandbyContain /// /// List StandbyContainerGroupPoolResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StandbyPool/standbyContainerGroupPools - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Argument.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Argument.cs index efb254a4c6ec..5bcc83e94ecd 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Argument.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.StandbyPool { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) throw new ArgumentException("Value cannot be an empty string.", name); } } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..a76ca9860e49 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/AsyncPageableWrapper.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class AsyncPageableWrapper : AsyncPageable + { + /// The source async pageable value of type AsyncPageable<T>. + private AsyncPageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the AsyncPageableWrapper class. + /// The source async pageable value of type AsyncPageable<T>. + /// The converter function from T to U. + public AsyncPageableWrapper(AsyncPageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from AsyncPageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + await foreach (Page page in _source.AsPages(continuationToken, pageSizeHint).ConfigureAwait(false)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingDictionary.cs index 418045a3497b..6d7e940c391d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.StandbyPool { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingList.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingList.cs index 87f5512f61e5..eb59f8dc2ecb 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.StandbyPool { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..bec81786dff5 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.StandbyPool +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..a5a29191cd05 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.StandbyPool +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..ad7faa50bfe5 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.StandbyPool +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..769297c1e947 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.StandbyPool +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..568525bb9c6b --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.StandbyPool +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ErrorResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..c2352eb24718 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ModelSerializationExtensions.cs index 0dbbb53529ed..7590f1892421 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.StandbyPool { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Optional.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Optional.cs index 67944806d44d..6cdd5854b8ef 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Optional.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.StandbyPool { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/PageableWrapper.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..4b3a08d1c340 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/PageableWrapper.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.ResourceManager.StandbyPool +{ + internal partial class PageableWrapper : Pageable + { + /// The source pageable value of type Pageable<T>. + private Pageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the PageableWrapper class. + /// The source pageable value of type Pageable<T>. + /// The converter function from T to U. + public PageableWrapper(Pageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from Pageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + foreach (Page page in _source.AsPages(continuationToken, pageSizeHint)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..f155ba8627ed --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.StandbyPool +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RequestContextExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..f14d6f736b6c --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.StandbyPool +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/SerializationFormat.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..c1a8ab77e2b6 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StandbyPool +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/TypeFormatters.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..8fa34a69de8a --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.ResourceManager.StandbyPool +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Utf8JsonRequestContent.cs index 5ecbaac9cd1d..b6fa86e27ccf 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.StandbyPool { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyContainerGroupPoolOperationSource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyContainerGroupPoolOperationSource.cs index 7eda555d3469..8473c24a9050 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyContainerGroupPoolOperationSource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyContainerGroupPoolOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { - internal class StandbyContainerGroupPoolOperationSource : IOperationSource + /// + internal partial class StandbyContainerGroupPoolOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal StandbyContainerGroupPoolOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// StandbyContainerGroupPoolResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + StandbyContainerGroupPoolData data = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); return new StandbyContainerGroupPoolResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); - return await Task.FromResult(new StandbyContainerGroupPoolResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + StandbyContainerGroupPoolData data = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new StandbyContainerGroupPoolResource(_client, data); } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperation.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperation.cs index b428e5826a8c..dc6eb0fe7f37 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperation.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperation.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { -#pragma warning disable SA1649 // File name should match first type name - internal class StandbyPoolArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class StandbyPoolArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected StandbyPoolArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal StandbyPoolArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal StandbyPoolArmOperation(Response response, RehydrationToken? rehydratio _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal StandbyPoolArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,48 +58,49 @@ internal StandbyPoolArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeli _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "StandbyPoolArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "StandbyPoolArmOperation", + null, + new SequentialDelayStrategy()); } + /// Gets the Id. + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// Gets the HasCompleted. + public override bool HasCompleted => _operation.HasCompleted; + + /// The token to rehydrate a long-running operation. private string GetOperationId(RehydrationToken? rehydrationToken) { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); + return rehydrationToken?.Id; } - /// - public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// + /// public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperationOfT.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperationOfT.cs index 355d188c65b3..348b0e0e5b16 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperationOfT.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyPoolArmOperationOfT.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { -#pragma warning disable SA1649 // File name should match first type name - internal class StandbyPoolArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class StandbyPoolArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected StandbyPoolArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal StandbyPoolArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal StandbyPoolArmOperation(Response response, RehydrationToken? rehydra _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal StandbyPoolArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,54 +59,55 @@ internal StandbyPoolArmOperation(IOperationSource source, ClientDiagnostics c _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "StandbyPoolArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "StandbyPoolArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); - } - /// + /// Gets the Id. public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// - public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - - /// + /// Gets the Value. public override T Value => _operation.Value; - /// + /// Gets the HasValue. public override bool HasValue => _operation.HasValue; - /// + /// Gets the HasCompleted. public override bool HasCompleted => _operation.HasCompleted; - /// + /// The token to rehydrate a long-running operation. + private string GetOperationId(RehydrationToken? rehydrationToken) + { + return rehydrationToken?.Id; + } + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); - /// + /// public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyVirtualMachinePoolOperationSource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyVirtualMachinePoolOperationSource.cs index 877687bd32cc..1af24b116325 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyVirtualMachinePoolOperationSource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/LongRunningOperation/StandbyVirtualMachinePoolOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { - internal class StandbyVirtualMachinePoolOperationSource : IOperationSource + /// + internal partial class StandbyVirtualMachinePoolOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal StandbyVirtualMachinePoolOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// StandbyVirtualMachinePoolResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + StandbyVirtualMachinePoolData data = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement, ModelSerializationExtensions.WireOptions); return new StandbyVirtualMachinePoolResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerStandbyPoolContext.Default); - return await Task.FromResult(new StandbyVirtualMachinePoolResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + StandbyVirtualMachinePoolData data = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new StandbyVirtualMachinePoolResource(_client, data); } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/AzureResourceManagerStandbyPoolContext.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/AzureResourceManagerStandbyPoolContext.cs index e634b0b3fad8..71adc8698d86 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/AzureResourceManagerStandbyPoolContext.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/AzureResourceManagerStandbyPoolContext.cs @@ -6,21 +6,22 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// [ModelReaderWriterBuildable(typeof(ContainerGroupInstanceCountSummary))] [ModelReaderWriterBuildable(typeof(PoolContainerGroupStateCount))] [ModelReaderWriterBuildable(typeof(PoolVirtualMachineStateCount))] [ModelReaderWriterBuildable(typeof(ResponseError))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolData))] + [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolDynamicSizing))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolElasticityProfile))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolForecastValues))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolPatch))] @@ -28,11 +29,11 @@ namespace Azure.ResourceManager.StandbyPool [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolProperties))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolResource))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolResourceListResult))] + [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolResourceUpdateProperties))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolRuntimeViewData))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolRuntimeViewProperties))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolRuntimeViewResource))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolRuntimeViewResourceListResult))] - [ModelReaderWriterBuildable(typeof(StandbyContainerGroupPoolUpdateProperties))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupProfile))] [ModelReaderWriterBuildable(typeof(StandbyContainerGroupProperties))] [ModelReaderWriterBuildable(typeof(StandbyPoolStatus))] @@ -46,16 +47,15 @@ namespace Azure.ResourceManager.StandbyPool [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolProperties))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolResource))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolResourceListResult))] + [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolResourceUpdateProperties))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolRuntimeViewData))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolRuntimeViewProperties))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolRuntimeViewResource))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolRuntimeViewResourceListResult))] - [ModelReaderWriterBuildable(typeof(StandbyVirtualMachinePoolUpdateProperties))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachineProperties))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachineResource))] [ModelReaderWriterBuildable(typeof(StandbyVirtualMachineResourceListResult))] [ModelReaderWriterBuildable(typeof(SystemData))] - [ModelReaderWriterBuildable(typeof(WritableSubResource))] public partial class AzureResourceManagerStandbyPoolContext : ModelReaderWriterContext { } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.Serialization.cs index 65274824b189..b567e64079ae 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class ContainerGroupInstanceCountSummary : IUtf8JsonSerializable, IJsonModel + /// Displays the counts of container groups in each state, as known by the StandbyPool resource provider. + public partial class ContainerGroupInstanceCountSummary : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ContainerGroupInstanceCountSummary() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,28 +34,32 @@ void IJsonModel.Write(Utf8JsonWriter 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ContainerGroupInstanceCountSummary)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Zone)) { writer.WritePropertyName("zone"u8); writer.WriteNumberValue(Zone.Value); } writer.WritePropertyName("instanceCountsByState"u8); - InstanceCountsByStateSerial(writer, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) + writer.WriteStartArray(); + foreach (PoolContainerGroupStateCount item in StandbyContainerGroupInstanceCountsByState) { - foreach (var item in _serializedAdditionalRawData) + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,64 +68,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerGroupInstanceCountSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ContainerGroupInstanceCountSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ContainerGroupInstanceCountSummary JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ContainerGroupInstanceCountSummary)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeContainerGroupInstanceCountSummary(document.RootElement, options); } - internal static ContainerGroupInstanceCountSummary DeserializeContainerGroupInstanceCountSummary(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ContainerGroupInstanceCountSummary DeserializeContainerGroupInstanceCountSummary(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } long? zone = default; - IReadOnlyList instanceCountsByState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IReadOnlyList standbyContainerGroupInstanceCountsByState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("zone"u8)) + if (prop.NameEquals("zone"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - zone = property.Value.GetInt64(); + zone = prop.Value.GetInt64(); continue; } - if (property.NameEquals("instanceCountsByState"u8)) + if (prop.NameEquals("instanceCountsByState"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(PoolContainerGroupStateCount.DeserializePoolContainerGroupStateCount(item, options)); } - instanceCountsByState = array; + standbyContainerGroupInstanceCountsByState = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerGroupInstanceCountSummary(zone, instanceCountsByState, serializedAdditionalRawData); + return new ContainerGroupInstanceCountSummary(zone, standbyContainerGroupInstanceCountsByState, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -125,15 +141,20 @@ BinaryData IPersistableModel.Write(ModelRead } } - ContainerGroupInstanceCountSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ContainerGroupInstanceCountSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ContainerGroupInstanceCountSummary PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeContainerGroupInstanceCountSummary(document.RootElement, options); } default: @@ -141,6 +162,7 @@ ContainerGroupInstanceCountSummary IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.cs index d0a78e9ebbd9..eedab812e226 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/ContainerGroupInstanceCountSummary.cs @@ -14,66 +14,30 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays the counts of container groups in each state, as known by the StandbyPool resource provider. public partial class ContainerGroupInstanceCountSummary { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The count of pooled container groups in each state for the given zone. - /// is null. internal ContainerGroupInstanceCountSummary(IEnumerable standbyContainerGroupInstanceCountsByState) { - Argument.AssertNotNull(standbyContainerGroupInstanceCountsByState, nameof(standbyContainerGroupInstanceCountsByState)); - StandbyContainerGroupInstanceCountsByState = standbyContainerGroupInstanceCountsByState.ToList(); } /// Initializes a new instance of . /// The zone that the provided counts are in. It will not have a value if zones are not enabled. /// The count of pooled container groups in each state for the given zone. - /// Keeps track of any properties unknown to the library. - internal ContainerGroupInstanceCountSummary(long? zone, IReadOnlyList standbyContainerGroupInstanceCountsByState, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ContainerGroupInstanceCountSummary(long? zone, IReadOnlyList standbyContainerGroupInstanceCountsByState, IDictionary additionalBinaryDataProperties) { Zone = zone; StandbyContainerGroupInstanceCountsByState = standbyContainerGroupInstanceCountsByState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerGroupInstanceCountSummary() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The zone that the provided counts are in. It will not have a value if zones are not enabled. public long? Zone { get; } + /// The count of pooled container groups in each state for the given zone. public IReadOnlyList StandbyContainerGroupInstanceCountsByState { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupState.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupState.cs index 244c909c5321..ad8c1b809633 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupState.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,41 +15,62 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct PoolContainerGroupState : IEquatable { private readonly string _value; + /// The container group is up and running. + private const string RunningValue = "Running"; + /// The container group is creating. + private const string CreatingValue = "Creating"; + /// The container group is deleting. + private const string DeletingValue = "Deleting"; /// Initializes a new instance of . + /// The value. /// is null. public PoolContainerGroupState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string RunningValue = "Running"; - private const string CreatingValue = "Creating"; - private const string DeletingValue = "Deleting"; + _value = value; + } /// The container group is up and running. public static PoolContainerGroupState Running { get; } = new PoolContainerGroupState(RunningValue); + /// The container group is creating. public static PoolContainerGroupState Creating { get; } = new PoolContainerGroupState(CreatingValue); + /// The container group is deleting. public static PoolContainerGroupState Deleting { get; } = new PoolContainerGroupState(DeletingValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(PoolContainerGroupState left, PoolContainerGroupState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(PoolContainerGroupState left, PoolContainerGroupState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator PoolContainerGroupState(string value) => new PoolContainerGroupState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator PoolContainerGroupState?(string value) => value == null ? null : new PoolContainerGroupState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is PoolContainerGroupState other && Equals(other); - /// + + /// public bool Equals(PoolContainerGroupState 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.Serialization.cs index 5f6ef19c20d2..12ef58141eec 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class PoolContainerGroupStateCount : IUtf8JsonSerializable, IJsonModel + /// Displays the counts of pooled container groups in each state, as known by the StandbyPool resource provider. + public partial class PoolContainerGroupStateCount : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal PoolContainerGroupStateCount() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,25 +34,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PoolContainerGroupStateCount)} does not support writing '{format}' format."); } - writer.WritePropertyName("state"u8); writer.WriteStringValue(State.ToString()); writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -55,55 +60,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PoolContainerGroupStateCount IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + PoolContainerGroupStateCount IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PoolContainerGroupStateCount JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PoolContainerGroupStateCount)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializePoolContainerGroupStateCount(document.RootElement, options); } - internal static PoolContainerGroupStateCount DeserializePoolContainerGroupStateCount(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PoolContainerGroupStateCount DeserializePoolContainerGroupStateCount(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } PoolContainerGroupState state = default; long count = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("state"u8)) + if (prop.NameEquals("state"u8)) { - state = new PoolContainerGroupState(property.Value.GetString()); + state = new PoolContainerGroupState(prop.Value.GetString()); continue; } - if (property.NameEquals("count"u8)) + if (prop.NameEquals("count"u8)) { - count = property.Value.GetInt64(); + count = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new PoolContainerGroupStateCount(state, count, serializedAdditionalRawData); + return new PoolContainerGroupStateCount(state, count, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -113,15 +124,20 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - PoolContainerGroupStateCount IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + PoolContainerGroupStateCount IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PoolContainerGroupStateCount PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializePoolContainerGroupStateCount(document.RootElement, options); } default: @@ -129,6 +145,7 @@ PoolContainerGroupStateCount IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.cs index 05f6308563b4..f3c8066d02e6 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolContainerGroupStateCount.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays the counts of pooled container groups in each state, as known by the StandbyPool resource provider. public partial class PoolContainerGroupStateCount { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The state that the pooled container groups count is for. @@ -57,21 +28,17 @@ internal PoolContainerGroupStateCount(PoolContainerGroupState state, long count) /// Initializes a new instance of . /// The state that the pooled container groups count is for. /// The count of pooled container groups in the given state. - /// Keeps track of any properties unknown to the library. - internal PoolContainerGroupStateCount(PoolContainerGroupState state, long count, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal PoolContainerGroupStateCount(PoolContainerGroupState state, long count, IDictionary additionalBinaryDataProperties) { State = state; Count = count; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PoolContainerGroupStateCount() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The state that the pooled container groups count is for. public PoolContainerGroupState State { get; } + /// The count of pooled container groups in the given state. public long Count { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineState.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineState.cs index 4fa4e8a2fbeb..d341d0b686e6 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineState.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,56 +15,87 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct PoolVirtualMachineState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public PoolVirtualMachineState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - + /// The virtual machine is up and running. private const string RunningValue = "Running"; + /// The virtual machine is creating. private const string CreatingValue = "Creating"; + /// The virtual machine is starting. private const string StartingValue = "Starting"; + /// The virtual machine is deleting. private const string DeletingValue = "Deleting"; + /// The virtual machine has released the lease on the underlying hardware and is powered off. private const string DeallocatedValue = "Deallocated"; + /// The virtual machine is releasing the lease on the underlying hardware and is powered off. private const string DeallocatingValue = "Deallocating"; + /// The virtual machine has released the lease on the underlying hardware and is powered off. Memory contents of the VM are stored in the OS disk. When started again, applications and processes that were previously running in your VM resume from the state prior to hibernation. private const string HibernatedValue = "Hibernated"; + /// The virtual machine is hibernating. private const string HibernatingValue = "Hibernating"; + /// Initializes a new instance of . + /// The value. + /// is null. + public PoolVirtualMachineState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + /// The virtual machine is up and running. public static PoolVirtualMachineState Running { get; } = new PoolVirtualMachineState(RunningValue); + /// The virtual machine is creating. public static PoolVirtualMachineState Creating { get; } = new PoolVirtualMachineState(CreatingValue); + /// The virtual machine is starting. public static PoolVirtualMachineState Starting { get; } = new PoolVirtualMachineState(StartingValue); + /// The virtual machine is deleting. public static PoolVirtualMachineState Deleting { get; } = new PoolVirtualMachineState(DeletingValue); + /// The virtual machine has released the lease on the underlying hardware and is powered off. public static PoolVirtualMachineState Deallocated { get; } = new PoolVirtualMachineState(DeallocatedValue); + /// The virtual machine is releasing the lease on the underlying hardware and is powered off. public static PoolVirtualMachineState Deallocating { get; } = new PoolVirtualMachineState(DeallocatingValue); + /// The virtual machine has released the lease on the underlying hardware and is powered off. Memory contents of the VM are stored in the OS disk. When started again, applications and processes that were previously running in your VM resume from the state prior to hibernation. public static PoolVirtualMachineState Hibernated { get; } = new PoolVirtualMachineState(HibernatedValue); + /// The virtual machine is hibernating. public static PoolVirtualMachineState Hibernating { get; } = new PoolVirtualMachineState(HibernatingValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(PoolVirtualMachineState left, PoolVirtualMachineState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(PoolVirtualMachineState left, PoolVirtualMachineState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator PoolVirtualMachineState(string value) => new PoolVirtualMachineState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator PoolVirtualMachineState?(string value) => value == null ? null : new PoolVirtualMachineState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is PoolVirtualMachineState other && Equals(other); - /// + + /// public bool Equals(PoolVirtualMachineState 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.Serialization.cs index 171af1831289..dd7527ecddeb 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class PoolVirtualMachineStateCount : IUtf8JsonSerializable, IJsonModel + /// Displays the counts of pooled virtual machines in each state, as known by the StandbyPool resource provider. + public partial class PoolVirtualMachineStateCount : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal PoolVirtualMachineStateCount() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,25 +34,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PoolVirtualMachineStateCount)} does not support writing '{format}' format."); } - writer.WritePropertyName("state"u8); writer.WriteStringValue(State.ToString()); writer.WritePropertyName("count"u8); writer.WriteNumberValue(Count); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -55,55 +60,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PoolVirtualMachineStateCount IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + PoolVirtualMachineStateCount IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PoolVirtualMachineStateCount JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(PoolVirtualMachineStateCount)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializePoolVirtualMachineStateCount(document.RootElement, options); } - internal static PoolVirtualMachineStateCount DeserializePoolVirtualMachineStateCount(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PoolVirtualMachineStateCount DeserializePoolVirtualMachineStateCount(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } PoolVirtualMachineState state = default; long count = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("state"u8)) + if (prop.NameEquals("state"u8)) { - state = new PoolVirtualMachineState(property.Value.GetString()); + state = new PoolVirtualMachineState(prop.Value.GetString()); continue; } - if (property.NameEquals("count"u8)) + if (prop.NameEquals("count"u8)) { - count = property.Value.GetInt64(); + count = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new PoolVirtualMachineStateCount(state, count, serializedAdditionalRawData); + return new PoolVirtualMachineStateCount(state, count, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -113,15 +124,20 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - PoolVirtualMachineStateCount IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + PoolVirtualMachineStateCount IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PoolVirtualMachineStateCount PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializePoolVirtualMachineStateCount(document.RootElement, options); } default: @@ -129,6 +145,7 @@ PoolVirtualMachineStateCount IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.cs index 3157ee5a97ab..81abe451086e 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/PoolVirtualMachineStateCount.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays the counts of pooled virtual machines in each state, as known by the StandbyPool resource provider. public partial class PoolVirtualMachineStateCount { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The state that the pooled virtual machines count is for. @@ -57,21 +28,17 @@ internal PoolVirtualMachineStateCount(PoolVirtualMachineState state, long count) /// Initializes a new instance of . /// The state that the pooled virtual machines count is for. /// The count of pooled virtual machines in the given state. - /// Keeps track of any properties unknown to the library. - internal PoolVirtualMachineStateCount(PoolVirtualMachineState state, long count, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal PoolVirtualMachineStateCount(PoolVirtualMachineState state, long count, IDictionary additionalBinaryDataProperties) { State = state; Count = count; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PoolVirtualMachineStateCount() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The state that the pooled virtual machines count is for. public PoolVirtualMachineState State { get; } + /// The count of pooled virtual machines in the given state. public long Count { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.Serialization.cs new file mode 100644 index 000000000000..fe458d36f3b6 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.Serialization.cs @@ -0,0 +1,145 @@ +// 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.ResourceManager.StandbyPool; + +namespace Azure.ResourceManager.StandbyPool.Models +{ + /// Specifies the dynamic sizing configuration. + internal partial class StandbyContainerGroupPoolDynamicSizing : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolDynamicSizing)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolDynamicSizing IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolDynamicSizing JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolDynamicSizing)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStandbyContainerGroupPoolDynamicSizing(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolDynamicSizing DeserializeStandbyContainerGroupPoolDynamicSizing(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new StandbyContainerGroupPoolDynamicSizing(enabled, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerStandbyPoolContext.Default); + default: + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolDynamicSizing)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolDynamicSizing IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolDynamicSizing PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeStandbyContainerGroupPoolDynamicSizing(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolDynamicSizing)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.cs new file mode 100644 index 000000000000..bdce8f997cac --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolDynamicSizing.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.StandbyPool.Models +{ + /// Specifies the dynamic sizing configuration. + internal partial class StandbyContainerGroupPoolDynamicSizing + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public StandbyContainerGroupPoolDynamicSizing() + { + } + + /// Initializes a new instance of . + /// Indicates whether dynamic sizing is enabled for the standby pool. + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolDynamicSizing(bool? enabled, IDictionary additionalBinaryDataProperties) + { + Enabled = enabled; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Indicates whether dynamic sizing is enabled for the standby pool. + public bool? Enabled { get; set; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.Serialization.cs index 52afbeac4c04..f5085dda48e1 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupPoolElasticityProfile : IUtf8JsonSerializable, IJsonModel + /// Specifies the elasticity profile of the standby container group pools. + public partial class StandbyContainerGroupPoolElasticityProfile : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupPoolElasticityProfile() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolElasticityProfile)} does not support writing '{format}' format."); } - writer.WritePropertyName("maxReadyCapacity"u8); writer.WriteNumberValue(MaxReadyCapacity); if (Optional.IsDefined(RefillPolicy)) @@ -41,15 +46,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("refillPolicy"u8); writer.WriteStringValue(RefillPolicy.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (Optional.IsDefined(DynamicSizing)) + { + writer.WritePropertyName("dynamicSizing"u8); + writer.WriteObjectValue(DynamicSizing, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,59 +68,75 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolElasticityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolElasticityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolElasticityProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolElasticityProfile)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolElasticityProfile(document.RootElement, options); } - internal static StandbyContainerGroupPoolElasticityProfile DeserializeStandbyContainerGroupPoolElasticityProfile(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolElasticityProfile DeserializeStandbyContainerGroupPoolElasticityProfile(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } long maxReadyCapacity = default; StandbyRefillPolicy? refillPolicy = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + StandbyContainerGroupPoolDynamicSizing dynamicSizing = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("maxReadyCapacity"u8)) + if (prop.NameEquals("maxReadyCapacity"u8)) + { + maxReadyCapacity = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("refillPolicy"u8)) { - maxReadyCapacity = property.Value.GetInt64(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + refillPolicy = new StandbyRefillPolicy(prop.Value.GetString()); continue; } - if (property.NameEquals("refillPolicy"u8)) + if (prop.NameEquals("dynamicSizing"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - refillPolicy = new StandbyRefillPolicy(property.Value.GetString()); + dynamicSizing = StandbyContainerGroupPoolDynamicSizing.DeserializeStandbyContainerGroupPoolDynamicSizing(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolElasticityProfile(maxReadyCapacity, refillPolicy, serializedAdditionalRawData); + return new StandbyContainerGroupPoolElasticityProfile(maxReadyCapacity, refillPolicy, dynamicSizing, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -120,15 +146,20 @@ BinaryData IPersistableModel.Write(M } } - StandbyContainerGroupPoolElasticityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolElasticityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolElasticityProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolElasticityProfile(document.RootElement, options); } default: @@ -136,6 +167,7 @@ StandbyContainerGroupPoolElasticityProfile IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.cs index bb79d2da4293..632bf82e99e3 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolElasticityProfile.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Specifies the elasticity profile of the standby container group pools. public partial class StandbyContainerGroupPoolElasticityProfile { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies maximum number of standby container groups in the standby pool. @@ -55,22 +26,40 @@ public StandbyContainerGroupPoolElasticityProfile(long maxReadyCapacity) /// Initializes a new instance of . /// Specifies maximum number of standby container groups in the standby pool. /// Specifies refill policy of the pool. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolElasticityProfile(long maxReadyCapacity, StandbyRefillPolicy? refillPolicy, IDictionary serializedAdditionalRawData) + /// Specifies the dynamic sizing configuration. + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolElasticityProfile(long maxReadyCapacity, StandbyRefillPolicy? refillPolicy, StandbyContainerGroupPoolDynamicSizing dynamicSizing, IDictionary additionalBinaryDataProperties) { MaxReadyCapacity = maxReadyCapacity; RefillPolicy = refillPolicy; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolElasticityProfile() - { + DynamicSizing = dynamicSizing; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies maximum number of standby container groups in the standby pool. public long MaxReadyCapacity { get; set; } + /// Specifies refill policy of the pool. public StandbyRefillPolicy? RefillPolicy { get; set; } + + /// Specifies the dynamic sizing configuration. + internal StandbyContainerGroupPoolDynamicSizing DynamicSizing { get; set; } + + /// Indicates whether dynamic sizing is enabled for the standby pool. + public bool? DynamicSizingEnabled + { + get + { + return DynamicSizing is null ? default : DynamicSizing.Enabled; + } + set + { + if (DynamicSizing is null) + { + DynamicSizing = new StandbyContainerGroupPoolDynamicSizing(); + } + DynamicSizing.Enabled = value; + } + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.Serialization.cs index da4ef7ea1805..5a99a58ff8fa 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyContainerGroupPoolForecastValues : IUtf8JsonSerializable, IJsonModel + /// Displays the forecast information of the standby pool. + internal partial class StandbyContainerGroupPoolForecastValues : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter wr /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolForecastValues)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("instancesRequestedCount"u8); writer.WriteStartArray(); - foreach (var item in InstancesRequestedCount) + foreach (long item in InstancesRequestedCount) { writer.WriteNumberValue(item); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,35 +61,39 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolForecastValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolForecastValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolForecastValues JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolForecastValues)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolForecastValues(document.RootElement, options); } - internal static StandbyContainerGroupPoolForecastValues DeserializeStandbyContainerGroupPoolForecastValues(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolForecastValues DeserializeStandbyContainerGroupPoolForecastValues(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList instancesRequestedCount = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("instancesRequestedCount"u8)) + if (prop.NameEquals("instancesRequestedCount"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetInt64()); } @@ -98,17 +102,19 @@ internal static StandbyContainerGroupPoolForecastValues DeserializeStandbyContai } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolForecastValues(instancesRequestedCount, serializedAdditionalRawData); + return new StandbyContainerGroupPoolForecastValues(instancesRequestedCount, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -118,15 +124,20 @@ BinaryData IPersistableModel.Write(Mode } } - StandbyContainerGroupPoolForecastValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolForecastValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolForecastValues PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolForecastValues(document.RootElement, options); } default: @@ -134,6 +145,7 @@ StandbyContainerGroupPoolForecastValues IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.cs index edbd3fe950ef..74bbe60d3798 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolForecastValues.cs @@ -7,64 +7,29 @@ using System; using System.Collections.Generic; -using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Displays the forecast information of the standby pool. internal partial class StandbyContainerGroupPoolForecastValues { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// Displays the predicted count of instances to be requested from the standby pool. - internal StandbyContainerGroupPoolForecastValues(IEnumerable instancesRequestedCount) + internal StandbyContainerGroupPoolForecastValues() { - InstancesRequestedCount = instancesRequestedCount.ToList(); + InstancesRequestedCount = new ChangeTrackingList(); } /// Initializes a new instance of . /// Displays the predicted count of instances to be requested from the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolForecastValues(IReadOnlyList instancesRequestedCount, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolForecastValues(IReadOnlyList instancesRequestedCount, IDictionary additionalBinaryDataProperties) { InstancesRequestedCount = instancesRequestedCount; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolForecastValues() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Displays the predicted count of instances to be requested from the standby pool. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.Serialization.cs index d31c1aadbdb9..5dac6d17e319 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupPoolPatch : IUtf8JsonSerializable, IJsonModel + /// The type used for update operations of the StandbyContainerGroupPoolResource. + public partial class StandbyContainerGroupPoolPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolPatch(document.RootElement, options); } - internal static StandbyContainerGroupPoolPatch DeserializeStandbyContainerGroupPoolPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolPatch DeserializeStandbyContainerGroupPoolPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; - StandbyContainerGroupPoolUpdateProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + StandbyContainerGroupPoolResourceUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyContainerGroupPoolUpdateProperties.DeserializeStandbyContainerGroupPoolUpdateProperties(property.Value, options); + properties = StandbyContainerGroupPoolResourceUpdateProperties.DeserializeStandbyContainerGroupPoolResourceUpdateProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new StandbyContainerGroupPoolPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - StandbyContainerGroupPoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ StandbyContainerGroupPoolPatch IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(StandbyContainerGroupPoolPatch standbyContainerGroupPoolPatch) + { + if (standbyContainerGroupPoolPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(standbyContainerGroupPoolPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.cs index 0312cd541a11..9f909020daef 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The type used for update operations of the StandbyContainerGroupPoolResource. public partial class StandbyContainerGroupPoolPatch { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public StandbyContainerGroupPoolPatch() @@ -54,17 +26,18 @@ public StandbyContainerGroupPoolPatch() /// Initializes a new instance of . /// Resource tags. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolPatch(IDictionary tags, StandbyContainerGroupPoolUpdateProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolPatch(IDictionary tags, StandbyContainerGroupPoolResourceUpdateProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Resource tags. public IDictionary Tags { get; } + /// The resource-specific properties for this resource. - public StandbyContainerGroupPoolUpdateProperties Properties { get; set; } + public StandbyContainerGroupPoolResourceUpdateProperties Properties { get; set; } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.Serialization.cs index 74090f8b4dbf..521b0202c92a 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupPoolPrediction : IUtf8JsonSerializable, IJsonModel + /// Displays prediction information of the standby pool. + public partial class StandbyContainerGroupPoolPrediction : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolPrediction)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("forecastValues"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("forecastInfo"u8); writer.WriteStringValue(ForecastInfo); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,61 +66,67 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolPrediction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolPrediction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolPrediction JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolPrediction)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolPrediction(document.RootElement, options); } - internal static StandbyContainerGroupPoolPrediction DeserializeStandbyContainerGroupPoolPrediction(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolPrediction DeserializeStandbyContainerGroupPoolPrediction(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } StandbyContainerGroupPoolForecastValues forecastValues = default; - DateTimeOffset forecastStartTime = default; + DateTimeOffset forecastStartOn = default; string forecastInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("forecastValues"u8)) + if (prop.NameEquals("forecastValues"u8)) { - forecastValues = StandbyContainerGroupPoolForecastValues.DeserializeStandbyContainerGroupPoolForecastValues(property.Value, options); + forecastValues = StandbyContainerGroupPoolForecastValues.DeserializeStandbyContainerGroupPoolForecastValues(prop.Value, options); continue; } - if (property.NameEquals("forecastStartTime"u8)) + if (prop.NameEquals("forecastStartTime"u8)) { - forecastStartTime = property.Value.GetDateTimeOffset("O"); + forecastStartOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("forecastInfo"u8)) + if (prop.NameEquals("forecastInfo"u8)) { - forecastInfo = property.Value.GetString(); + forecastInfo = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolPrediction(forecastValues, forecastStartTime, forecastInfo, serializedAdditionalRawData); + return new StandbyContainerGroupPoolPrediction(forecastValues, forecastStartOn, forecastInfo, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +136,20 @@ BinaryData IPersistableModel.Write(ModelRea } } - StandbyContainerGroupPoolPrediction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolPrediction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolPrediction PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolPrediction(document.RootElement, options); } default: @@ -146,6 +157,7 @@ StandbyContainerGroupPoolPrediction IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.cs index 61aa83a84254..adb1b91b3682 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolPrediction.cs @@ -13,78 +13,47 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays prediction information of the standby pool. public partial class StandbyContainerGroupPoolPrediction { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// Displays the forecast information of the standby pool. - /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. - /// Displays additional information for the prediction of the standby pool. - internal StandbyContainerGroupPoolPrediction(StandbyContainerGroupPoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo) + internal StandbyContainerGroupPoolPrediction() { - ForecastValues = forecastValues; - ForecastStartOn = forecastStartOn; - ForecastInfo = forecastInfo; } /// Initializes a new instance of . /// Displays the forecast information of the standby pool. /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. /// Displays additional information for the prediction of the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolPrediction(StandbyContainerGroupPoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolPrediction(StandbyContainerGroupPoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo, IDictionary additionalBinaryDataProperties) { ForecastValues = forecastValues; ForecastStartOn = forecastStartOn; ForecastInfo = forecastInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolPrediction() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Displays the forecast information of the standby pool. internal StandbyContainerGroupPoolForecastValues ForecastValues { get; } - /// Displays the predicted count of instances to be requested from the standby pool. - public IReadOnlyList ForecastValuesInstancesRequestedCount - { - get => ForecastValues?.InstancesRequestedCount; - } /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. public DateTimeOffset ForecastStartOn { get; } + /// Displays additional information for the prediction of the standby pool. public string ForecastInfo { get; } + + /// Displays the predicted count of instances to be requested from the standby pool. + public IReadOnlyList ForecastValuesInstancesRequestedCount + { + get + { + if (ForecastValues is null) + { + ForecastValues = new StandbyContainerGroupPoolForecastValues(); + } + return ForecastValues.InstancesRequestedCount; + } + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.Serialization.cs index 3b37299b8464..7200736d5caf 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupPoolProperties : IUtf8JsonSerializable, IJsonModel + /// Details of the StandbyContainerGroupPool. + public partial class StandbyContainerGroupPoolProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupPoolProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("elasticityProfile"u8); writer.WriteObjectValue(ElasticityProfile, options); writer.WritePropertyName("containerGroupProperties"u8); @@ -42,8 +47,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("zones"u8); writer.WriteStartArray(); - foreach (var item in Zones) + foreach (string item in Zones) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -53,15 +63,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -70,22 +80,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolProperties(document.RootElement, options); } - internal static StandbyContainerGroupPoolProperties DeserializeStandbyContainerGroupPoolProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolProperties DeserializeStandbyContainerGroupPoolProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -94,56 +109,64 @@ internal static StandbyContainerGroupPoolProperties DeserializeStandbyContainerG StandbyContainerGroupProperties containerGroupProperties = default; IList zones = default; StandbyProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("elasticityProfile"u8)) + if (prop.NameEquals("elasticityProfile"u8)) { - elasticityProfile = StandbyContainerGroupPoolElasticityProfile.DeserializeStandbyContainerGroupPoolElasticityProfile(property.Value, options); + elasticityProfile = StandbyContainerGroupPoolElasticityProfile.DeserializeStandbyContainerGroupPoolElasticityProfile(prop.Value, options); continue; } - if (property.NameEquals("containerGroupProperties"u8)) + if (prop.NameEquals("containerGroupProperties"u8)) { - containerGroupProperties = StandbyContainerGroupProperties.DeserializeStandbyContainerGroupProperties(property.Value, options); + containerGroupProperties = StandbyContainerGroupProperties.DeserializeStandbyContainerGroupProperties(prop.Value, options); continue; } - if (property.NameEquals("zones"u8)) + if (prop.NameEquals("zones"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } zones = array; continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new StandbyProvisioningState(property.Value.GetString()); + provisioningState = new StandbyProvisioningState(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolProperties(elasticityProfile, containerGroupProperties, zones ?? new ChangeTrackingList(), provisioningState, serializedAdditionalRawData); + return new StandbyContainerGroupPoolProperties(elasticityProfile, containerGroupProperties, zones ?? new ChangeTrackingList(), provisioningState, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -153,15 +176,20 @@ BinaryData IPersistableModel.Write(ModelRea } } - StandbyContainerGroupPoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolProperties(document.RootElement, options); } default: @@ -169,6 +197,7 @@ StandbyContainerGroupPoolProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.cs index 888549487a56..828e950eb27c 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Details of the StandbyContainerGroupPool. public partial class StandbyContainerGroupPoolProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies elasticity profile of standby container group pools. @@ -64,27 +36,25 @@ public StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityPr /// Specifies container group properties of standby container group pools. /// Specifies zones of standby container group pools. /// The status of the last operation. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, IList zones, StandbyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, IList zones, StandbyProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) { ElasticityProfile = elasticityProfile; ContainerGroupProperties = containerGroupProperties; Zones = zones; ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies elasticity profile of standby container group pools. public StandbyContainerGroupPoolElasticityProfile ElasticityProfile { get; set; } + /// Specifies container group properties of standby container group pools. public StandbyContainerGroupProperties ContainerGroupProperties { get; set; } + /// Specifies zones of standby container group pools. public IList Zones { get; } + /// The status of the last operation. public StandbyProvisioningState? ProvisioningState { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.Serialization.cs index 2d5ad3ad5111..de2aab4bb07d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyContainerGroupPoolResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a StandbyContainerGroupPoolResource list operation. + internal partial class StandbyContainerGroupPoolResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupPoolResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWrite /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (StandbyContainerGroupPoolData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement, options); } - internal static StandbyContainerGroupPoolResourceListResult DeserializeStandbyContainerGroupPoolResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolResourceListResult DeserializeStandbyContainerGroupPoolResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolResourceListResult(value, nextLink, serializedAdditionalRawData); + return new StandbyContainerGroupPoolResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write( } } - StandbyContainerGroupPoolResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ StandbyContainerGroupPoolResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyContainerGroupPoolResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.cs index d6b096b9c827..207942dabeba 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The response of a StandbyContainerGroupPoolResource list operation. internal partial class StandbyContainerGroupPoolResourceListResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The StandbyContainerGroupPoolResource items on this page. - /// is null. internal StandbyContainerGroupPoolResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The StandbyContainerGroupPoolResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The StandbyContainerGroupPoolResource items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..fc774a83ccc8 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.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.Json; +using Azure.ResourceManager.StandbyPool; + +namespace Azure.ResourceManager.StandbyPool.Models +{ + /// The updatable properties of the StandbyContainerGroupPoolResource. + public partial class StandbyContainerGroupPoolResourceUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ElasticityProfile)) + { + writer.WritePropertyName("elasticityProfile"u8); + writer.WriteObjectValue(ElasticityProfile, options); + } + if (Optional.IsDefined(ContainerGroupProperties)) + { + writer.WritePropertyName("containerGroupProperties"u8); + writer.WriteObjectValue(ContainerGroupProperties, options); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolResourceUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolResourceUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStandbyContainerGroupPoolResourceUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolResourceUpdateProperties DeserializeStandbyContainerGroupPoolResourceUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StandbyContainerGroupPoolElasticityProfile elasticityProfile = default; + StandbyContainerGroupProperties containerGroupProperties = default; + IList zones = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("elasticityProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticityProfile = StandbyContainerGroupPoolElasticityProfile.DeserializeStandbyContainerGroupPoolElasticityProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("containerGroupProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerGroupProperties = StandbyContainerGroupProperties.DeserializeStandbyContainerGroupProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new StandbyContainerGroupPoolResourceUpdateProperties(elasticityProfile, containerGroupProperties, zones ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerStandbyPoolContext.Default); + default: + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolResourceUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolResourceUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeStandbyContainerGroupPoolResourceUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StandbyContainerGroupPoolResourceUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.cs new file mode 100644 index 000000000000..60af60e578b2 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolResourceUpdateProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.StandbyPool; + +namespace Azure.ResourceManager.StandbyPool.Models +{ + /// The updatable properties of the StandbyContainerGroupPoolResource. + public partial class StandbyContainerGroupPoolResourceUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public StandbyContainerGroupPoolResourceUpdateProperties() + { + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Specifies elasticity profile of standby container group pools. + /// Specifies container group properties of standby container group pools. + /// Specifies zones of standby container group pools. + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolResourceUpdateProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, IList zones, IDictionary additionalBinaryDataProperties) + { + ElasticityProfile = elasticityProfile; + ContainerGroupProperties = containerGroupProperties; + Zones = zones; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Specifies elasticity profile of standby container group pools. + public StandbyContainerGroupPoolElasticityProfile ElasticityProfile { get; set; } + + /// Specifies container group properties of standby container group pools. + public StandbyContainerGroupProperties ContainerGroupProperties { get; set; } + + /// Specifies zones of standby container group pools. + public IList Zones { get; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.Serialization.cs index ade2f8f45199..6ba1604b8abf 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupPoolRuntimeViewProperties : IUtf8JsonSerializable, IJsonModel + /// Contains information about a standby pool as last known by the StandbyPool resource provider. + public partial class StandbyContainerGroupPoolRuntimeViewProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +29,16 @@ void IJsonModel.Write(Utf8JsonWr /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewProperties)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("instanceCountSummary"u8); writer.WriteStartArray(); - foreach (var item in InstanceCountSummary) + foreach (ContainerGroupInstanceCountSummary item in InstanceCountSummary) { writer.WriteObjectValue(item, options); } @@ -59,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("prediction"u8); writer.WriteObjectValue(Prediction, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -76,22 +76,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolRuntimeViewProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolRuntimeViewProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolRuntimeViewProperties(document.RootElement, options); } - internal static StandbyContainerGroupPoolRuntimeViewProperties DeserializeStandbyContainerGroupPoolRuntimeViewProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolRuntimeViewProperties DeserializeStandbyContainerGroupPoolRuntimeViewProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -100,60 +105,61 @@ internal static StandbyContainerGroupPoolRuntimeViewProperties DeserializeStandb StandbyPoolStatus status = default; StandbyProvisioningState? provisioningState = default; StandbyContainerGroupPoolPrediction prediction = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("instanceCountSummary"u8)) + if (prop.NameEquals("instanceCountSummary"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ContainerGroupInstanceCountSummary.DeserializeContainerGroupInstanceCountSummary(item, options)); } instanceCountSummary = array; continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = StandbyPoolStatus.DeserializeStandbyPoolStatus(property.Value, options); + status = StandbyPoolStatus.DeserializeStandbyPoolStatus(prop.Value, options); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new StandbyProvisioningState(property.Value.GetString()); + provisioningState = new StandbyProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("prediction"u8)) + if (prop.NameEquals("prediction"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - prediction = StandbyContainerGroupPoolPrediction.DeserializeStandbyContainerGroupPoolPrediction(property.Value, options); + prediction = StandbyContainerGroupPoolPrediction.DeserializeStandbyContainerGroupPoolPrediction(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary, status, provisioningState, prediction, serializedAdditionalRawData); + return new StandbyContainerGroupPoolRuntimeViewProperties(instanceCountSummary, status, provisioningState, prediction, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -163,15 +169,20 @@ BinaryData IPersistableModel.Wri } } - StandbyContainerGroupPoolRuntimeViewProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolRuntimeViewProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolRuntimeViewProperties(document.RootElement, options); } default: @@ -179,6 +190,7 @@ StandbyContainerGroupPoolRuntimeViewProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.cs index 8b6b19d3b6dc..e6dd290ec0b6 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewProperties.cs @@ -7,50 +7,20 @@ using System; using System.Collections.Generic; -using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Contains information about a standby pool as last known by the StandbyPool resource provider. public partial class StandbyContainerGroupPoolRuntimeViewProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// A list containing the counts of container groups in each possible state, as known by the StandbyPool resource provider. - internal StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable instanceCountSummary) + internal StandbyContainerGroupPoolRuntimeViewProperties() { - InstanceCountSummary = instanceCountSummary.ToList(); + InstanceCountSummary = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -58,27 +28,25 @@ internal StandbyContainerGroupPoolRuntimeViewProperties(IEnumerable Display status of the standby pool. /// Displays the provisioning state of the standby pool. /// Displays prediction information of the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolRuntimeViewProperties(IReadOnlyList instanceCountSummary, StandbyPoolStatus status, StandbyProvisioningState? provisioningState, StandbyContainerGroupPoolPrediction prediction, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolRuntimeViewProperties(IReadOnlyList instanceCountSummary, StandbyPoolStatus status, StandbyProvisioningState? provisioningState, StandbyContainerGroupPoolPrediction prediction, IDictionary additionalBinaryDataProperties) { InstanceCountSummary = instanceCountSummary; Status = status; ProvisioningState = provisioningState; Prediction = prediction; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolRuntimeViewProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// A list containing the counts of container groups in each possible state, as known by the StandbyPool resource provider. public IReadOnlyList InstanceCountSummary { get; } + /// Display status of the standby pool. public StandbyPoolStatus Status { get; } + /// Displays the provisioning state of the standby pool. public StandbyProvisioningState? ProvisioningState { get; } + /// Displays prediction information of the standby pool. public StandbyContainerGroupPoolPrediction Prediction { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.Serialization.cs index 6fb38438f511..8707e8077d75 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyContainerGroupPoolRuntimeViewResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a StandbyContainerGroupPoolRuntimeViewResource list operation. + internal partial class StandbyContainerGroupPoolRuntimeViewResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupPoolRuntimeViewResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Ut /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (StandbyContainerGroupPoolRuntimeViewData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupPoolRuntimeViewResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolRuntimeViewResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement, options); } - internal static StandbyContainerGroupPoolRuntimeViewResourceListResult DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolRuntimeViewResourceListResult DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyContainerGroupPoolRuntimeViewData.DeserializeStandbyContainerGroupPoolRuntimeViewData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolRuntimeViewResourceListResult(value, nextLink, serializedAdditionalRawData); + return new StandbyContainerGroupPoolRuntimeViewResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupPoolRuntimeViewResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ StandbyContainerGroupPoolRuntimeViewResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyContainerGroupPoolRuntimeViewResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.cs index 96c4f2e76372..f7e5ef6eba38 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolRuntimeViewResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The response of a StandbyContainerGroupPoolRuntimeViewResource list operation. internal partial class StandbyContainerGroupPoolRuntimeViewResourceListResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The StandbyContainerGroupPoolRuntimeViewResource items on this page. - /// is null. internal StandbyContainerGroupPoolRuntimeViewResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The StandbyContainerGroupPoolRuntimeViewResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolRuntimeViewResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupPoolRuntimeViewResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolRuntimeViewResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The StandbyContainerGroupPoolRuntimeViewResource items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.Serialization.cs deleted file mode 100644 index 9c4647d0caf5..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.Serialization.cs +++ /dev/null @@ -1,173 +0,0 @@ -// 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.StandbyPool.Models -{ - public partial class StandbyContainerGroupPoolUpdateProperties : 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(StandbyContainerGroupPoolUpdateProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ElasticityProfile)) - { - writer.WritePropertyName("elasticityProfile"u8); - writer.WriteObjectValue(ElasticityProfile, options); - } - if (Optional.IsDefined(ContainerGroupProperties)) - { - writer.WritePropertyName("containerGroupProperties"u8); - writer.WriteObjectValue(ContainerGroupProperties, options); - } - if (Optional.IsCollectionDefined(Zones)) - { - writer.WritePropertyName("zones"u8); - writer.WriteStartArray(); - foreach (var item in Zones) - { - 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 - } - } - } - - StandbyContainerGroupPoolUpdateProperties 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(StandbyContainerGroupPoolUpdateProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStandbyContainerGroupPoolUpdateProperties(document.RootElement, options); - } - - internal static StandbyContainerGroupPoolUpdateProperties DeserializeStandbyContainerGroupPoolUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StandbyContainerGroupPoolElasticityProfile elasticityProfile = default; - StandbyContainerGroupProperties containerGroupProperties = default; - IList zones = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("elasticityProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - elasticityProfile = StandbyContainerGroupPoolElasticityProfile.DeserializeStandbyContainerGroupPoolElasticityProfile(property.Value, options); - continue; - } - if (property.NameEquals("containerGroupProperties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - containerGroupProperties = StandbyContainerGroupProperties.DeserializeStandbyContainerGroupProperties(property.Value, options); - continue; - } - if (property.NameEquals("zones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupPoolUpdateProperties(elasticityProfile, containerGroupProperties, zones ?? 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, AzureResourceManagerStandbyPoolContext.Default); - default: - throw new FormatException($"The model {nameof(StandbyContainerGroupPoolUpdateProperties)} does not support writing '{options.Format}' format."); - } - } - - StandbyContainerGroupPoolUpdateProperties 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 DeserializeStandbyContainerGroupPoolUpdateProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StandbyContainerGroupPoolUpdateProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.cs deleted file mode 100644 index fcc05df96580..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupPoolUpdateProperties.cs +++ /dev/null @@ -1,74 +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.StandbyPool.Models -{ - /// The updatable properties of the StandbyContainerGroupPoolResource. - public partial class StandbyContainerGroupPoolUpdateProperties - { - /// - /// 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 StandbyContainerGroupPoolUpdateProperties() - { - Zones = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Specifies elasticity profile of standby container group pools. - /// Specifies container group properties of standby container group pools. - /// Specifies zones of standby container group pools. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolUpdateProperties(StandbyContainerGroupPoolElasticityProfile elasticityProfile, StandbyContainerGroupProperties containerGroupProperties, IList zones, IDictionary serializedAdditionalRawData) - { - ElasticityProfile = elasticityProfile; - ContainerGroupProperties = containerGroupProperties; - Zones = zones; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Specifies elasticity profile of standby container group pools. - public StandbyContainerGroupPoolElasticityProfile ElasticityProfile { get; set; } - /// Specifies container group properties of standby container group pools. - public StandbyContainerGroupProperties ContainerGroupProperties { get; set; } - /// Specifies zones of standby container group pools. - public IList Zones { get; } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.Serialization.cs index e4f834fdc2b6..d785141c4371 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupProfile : IUtf8JsonSerializable, IJsonModel + /// Details of the ContainerGroupProfile. + public partial class StandbyContainerGroupProfile : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupProfile() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupProfile)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); writer.WriteStringValue(Id); if (Optional.IsDefined(Revision)) @@ -41,15 +47,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("revision"u8); writer.WriteNumberValue(Revision.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,59 +64,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupProfile)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupProfile(document.RootElement, options); } - internal static StandbyContainerGroupProfile DeserializeStandbyContainerGroupProfile(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupProfile DeserializeStandbyContainerGroupProfile(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; long? revision = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("revision"u8)) + if (prop.NameEquals("revision"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - revision = property.Value.GetInt64(); + revision = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupProfile(id, revision, serializedAdditionalRawData); + return new StandbyContainerGroupProfile(id, revision, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -120,15 +132,20 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - StandbyContainerGroupProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupProfile(document.RootElement, options); } default: @@ -136,6 +153,7 @@ StandbyContainerGroupProfile IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.cs index 33ce89c3c629..84c32a7e1ee5 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProfile.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Details of the ContainerGroupProfile. public partial class StandbyContainerGroupProfile { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies container group profile id of standby container groups. @@ -59,21 +31,17 @@ public StandbyContainerGroupProfile(ResourceIdentifier id) /// Initializes a new instance of . /// Specifies container group profile id of standby container groups. /// Specifies revision of container group profile. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupProfile(ResourceIdentifier id, long? revision, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupProfile(ResourceIdentifier id, long? revision, IDictionary additionalBinaryDataProperties) { Id = id; Revision = revision; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupProfile() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies container group profile id of standby container groups. public ResourceIdentifier Id { get; set; } + /// Specifies revision of container group profile. public long? Revision { get; set; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.Serialization.cs index bc19fe9d2bec..ccb7244a6963 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyContainerGroupProperties : IUtf8JsonSerializable, IJsonModel + /// Details of the ContainerGroupProperties. + public partial class StandbyContainerGroupProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,33 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("containerGroupProfile"u8); writer.WriteObjectValue(ContainerGroupProfile, options); if (Optional.IsCollectionDefined(SubnetIds)) { writer.WritePropertyName("subnetIds"u8); writer.WriteStartArray(); - foreach (var item in SubnetIds) + foreach (WritableSubResource item in SubnetIds) { - ((IJsonModel)item).Write(writer, options); + writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -65,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyContainerGroupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupProperties(document.RootElement, options); } - internal static StandbyContainerGroupProperties DeserializeStandbyContainerGroupProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupProperties DeserializeStandbyContainerGroupProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } StandbyContainerGroupProfile containerGroupProfile = default; IList subnetIds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("containerGroupProfile"u8)) + if (prop.NameEquals("containerGroupProfile"u8)) { - containerGroupProfile = StandbyContainerGroupProfile.DeserializeStandbyContainerGroupProfile(property.Value, options); + containerGroupProfile = StandbyContainerGroupProfile.DeserializeStandbyContainerGroupProfile(prop.Value, options); continue; } - if (property.NameEquals("subnetIds"u8)) + if (prop.NameEquals("subnetIds"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureResourceManagerStandbyPoolContext.Default)); + array.Add(WritableSubResource.DeserializeWritableSubResource(item, options)); } subnetIds = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyContainerGroupProperties(containerGroupProfile, subnetIds ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new StandbyContainerGroupProperties(containerGroupProfile, subnetIds ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -132,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - StandbyContainerGroupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyContainerGroupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupProperties(document.RootElement, options); } default: @@ -148,6 +163,7 @@ StandbyContainerGroupProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.cs index 265093a90f83..1213e9a37098 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyContainerGroupProperties.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Details of the ContainerGroupProperties. public partial class StandbyContainerGroupProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies container group profile of standby container groups. @@ -60,21 +32,17 @@ public StandbyContainerGroupProperties(StandbyContainerGroupProfile containerGro /// Initializes a new instance of . /// Specifies container group profile of standby container groups. /// Specifies subnet Ids for container group. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupProperties(StandbyContainerGroupProfile containerGroupProfile, IList subnetIds, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyContainerGroupProperties(StandbyContainerGroupProfile containerGroupProfile, IList subnetIds, IDictionary additionalBinaryDataProperties) { ContainerGroupProfile = containerGroupProfile; SubnetIds = subnetIds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies container group profile of standby container groups. public StandbyContainerGroupProfile ContainerGroupProfile { get; set; } + /// Specifies subnet Ids for container group. public IList SubnetIds { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolHealthStateCode.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolHealthStateCode.cs index e667c3fb7569..2a732936a2b7 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolHealthStateCode.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolHealthStateCode.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct StandbyPoolHealthStateCode : IEquatable { private readonly string _value; + /// StandbyPool is in healthy state. + private const string HealthyValue = "HealthState/healthy"; + /// StandbyPool is in degraded state. + private const string DegradedValue = "HealthState/degraded"; /// Initializes a new instance of . + /// The value. /// is null. public StandbyPoolHealthStateCode(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string HealthyValue = "HealthState/healthy"; - private const string DegradedValue = "HealthState/degraded"; + _value = value; + } /// StandbyPool is in healthy state. public static StandbyPoolHealthStateCode Healthy { get; } = new StandbyPoolHealthStateCode(HealthyValue); + /// StandbyPool is in degraded state. public static StandbyPoolHealthStateCode Degraded { get; } = new StandbyPoolHealthStateCode(DegradedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(StandbyPoolHealthStateCode left, StandbyPoolHealthStateCode right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(StandbyPoolHealthStateCode left, StandbyPoolHealthStateCode right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator StandbyPoolHealthStateCode(string value) => new StandbyPoolHealthStateCode(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator StandbyPoolHealthStateCode?(string value) => value == null ? null : new StandbyPoolHealthStateCode(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is StandbyPoolHealthStateCode other && Equals(other); - /// + + /// public bool Equals(StandbyPoolHealthStateCode 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.Serialization.cs index 72b881a46649..b195f647f00a 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyPoolStatus : IUtf8JsonSerializable, IJsonModel + /// Displays StandbyPool status. + public partial class StandbyPoolStatus : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyPoolStatus)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("code"u8); @@ -44,15 +44,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("message"u8); writer.WriteStringValue(Message); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,55 +61,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyPoolStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyPoolStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyPoolStatus JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyPoolStatus)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyPoolStatus(document.RootElement, options); } - internal static StandbyPoolStatus DeserializeStandbyPoolStatus(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyPoolStatus DeserializeStandbyPoolStatus(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } StandbyPoolHealthStateCode code = default; string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("code"u8)) + if (prop.NameEquals("code"u8)) { - code = new StandbyPoolHealthStateCode(property.Value.GetString()); + code = new StandbyPoolHealthStateCode(prop.Value.GetString()); continue; } - if (property.NameEquals("message"u8)) + if (prop.NameEquals("message"u8)) { - message = property.Value.GetString(); + message = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyPoolStatus(code, message, serializedAdditionalRawData); + return new StandbyPoolStatus(code, message, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -119,15 +125,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - StandbyPoolStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyPoolStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyPoolStatus PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyPoolStatus(document.RootElement, options); } default: @@ -135,6 +146,7 @@ StandbyPoolStatus IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.cs index 202e71818d4a..314b0fbe8912 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyPoolStatus.cs @@ -13,63 +13,28 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays StandbyPool status. public partial class StandbyPoolStatus { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// Displays the healthy state of the StandbyPool. - internal StandbyPoolStatus(StandbyPoolHealthStateCode code) + internal StandbyPoolStatus() { - Code = code; } /// Initializes a new instance of . /// Displays the healthy state of the StandbyPool. /// Displays the StandbyPool health state details. - /// Keeps track of any properties unknown to the library. - internal StandbyPoolStatus(StandbyPoolHealthStateCode code, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyPoolStatus(StandbyPoolHealthStateCode code, string message, IDictionary additionalBinaryDataProperties) { Code = code; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyPoolStatus() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Displays the healthy state of the StandbyPool. public StandbyPoolHealthStateCode Code { get; } + /// Displays the StandbyPool health state details. public string Message { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyProvisioningState.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyProvisioningState.cs index b869f47ca7bf..8a475a6d2eae 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyProvisioningState.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,44 +15,67 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct StandbyProvisioningState : IEquatable { private readonly string _value; + /// Resource has been created. + private const string SucceededValue = "Succeeded"; + /// Resource creation failed. + private const string FailedValue = "Failed"; + /// Resource creation was canceled. + private const string CanceledValue = "Canceled"; + /// Resource is being deleted. + private const string DeletingValue = "Deleting"; /// Initializes a new instance of . + /// The value. /// is null. public StandbyProvisioningState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string DeletingValue = "Deleting"; + _value = value; + } /// Resource has been created. public static StandbyProvisioningState Succeeded { get; } = new StandbyProvisioningState(SucceededValue); + /// Resource creation failed. public static StandbyProvisioningState Failed { get; } = new StandbyProvisioningState(FailedValue); + /// Resource creation was canceled. public static StandbyProvisioningState Canceled { get; } = new StandbyProvisioningState(CanceledValue); + /// Resource is being deleted. public static StandbyProvisioningState Deleting { get; } = new StandbyProvisioningState(DeletingValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(StandbyProvisioningState left, StandbyProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(StandbyProvisioningState left, StandbyProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator StandbyProvisioningState(string value) => new StandbyProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator StandbyProvisioningState?(string value) => value == null ? null : new StandbyProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is StandbyProvisioningState other && Equals(other); - /// + + /// public bool Equals(StandbyProvisioningState 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyRefillPolicy.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyRefillPolicy.cs index fbfba5e78176..a33fd8fa0314 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyRefillPolicy.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyRefillPolicy.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,35 +15,52 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct StandbyRefillPolicy : IEquatable { private readonly string _value; + /// A refill policy that standby pool is automatically refilled to maintain maxReadyCapacity. + private const string AlwaysValue = "always"; /// Initializes a new instance of . + /// The value. /// is null. public StandbyRefillPolicy(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AlwaysValue = "always"; + _value = value; + } /// A refill policy that standby pool is automatically refilled to maintain maxReadyCapacity. public static StandbyRefillPolicy Always { get; } = new StandbyRefillPolicy(AlwaysValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(StandbyRefillPolicy left, StandbyRefillPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(StandbyRefillPolicy left, StandbyRefillPolicy right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator StandbyRefillPolicy(string value) => new StandbyRefillPolicy(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator StandbyRefillPolicy?(string value) => value == null ? null : new StandbyRefillPolicy(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is StandbyRefillPolicy other && Equals(other); - /// + + /// public bool Equals(StandbyRefillPolicy 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs index b4fafa8c2451..23e6ec7616b0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachineInstanceCountSummary : IUtf8JsonSerializable, IJsonModel + /// Contains the counts of VMs in each power state in a given zone, fault domain, as known by the StandbyPool resource provider. Note: any resources in the Running state may still be installing extensions / not fully provisioned. + public partial class StandbyVirtualMachineInstanceCountSummary : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachineInstanceCountSummary() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,28 +34,32 @@ void IJsonModel.Write(Utf8JsonWriter /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineInstanceCountSummary)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Zone)) { writer.WritePropertyName("zone"u8); writer.WriteNumberValue(Zone.Value); } writer.WritePropertyName("instanceCountsByState"u8); - InstanceCountsByStateSerial(writer, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) + writer.WriteStartArray(); + foreach (PoolVirtualMachineStateCount item in StandbyVirtualMachineInstanceCountsByState) { - foreach (var item in _serializedAdditionalRawData) + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,64 +68,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachineInstanceCountSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachineInstanceCountSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineInstanceCountSummary JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineInstanceCountSummary)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachineInstanceCountSummary(document.RootElement, options); } - internal static StandbyVirtualMachineInstanceCountSummary DeserializeStandbyVirtualMachineInstanceCountSummary(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachineInstanceCountSummary DeserializeStandbyVirtualMachineInstanceCountSummary(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } long? zone = default; - IReadOnlyList instanceCountsByState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IReadOnlyList standbyVirtualMachineInstanceCountsByState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("zone"u8)) + if (prop.NameEquals("zone"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - zone = property.Value.GetInt64(); + zone = prop.Value.GetInt64(); continue; } - if (property.NameEquals("instanceCountsByState"u8)) + if (prop.NameEquals("instanceCountsByState"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(PoolVirtualMachineStateCount.DeserializePoolVirtualMachineStateCount(item, options)); } - instanceCountsByState = array; + standbyVirtualMachineInstanceCountsByState = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachineInstanceCountSummary(zone, instanceCountsByState, serializedAdditionalRawData); + return new StandbyVirtualMachineInstanceCountSummary(zone, standbyVirtualMachineInstanceCountsByState, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -125,15 +141,20 @@ BinaryData IPersistableModel.Write(Mo } } - StandbyVirtualMachineInstanceCountSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachineInstanceCountSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineInstanceCountSummary PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachineInstanceCountSummary(document.RootElement, options); } default: @@ -141,6 +162,7 @@ StandbyVirtualMachineInstanceCountSummary IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.cs index 3f850402fb0a..0e004a8dc922 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineInstanceCountSummary.cs @@ -14,66 +14,30 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Contains the counts of VMs in each power state in a given zone, fault domain, as known by the StandbyPool resource provider. Note: any resources in the Running state may still be installing extensions / not fully provisioned. public partial class StandbyVirtualMachineInstanceCountSummary { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The count of pooled virtual machines in each state for the given zone. - /// is null. internal StandbyVirtualMachineInstanceCountSummary(IEnumerable standbyVirtualMachineInstanceCountsByState) { - Argument.AssertNotNull(standbyVirtualMachineInstanceCountsByState, nameof(standbyVirtualMachineInstanceCountsByState)); - StandbyVirtualMachineInstanceCountsByState = standbyVirtualMachineInstanceCountsByState.ToList(); } /// Initializes a new instance of . /// The zone that the provided counts are in. It will not have a value if zones are not enabled on the attached VMSS. /// The count of pooled virtual machines in each state for the given zone. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachineInstanceCountSummary(long? zone, IReadOnlyList standbyVirtualMachineInstanceCountsByState, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachineInstanceCountSummary(long? zone, IReadOnlyList standbyVirtualMachineInstanceCountsByState, IDictionary additionalBinaryDataProperties) { Zone = zone; StandbyVirtualMachineInstanceCountsByState = standbyVirtualMachineInstanceCountsByState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachineInstanceCountSummary() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The zone that the provided counts are in. It will not have a value if zones are not enabled on the attached VMSS. public long? Zone { get; } + /// The count of pooled virtual machines in each state for the given zone. public IReadOnlyList StandbyVirtualMachineInstanceCountsByState { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.Serialization.cs index a6e47bd7abfa..aab6abc614a5 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachinePoolElasticityProfile : IUtf8JsonSerializable, IJsonModel + /// Details of the elasticity profile. + public partial class StandbyVirtualMachinePoolElasticityProfile : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachinePoolElasticityProfile() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolElasticityProfile)} does not support writing '{format}' format."); } - writer.WritePropertyName("maxReadyCapacity"u8); writer.WriteNumberValue(MaxReadyCapacity); if (Optional.IsDefined(MinReadyCapacity)) @@ -41,15 +46,25 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("minReadyCapacity"u8); writer.WriteNumberValue(MinReadyCapacity.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (Optional.IsDefined(PostProvisioningDelay)) + { + writer.WritePropertyName("postProvisioningDelay"u8); + writer.WriteStringValue(PostProvisioningDelay); + } + if (Optional.IsDefined(DynamicSizing)) + { + writer.WritePropertyName("dynamicSizing"u8); + writer.WriteObjectValue(DynamicSizing, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,59 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolElasticityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolElasticityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolElasticityProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolElasticityProfile)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolElasticityProfile(document.RootElement, options); } - internal static StandbyVirtualMachinePoolElasticityProfile DeserializeStandbyVirtualMachinePoolElasticityProfile(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolElasticityProfile DeserializeStandbyVirtualMachinePoolElasticityProfile(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } long maxReadyCapacity = default; long? minReadyCapacity = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string postProvisioningDelay = default; + StandbyContainerGroupPoolDynamicSizing dynamicSizing = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("maxReadyCapacity"u8)) + if (prop.NameEquals("maxReadyCapacity"u8)) { - maxReadyCapacity = property.Value.GetInt64(); + maxReadyCapacity = prop.Value.GetInt64(); continue; } - if (property.NameEquals("minReadyCapacity"u8)) + if (prop.NameEquals("minReadyCapacity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - minReadyCapacity = property.Value.GetInt64(); + minReadyCapacity = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("postProvisioningDelay"u8)) + { + postProvisioningDelay = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dynamicSizing"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicSizing = StandbyContainerGroupPoolDynamicSizing.DeserializeStandbyContainerGroupPoolDynamicSizing(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolElasticityProfile(maxReadyCapacity, minReadyCapacity, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolElasticityProfile(maxReadyCapacity, minReadyCapacity, postProvisioningDelay, dynamicSizing, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -120,15 +157,20 @@ BinaryData IPersistableModel.Write(M } } - StandbyVirtualMachinePoolElasticityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolElasticityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolElasticityProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolElasticityProfile(document.RootElement, options); } default: @@ -136,6 +178,7 @@ StandbyVirtualMachinePoolElasticityProfile IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.cs index 3b223ff3fb1f..04a895e48108 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolElasticityProfile.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Details of the elasticity profile. public partial class StandbyVirtualMachinePoolElasticityProfile { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies the maximum number of virtual machines in the standby virtual machine pool. @@ -55,22 +26,45 @@ public StandbyVirtualMachinePoolElasticityProfile(long maxReadyCapacity) /// Initializes a new instance of . /// Specifies the maximum number of virtual machines in the standby virtual machine pool. /// Specifies the desired minimum number of virtual machines in the standby virtual machine pool. MinReadyCapacity cannot exceed MaxReadyCapacity. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolElasticityProfile(long maxReadyCapacity, long? minReadyCapacity, IDictionary serializedAdditionalRawData) + /// Specifies the duration to wait after virtual machine provisioning before the virtual machine becomes available for use. The duration should be specified in ISO 8601 format (e.g., PT2S for 2 seconds). + /// Specifies the dynamic sizing configuration. + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolElasticityProfile(long maxReadyCapacity, long? minReadyCapacity, string postProvisioningDelay, StandbyContainerGroupPoolDynamicSizing dynamicSizing, IDictionary additionalBinaryDataProperties) { MaxReadyCapacity = maxReadyCapacity; MinReadyCapacity = minReadyCapacity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolElasticityProfile() - { + PostProvisioningDelay = postProvisioningDelay; + DynamicSizing = dynamicSizing; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies the maximum number of virtual machines in the standby virtual machine pool. public long MaxReadyCapacity { get; set; } + /// Specifies the desired minimum number of virtual machines in the standby virtual machine pool. MinReadyCapacity cannot exceed MaxReadyCapacity. public long? MinReadyCapacity { get; set; } + + /// Specifies the duration to wait after virtual machine provisioning before the virtual machine becomes available for use. The duration should be specified in ISO 8601 format (e.g., PT2S for 2 seconds). + public string PostProvisioningDelay { get; set; } + + /// Specifies the dynamic sizing configuration. + internal StandbyContainerGroupPoolDynamicSizing DynamicSizing { get; set; } + + /// Indicates whether dynamic sizing is enabled for the standby pool. + public bool? DynamicSizingEnabled + { + get + { + return DynamicSizing is null ? default : DynamicSizing.Enabled; + } + set + { + if (DynamicSizing is null) + { + DynamicSizing = new StandbyContainerGroupPoolDynamicSizing(); + } + DynamicSizing.Enabled = value; + } + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.Serialization.cs index 569a545d3fc7..230e2442de4a 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyVirtualMachinePoolForecastValues : IUtf8JsonSerializable, IJsonModel + /// Displays the forecast information of the standby pool. + internal partial class StandbyVirtualMachinePoolForecastValues : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter wr /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolForecastValues)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("instancesRequestedCount"u8); writer.WriteStartArray(); - foreach (var item in InstancesRequestedCount) + foreach (long item in InstancesRequestedCount) { writer.WriteNumberValue(item); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,35 +61,39 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolForecastValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolForecastValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolForecastValues JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolForecastValues)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolForecastValues(document.RootElement, options); } - internal static StandbyVirtualMachinePoolForecastValues DeserializeStandbyVirtualMachinePoolForecastValues(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolForecastValues DeserializeStandbyVirtualMachinePoolForecastValues(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList instancesRequestedCount = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("instancesRequestedCount"u8)) + if (prop.NameEquals("instancesRequestedCount"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetInt64()); } @@ -98,17 +102,19 @@ internal static StandbyVirtualMachinePoolForecastValues DeserializeStandbyVirtua } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolForecastValues(instancesRequestedCount, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolForecastValues(instancesRequestedCount, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -118,15 +124,20 @@ BinaryData IPersistableModel.Write(Mode } } - StandbyVirtualMachinePoolForecastValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolForecastValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolForecastValues PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolForecastValues(document.RootElement, options); } default: @@ -134,6 +145,7 @@ StandbyVirtualMachinePoolForecastValues IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.cs index 9fd875054aa4..6f59998a3ace 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolForecastValues.cs @@ -7,64 +7,29 @@ using System; using System.Collections.Generic; -using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Displays the forecast information of the standby pool. internal partial class StandbyVirtualMachinePoolForecastValues { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// Displays the predicted count of instances to be requested from the standby pool. - internal StandbyVirtualMachinePoolForecastValues(IEnumerable instancesRequestedCount) + internal StandbyVirtualMachinePoolForecastValues() { - InstancesRequestedCount = instancesRequestedCount.ToList(); + InstancesRequestedCount = new ChangeTrackingList(); } /// Initializes a new instance of . /// Displays the predicted count of instances to be requested from the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolForecastValues(IReadOnlyList instancesRequestedCount, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolForecastValues(IReadOnlyList instancesRequestedCount, IDictionary additionalBinaryDataProperties) { InstancesRequestedCount = instancesRequestedCount; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolForecastValues() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Displays the predicted count of instances to be requested from the standby pool. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.Serialization.cs index 9dba51ff2a7b..cf59171593b2 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachinePoolPatch : IUtf8JsonSerializable, IJsonModel + /// The type used for update operations of the StandbyVirtualMachinePoolResource. + public partial class StandbyVirtualMachinePoolPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolPatch(document.RootElement, options); } - internal static StandbyVirtualMachinePoolPatch DeserializeStandbyVirtualMachinePoolPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolPatch DeserializeStandbyVirtualMachinePoolPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; - StandbyVirtualMachinePoolUpdateProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + StandbyVirtualMachinePoolResourceUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyVirtualMachinePoolUpdateProperties.DeserializeStandbyVirtualMachinePoolUpdateProperties(property.Value, options); + properties = StandbyVirtualMachinePoolResourceUpdateProperties.DeserializeStandbyVirtualMachinePoolResourceUpdateProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - StandbyVirtualMachinePoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ StandbyVirtualMachinePoolPatch IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(StandbyVirtualMachinePoolPatch standbyVirtualMachinePoolPatch) + { + if (standbyVirtualMachinePoolPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(standbyVirtualMachinePoolPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.cs index 01b8d5e5c911..3d969582c13b 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The type used for update operations of the StandbyVirtualMachinePoolResource. public partial class StandbyVirtualMachinePoolPatch { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public StandbyVirtualMachinePoolPatch() @@ -54,17 +26,18 @@ public StandbyVirtualMachinePoolPatch() /// Initializes a new instance of . /// Resource tags. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolPatch(IDictionary tags, StandbyVirtualMachinePoolUpdateProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolPatch(IDictionary tags, StandbyVirtualMachinePoolResourceUpdateProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Resource tags. public IDictionary Tags { get; } + /// The resource-specific properties for this resource. - public StandbyVirtualMachinePoolUpdateProperties Properties { get; set; } + public StandbyVirtualMachinePoolResourceUpdateProperties Properties { get; set; } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.Serialization.cs index 64c7b20fa71d..7f3c741c0702 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachinePoolPrediction : IUtf8JsonSerializable, IJsonModel + /// Displays prediction information of the standby pool. + public partial class StandbyVirtualMachinePoolPrediction : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolPrediction)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("forecastValues"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("forecastInfo"u8); writer.WriteStringValue(ForecastInfo); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,61 +66,67 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolPrediction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolPrediction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolPrediction JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolPrediction)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolPrediction(document.RootElement, options); } - internal static StandbyVirtualMachinePoolPrediction DeserializeStandbyVirtualMachinePoolPrediction(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolPrediction DeserializeStandbyVirtualMachinePoolPrediction(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } StandbyVirtualMachinePoolForecastValues forecastValues = default; - DateTimeOffset forecastStartTime = default; + DateTimeOffset forecastStartOn = default; string forecastInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("forecastValues"u8)) + if (prop.NameEquals("forecastValues"u8)) { - forecastValues = StandbyVirtualMachinePoolForecastValues.DeserializeStandbyVirtualMachinePoolForecastValues(property.Value, options); + forecastValues = StandbyVirtualMachinePoolForecastValues.DeserializeStandbyVirtualMachinePoolForecastValues(prop.Value, options); continue; } - if (property.NameEquals("forecastStartTime"u8)) + if (prop.NameEquals("forecastStartTime"u8)) { - forecastStartTime = property.Value.GetDateTimeOffset("O"); + forecastStartOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("forecastInfo"u8)) + if (prop.NameEquals("forecastInfo"u8)) { - forecastInfo = property.Value.GetString(); + forecastInfo = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolPrediction(forecastValues, forecastStartTime, forecastInfo, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolPrediction(forecastValues, forecastStartOn, forecastInfo, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +136,20 @@ BinaryData IPersistableModel.Write(ModelRea } } - StandbyVirtualMachinePoolPrediction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolPrediction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolPrediction PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolPrediction(document.RootElement, options); } default: @@ -146,6 +157,7 @@ StandbyVirtualMachinePoolPrediction IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.cs index 204f72b4d3f7..182507b03e6d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolPrediction.cs @@ -13,78 +13,47 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Displays prediction information of the standby pool. public partial class StandbyVirtualMachinePoolPrediction { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// Displays the forecast information of the standby pool. - /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. - /// Displays additional information for the prediction of the standby pool. - internal StandbyVirtualMachinePoolPrediction(StandbyVirtualMachinePoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo) + internal StandbyVirtualMachinePoolPrediction() { - ForecastValues = forecastValues; - ForecastStartOn = forecastStartOn; - ForecastInfo = forecastInfo; } /// Initializes a new instance of . /// Displays the forecast information of the standby pool. /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. /// Displays additional information for the prediction of the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolPrediction(StandbyVirtualMachinePoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolPrediction(StandbyVirtualMachinePoolForecastValues forecastValues, DateTimeOffset forecastStartOn, string forecastInfo, IDictionary additionalBinaryDataProperties) { ForecastValues = forecastValues; ForecastStartOn = forecastStartOn; ForecastInfo = forecastInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolPrediction() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Displays the forecast information of the standby pool. internal StandbyVirtualMachinePoolForecastValues ForecastValues { get; } - /// Displays the predicted count of instances to be requested from the standby pool. - public IReadOnlyList ForecastValuesInstancesRequestedCount - { - get => ForecastValues?.InstancesRequestedCount; - } /// Displays the UTC timestamp of when the prediction was retrieved for the standby pool. public DateTimeOffset ForecastStartOn { get; } + /// Displays additional information for the prediction of the standby pool. public string ForecastInfo { get; } + + /// Displays the predicted count of instances to be requested from the standby pool. + public IReadOnlyList ForecastValuesInstancesRequestedCount + { + get + { + if (ForecastValues is null) + { + ForecastValues = new StandbyVirtualMachinePoolForecastValues(); + } + return ForecastValues.InstancesRequestedCount; + } + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.Serialization.cs index 5a01e62d13ec..043431b15d43 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachinePoolProperties : IUtf8JsonSerializable, IJsonModel + /// Details of the StandbyVirtualMachinePool. + public partial class StandbyVirtualMachinePoolProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachinePoolProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ElasticityProfile)) { writer.WritePropertyName("elasticityProfile"u8); @@ -51,15 +57,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -68,22 +74,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolProperties(document.RootElement, options); } - internal static StandbyVirtualMachinePoolProperties DeserializeStandbyVirtualMachinePoolProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolProperties DeserializeStandbyVirtualMachinePoolProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -92,55 +103,56 @@ internal static StandbyVirtualMachinePoolProperties DeserializeStandbyVirtualMac StandbyVirtualMachineState virtualMachineState = default; ResourceIdentifier attachedVirtualMachineScaleSetId = default; StandbyProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("elasticityProfile"u8)) + if (prop.NameEquals("elasticityProfile"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - elasticityProfile = StandbyVirtualMachinePoolElasticityProfile.DeserializeStandbyVirtualMachinePoolElasticityProfile(property.Value, options); + elasticityProfile = StandbyVirtualMachinePoolElasticityProfile.DeserializeStandbyVirtualMachinePoolElasticityProfile(prop.Value, options); continue; } - if (property.NameEquals("virtualMachineState"u8)) + if (prop.NameEquals("virtualMachineState"u8)) { - virtualMachineState = new StandbyVirtualMachineState(property.Value.GetString()); + virtualMachineState = new StandbyVirtualMachineState(prop.Value.GetString()); continue; } - if (property.NameEquals("attachedVirtualMachineScaleSetId"u8)) + if (prop.NameEquals("attachedVirtualMachineScaleSetId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - attachedVirtualMachineScaleSetId = new ResourceIdentifier(property.Value.GetString()); + attachedVirtualMachineScaleSetId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new StandbyProvisioningState(property.Value.GetString()); + provisioningState = new StandbyProvisioningState(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, provisioningState, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, provisioningState, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -150,15 +162,20 @@ BinaryData IPersistableModel.Write(ModelRea } } - StandbyVirtualMachinePoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolProperties(document.RootElement, options); } default: @@ -166,6 +183,7 @@ StandbyVirtualMachinePoolProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.cs index 05295d4df467..c4d683743872 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolProperties.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Details of the StandbyVirtualMachinePool. public partial class StandbyVirtualMachinePoolProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Specifies the desired state of virtual machines in the pool. @@ -58,27 +29,25 @@ public StandbyVirtualMachinePoolProperties(StandbyVirtualMachineState virtualMac /// Specifies the desired state of virtual machines in the pool. /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. /// The status of the last operation. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile, StandbyVirtualMachineState virtualMachineState, ResourceIdentifier attachedVirtualMachineScaleSetId, StandbyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile, StandbyVirtualMachineState virtualMachineState, ResourceIdentifier attachedVirtualMachineScaleSetId, StandbyProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) { ElasticityProfile = elasticityProfile; VirtualMachineState = virtualMachineState; AttachedVirtualMachineScaleSetId = attachedVirtualMachineScaleSetId; ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies the elasticity profile of the standby virtual machine pools. public StandbyVirtualMachinePoolElasticityProfile ElasticityProfile { get; set; } + /// Specifies the desired state of virtual machines in the pool. public StandbyVirtualMachineState VirtualMachineState { get; set; } + /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. public ResourceIdentifier AttachedVirtualMachineScaleSetId { get; set; } + /// The status of the last operation. public StandbyProvisioningState? ProvisioningState { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.Serialization.cs index 315ec783b2ad..df3913df9142 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyVirtualMachinePoolResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a StandbyVirtualMachinePoolResource list operation. + internal partial class StandbyVirtualMachinePoolResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachinePoolResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWrite /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (StandbyVirtualMachinePoolData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement, options); } - internal static StandbyVirtualMachinePoolResourceListResult DeserializeStandbyVirtualMachinePoolResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolResourceListResult DeserializeStandbyVirtualMachinePoolResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolResourceListResult(value, nextLink, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write( } } - StandbyVirtualMachinePoolResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ StandbyVirtualMachinePoolResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyVirtualMachinePoolResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.cs index 0f748661d46d..cdc5061267ba 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The response of a StandbyVirtualMachinePoolResource list operation. internal partial class StandbyVirtualMachinePoolResourceListResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The StandbyVirtualMachinePoolResource items on this page. - /// is null. internal StandbyVirtualMachinePoolResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The StandbyVirtualMachinePoolResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The StandbyVirtualMachinePoolResource items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..07ac6597983c --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.Serialization.cs @@ -0,0 +1,176 @@ +// 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; +using Azure.ResourceManager.StandbyPool; + +namespace Azure.ResourceManager.StandbyPool.Models +{ + /// The updatable properties of the StandbyVirtualMachinePoolResource. + public partial class StandbyVirtualMachinePoolResourceUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + 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) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ElasticityProfile)) + { + writer.WritePropertyName("elasticityProfile"u8); + writer.WriteObjectValue(ElasticityProfile, options); + } + if (Optional.IsDefined(VirtualMachineState)) + { + writer.WritePropertyName("virtualMachineState"u8); + writer.WriteStringValue(VirtualMachineState.Value.ToString()); + } + if (Optional.IsDefined(AttachedVirtualMachineScaleSetId)) + { + writer.WritePropertyName("attachedVirtualMachineScaleSetId"u8); + writer.WriteStringValue(AttachedVirtualMachineScaleSetId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolResourceUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolResourceUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStandbyVirtualMachinePoolResourceUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolResourceUpdateProperties DeserializeStandbyVirtualMachinePoolResourceUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StandbyVirtualMachinePoolElasticityProfile elasticityProfile = default; + StandbyVirtualMachineState? virtualMachineState = default; + ResourceIdentifier attachedVirtualMachineScaleSetId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("elasticityProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticityProfile = StandbyVirtualMachinePoolElasticityProfile.DeserializeStandbyVirtualMachinePoolElasticityProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("virtualMachineState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualMachineState = new StandbyVirtualMachineState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("attachedVirtualMachineScaleSetId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + attachedVirtualMachineScaleSetId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new StandbyVirtualMachinePoolResourceUpdateProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerStandbyPoolContext.Default); + default: + throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolResourceUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolResourceUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeStandbyVirtualMachinePoolResourceUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolResourceUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.cs new file mode 100644 index 000000000000..76fe972d2ec9 --- /dev/null +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolResourceUpdateProperties.cs @@ -0,0 +1,47 @@ +// 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.StandbyPool.Models +{ + /// The updatable properties of the StandbyVirtualMachinePoolResource. + public partial class StandbyVirtualMachinePoolResourceUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public StandbyVirtualMachinePoolResourceUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Specifies the elasticity profile of the standby virtual machine pools. + /// Specifies the desired state of virtual machines in the pool. + /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolResourceUpdateProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile, StandbyVirtualMachineState? virtualMachineState, ResourceIdentifier attachedVirtualMachineScaleSetId, IDictionary additionalBinaryDataProperties) + { + ElasticityProfile = elasticityProfile; + VirtualMachineState = virtualMachineState; + AttachedVirtualMachineScaleSetId = attachedVirtualMachineScaleSetId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Specifies the elasticity profile of the standby virtual machine pools. + public StandbyVirtualMachinePoolElasticityProfile ElasticityProfile { get; set; } + + /// Specifies the desired state of virtual machines in the pool. + public StandbyVirtualMachineState? VirtualMachineState { get; set; } + + /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. + public ResourceIdentifier AttachedVirtualMachineScaleSetId { get; set; } + } +} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.Serialization.cs index 6c31ac3285c4..bcb7234288ac 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachinePoolRuntimeViewProperties : IUtf8JsonSerializable, IJsonModel + /// Contains information about a standby pool as last known by the StandbyPool resource provider. + public partial class StandbyVirtualMachinePoolRuntimeViewProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +29,16 @@ void IJsonModel.Write(Utf8JsonWr /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewProperties)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("instanceCountSummary"u8); writer.WriteStartArray(); - foreach (var item in InstanceCountSummary) + foreach (StandbyVirtualMachineInstanceCountSummary item in InstanceCountSummary) { writer.WriteObjectValue(item, options); } @@ -59,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("prediction"u8); writer.WriteObjectValue(Prediction, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -76,22 +76,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolRuntimeViewProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolRuntimeViewProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(document.RootElement, options); } - internal static StandbyVirtualMachinePoolRuntimeViewProperties DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolRuntimeViewProperties DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -100,60 +105,61 @@ internal static StandbyVirtualMachinePoolRuntimeViewProperties DeserializeStandb StandbyPoolStatus status = default; StandbyProvisioningState? provisioningState = default; StandbyVirtualMachinePoolPrediction prediction = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("instanceCountSummary"u8)) + if (prop.NameEquals("instanceCountSummary"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyVirtualMachineInstanceCountSummary.DeserializeStandbyVirtualMachineInstanceCountSummary(item, options)); } instanceCountSummary = array; continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = StandbyPoolStatus.DeserializeStandbyPoolStatus(property.Value, options); + status = StandbyPoolStatus.DeserializeStandbyPoolStatus(prop.Value, options); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new StandbyProvisioningState(property.Value.GetString()); + provisioningState = new StandbyProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("prediction"u8)) + if (prop.NameEquals("prediction"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - prediction = StandbyVirtualMachinePoolPrediction.DeserializeStandbyVirtualMachinePoolPrediction(property.Value, options); + prediction = StandbyVirtualMachinePoolPrediction.DeserializeStandbyVirtualMachinePoolPrediction(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary, status, provisioningState, prediction, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolRuntimeViewProperties(instanceCountSummary, status, provisioningState, prediction, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -163,15 +169,20 @@ BinaryData IPersistableModel.Wri } } - StandbyVirtualMachinePoolRuntimeViewProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolRuntimeViewProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(document.RootElement, options); } default: @@ -179,6 +190,7 @@ StandbyVirtualMachinePoolRuntimeViewProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.cs index a3e90fedad8f..73c5f7cf58a5 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewProperties.cs @@ -7,50 +7,20 @@ using System; using System.Collections.Generic; -using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// Contains information about a standby pool as last known by the StandbyPool resource provider. public partial class StandbyVirtualMachinePoolRuntimeViewProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known by the StandbyPool resource provider. If zones are not enabled on the attached VMSS, the list will contain a single entry without zone values. Note: any resources in the Running state may still be installing extensions / not fully provisioned. - internal StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable instanceCountSummary) + internal StandbyVirtualMachinePoolRuntimeViewProperties() { - InstanceCountSummary = instanceCountSummary.ToList(); + InstanceCountSummary = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -58,27 +28,25 @@ internal StandbyVirtualMachinePoolRuntimeViewProperties(IEnumerable Display status of the standby pool. /// Displays the provisioning state of the standby pool. /// Displays prediction information of the standby pool. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolRuntimeViewProperties(IReadOnlyList instanceCountSummary, StandbyPoolStatus status, StandbyProvisioningState? provisioningState, StandbyVirtualMachinePoolPrediction prediction, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolRuntimeViewProperties(IReadOnlyList instanceCountSummary, StandbyPoolStatus status, StandbyProvisioningState? provisioningState, StandbyVirtualMachinePoolPrediction prediction, IDictionary additionalBinaryDataProperties) { InstanceCountSummary = instanceCountSummary; Status = status; ProvisioningState = provisioningState; Prediction = prediction; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolRuntimeViewProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known by the StandbyPool resource provider. If zones are not enabled on the attached VMSS, the list will contain a single entry without zone values. Note: any resources in the Running state may still be installing extensions / not fully provisioned. public IReadOnlyList InstanceCountSummary { get; } + /// Display status of the standby pool. public StandbyPoolStatus Status { get; } + /// Displays the provisioning state of the standby pool. public StandbyProvisioningState? ProvisioningState { get; } + /// Displays prediction information of the standby pool. public StandbyVirtualMachinePoolPrediction Prediction { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.Serialization.cs index cae3b4e2ea25..8435d0764b3a 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyVirtualMachinePoolRuntimeViewResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a StandbyVirtualMachinePoolRuntimeViewResource list operation. + internal partial class StandbyVirtualMachinePoolRuntimeViewResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachinePoolRuntimeViewResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Ut /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (StandbyVirtualMachinePoolRuntimeViewData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachinePoolRuntimeViewResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolRuntimeViewResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement, options); } - internal static StandbyVirtualMachinePoolRuntimeViewResourceListResult DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolRuntimeViewResourceListResult DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyVirtualMachinePoolRuntimeViewData.DeserializeStandbyVirtualMachinePoolRuntimeViewData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolRuntimeViewResourceListResult(value, nextLink, serializedAdditionalRawData); + return new StandbyVirtualMachinePoolRuntimeViewResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachinePoolRuntimeViewResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ StandbyVirtualMachinePoolRuntimeViewResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyVirtualMachinePoolRuntimeViewResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.cs index 21f73bc29370..5ce1dddba4d0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolRuntimeViewResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The response of a StandbyVirtualMachinePoolRuntimeViewResource list operation. internal partial class StandbyVirtualMachinePoolRuntimeViewResourceListResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The StandbyVirtualMachinePoolRuntimeViewResource items on this page. - /// is null. internal StandbyVirtualMachinePoolRuntimeViewResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The StandbyVirtualMachinePoolRuntimeViewResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolRuntimeViewResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachinePoolRuntimeViewResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolRuntimeViewResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The StandbyVirtualMachinePoolRuntimeViewResource items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.Serialization.cs deleted file mode 100644 index 157c814465f9..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.Serialization.cs +++ /dev/null @@ -1,163 +0,0 @@ -// 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.StandbyPool.Models -{ - public partial class StandbyVirtualMachinePoolUpdateProperties : 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(StandbyVirtualMachinePoolUpdateProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ElasticityProfile)) - { - writer.WritePropertyName("elasticityProfile"u8); - writer.WriteObjectValue(ElasticityProfile, options); - } - if (Optional.IsDefined(VirtualMachineState)) - { - writer.WritePropertyName("virtualMachineState"u8); - writer.WriteStringValue(VirtualMachineState.Value.ToString()); - } - if (Optional.IsDefined(AttachedVirtualMachineScaleSetId)) - { - writer.WritePropertyName("attachedVirtualMachineScaleSetId"u8); - writer.WriteStringValue(AttachedVirtualMachineScaleSetId); - } - 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 - } - } - } - - StandbyVirtualMachinePoolUpdateProperties 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(StandbyVirtualMachinePoolUpdateProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeStandbyVirtualMachinePoolUpdateProperties(document.RootElement, options); - } - - internal static StandbyVirtualMachinePoolUpdateProperties DeserializeStandbyVirtualMachinePoolUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StandbyVirtualMachinePoolElasticityProfile elasticityProfile = default; - StandbyVirtualMachineState? virtualMachineState = default; - ResourceIdentifier attachedVirtualMachineScaleSetId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("elasticityProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - elasticityProfile = StandbyVirtualMachinePoolElasticityProfile.DeserializeStandbyVirtualMachinePoolElasticityProfile(property.Value, options); - continue; - } - if (property.NameEquals("virtualMachineState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - virtualMachineState = new StandbyVirtualMachineState(property.Value.GetString()); - continue; - } - if (property.NameEquals("attachedVirtualMachineScaleSetId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - attachedVirtualMachineScaleSetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachinePoolUpdateProperties(elasticityProfile, virtualMachineState, attachedVirtualMachineScaleSetId, 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, AzureResourceManagerStandbyPoolContext.Default); - default: - throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolUpdateProperties)} does not support writing '{options.Format}' format."); - } - } - - StandbyVirtualMachinePoolUpdateProperties 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 DeserializeStandbyVirtualMachinePoolUpdateProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolUpdateProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.cs deleted file mode 100644 index 2fc67a9769f3..000000000000 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachinePoolUpdateProperties.cs +++ /dev/null @@ -1,74 +0,0 @@ -// 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.StandbyPool.Models -{ - /// The updatable properties of the StandbyVirtualMachinePoolResource. - public partial class StandbyVirtualMachinePoolUpdateProperties - { - /// - /// 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 StandbyVirtualMachinePoolUpdateProperties() - { - } - - /// Initializes a new instance of . - /// Specifies the elasticity profile of the standby virtual machine pools. - /// Specifies the desired state of virtual machines in the pool. - /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolUpdateProperties(StandbyVirtualMachinePoolElasticityProfile elasticityProfile, StandbyVirtualMachineState? virtualMachineState, ResourceIdentifier attachedVirtualMachineScaleSetId, IDictionary serializedAdditionalRawData) - { - ElasticityProfile = elasticityProfile; - VirtualMachineState = virtualMachineState; - AttachedVirtualMachineScaleSetId = attachedVirtualMachineScaleSetId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Specifies the elasticity profile of the standby virtual machine pools. - public StandbyVirtualMachinePoolElasticityProfile ElasticityProfile { get; set; } - /// Specifies the desired state of virtual machines in the pool. - public StandbyVirtualMachineState? VirtualMachineState { get; set; } - /// Specifies the fully qualified resource ID of a virtual machine scale set the pool is attached to. - public ResourceIdentifier AttachedVirtualMachineScaleSetId { get; set; } - } -} diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.Serialization.cs index 9eeca1c903de..80fb7d90228d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - public partial class StandbyVirtualMachineProperties : IUtf8JsonSerializable, IJsonModel + /// Details of the StandbyVirtualMachine. + public partial class StandbyVirtualMachineProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachineProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("virtualMachineResourceId"u8); writer.WriteStringValue(VirtualMachineResourceId); if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) @@ -41,15 +47,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -58,59 +64,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachineProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachineProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachineProperties(document.RootElement, options); } - internal static StandbyVirtualMachineProperties DeserializeStandbyVirtualMachineProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachineProperties DeserializeStandbyVirtualMachineProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier virtualMachineResourceId = default; StandbyProvisioningState? provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("virtualMachineResourceId"u8)) + if (prop.NameEquals("virtualMachineResourceId"u8)) { - virtualMachineResourceId = new ResourceIdentifier(property.Value.GetString()); + virtualMachineResourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new StandbyProvisioningState(property.Value.GetString()); + provisioningState = new StandbyProvisioningState(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachineProperties(virtualMachineResourceId, provisioningState, serializedAdditionalRawData); + return new StandbyVirtualMachineProperties(virtualMachineResourceId, provisioningState, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -120,15 +132,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - StandbyVirtualMachineProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachineProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachineProperties(document.RootElement, options); } default: @@ -136,6 +153,7 @@ StandbyVirtualMachineProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.cs index fc063ab05a50..41ce1d441f41 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineProperties.cs @@ -14,66 +14,30 @@ namespace Azure.ResourceManager.StandbyPool.Models /// Details of the StandbyVirtualMachine. public partial class StandbyVirtualMachineProperties { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Resource id of the virtual machine. - /// is null. internal StandbyVirtualMachineProperties(ResourceIdentifier virtualMachineResourceId) { - Argument.AssertNotNull(virtualMachineResourceId, nameof(virtualMachineResourceId)); - VirtualMachineResourceId = virtualMachineResourceId; } /// Initializes a new instance of . /// Resource id of the virtual machine. /// The status of the last operation. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachineProperties(ResourceIdentifier virtualMachineResourceId, StandbyProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachineProperties(ResourceIdentifier virtualMachineResourceId, StandbyProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) { VirtualMachineResourceId = virtualMachineResourceId; ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachineProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Resource id of the virtual machine. public ResourceIdentifier VirtualMachineResourceId { get; } + /// The status of the last operation. public StandbyProvisioningState? ProvisioningState { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.Serialization.cs index 96786717b818..f1cef71dcc36 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { - internal partial class StandbyVirtualMachineResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a StandbyVirtualMachineResource list operation. + internal partial class StandbyVirtualMachineResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachineResourceListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter wr /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (StandbyVirtualMachineData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - StandbyVirtualMachineResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachineResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineResourceListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachineResourceListResult(document.RootElement, options); } - internal static StandbyVirtualMachineResourceListResult DeserializeStandbyVirtualMachineResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachineResourceListResult DeserializeStandbyVirtualMachineResourceListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(StandbyVirtualMachineData.DeserializeStandbyVirtualMachineData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new StandbyVirtualMachineResourceListResult(value, nextLink, serializedAdditionalRawData); + return new StandbyVirtualMachineResourceListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write(Mode } } - StandbyVirtualMachineResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachineResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual StandbyVirtualMachineResourceListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachineResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ StandbyVirtualMachineResourceListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyVirtualMachineResourceListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachineResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.cs index ebf553beb8f9..7a1b69a4845f 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { /// The response of a StandbyVirtualMachineResource list operation. internal partial class StandbyVirtualMachineResourceListResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The StandbyVirtualMachineResource items on this page. - /// is null. internal StandbyVirtualMachineResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The StandbyVirtualMachineResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachineResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal StandbyVirtualMachineResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachineResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The StandbyVirtualMachineResource items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineState.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineState.cs index d38ecb04b1a7..110611fba74c 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineState.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/Models/StandbyVirtualMachineState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.StandbyPool; namespace Azure.ResourceManager.StandbyPool.Models { @@ -14,41 +15,62 @@ namespace Azure.ResourceManager.StandbyPool.Models public readonly partial struct StandbyVirtualMachineState : IEquatable { private readonly string _value; + /// The virtual machine is up and running. + private const string RunningValue = "Running"; + /// The virtual machine has released the lease on the underlying hardware and is powered off. + private const string DeallocatedValue = "Deallocated"; + /// The virtual machine has released the lease on the underlying hardware and is powered off. Memory contents of the VM are stored in the OS disk. When started again, applications and processes that were previously running in your VM resume from the state prior to hibernation. + private const string HibernatedValue = "Hibernated"; /// Initializes a new instance of . + /// The value. /// is null. public StandbyVirtualMachineState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string RunningValue = "Running"; - private const string DeallocatedValue = "Deallocated"; - private const string HibernatedValue = "Hibernated"; + _value = value; + } /// The virtual machine is up and running. public static StandbyVirtualMachineState Running { get; } = new StandbyVirtualMachineState(RunningValue); + /// The virtual machine has released the lease on the underlying hardware and is powered off. public static StandbyVirtualMachineState Deallocated { get; } = new StandbyVirtualMachineState(DeallocatedValue); + /// The virtual machine has released the lease on the underlying hardware and is powered off. Memory contents of the VM are stored in the OS disk. When started again, applications and processes that were previously running in your VM resume from the state prior to hibernation. public static StandbyVirtualMachineState Hibernated { get; } = new StandbyVirtualMachineState(HibernatedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(StandbyVirtualMachineState left, StandbyVirtualMachineState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(StandbyVirtualMachineState left, StandbyVirtualMachineState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator StandbyVirtualMachineState(string value) => new StandbyVirtualMachineState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator StandbyVirtualMachineState?(string value) => value == null ? null : new StandbyVirtualMachineState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is StandbyVirtualMachineState other && Equals(other); - /// + + /// public bool Equals(StandbyVirtualMachineState 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/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ProviderConstants.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ProviderConstants.cs index 738f1678d01c..9f74685cbeaf 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ProviderConstants.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.StandbyPool { - internal static class ProviderConstants + internal static partial class ProviderConstants { + /// Gets the DefaultProviderNamespace. public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolRuntimeViewsRestOperations.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolRuntimeViewsRestOperations.cs index 67ccf1140eab..968fad1d8142 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolRuntimeViewsRestOperations.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolRuntimeViewsRestOperations.cs @@ -6,61 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - internal partial class StandbyContainerGroupPoolRuntimeViewsRestOperations + internal partial class StandbyContainerGroupPoolRuntimeViews { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViewsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public StandbyContainerGroupPoolRuntimeViewsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViews for mocking. + protected StandbyContainerGroupPoolRuntimeViews() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, string runtimeView) + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViews. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal StandbyContainerGroupPoolRuntimeViews(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendPath("/runtimeViews/", false); - uri.AppendPath(runtimeView, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, string runtimeView) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, string runtimeView, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); @@ -68,254 +54,44 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/runtimeViews/", false); uri.AppendPath(runtimeView, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a StandbyContainerGroupPoolRuntimeViewResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// 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 standbyContainerGroupPoolName, string runtimeView, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByStandbyPoolRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, runtimeView); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolRuntimeViewData.DeserializeStandbyContainerGroupPoolRuntimeViewData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a StandbyContainerGroupPoolRuntimeViewResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// 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 standbyContainerGroupPoolName, string runtimeView, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, runtimeView); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolRuntimeViewData.DeserializeStandbyContainerGroupPoolRuntimeViewData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyPoolRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendPath("/runtimeViews", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByStandbyPoolRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - 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(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); uri.AppendPath(standbyContainerGroupPoolName, true); uri.AppendPath("/runtimeViews", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyPoolAsync(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByStandbyPoolRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateListByStandbyPoolRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolRuntimeViewResourceListResult.DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyPool(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateListByStandbyPoolRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolRuntimeViewResourceListResult.DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByStandbyPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource. - /// 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. - /// Name of the standby container group pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyPoolNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateListByStandbyPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolRuntimeViewResourceListResult.DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource. - /// 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. - /// Name of the standby container group pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyPoolNextPage(string nextLink, string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateListByStandbyPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolRuntimeViewResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolRuntimeViewResourceListResult.DeserializeStandbyContainerGroupPoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolsRestOperations.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolsRestOperations.cs index eb024e5673b2..a32a3dffe68c 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolsRestOperations.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyContainerGroupPoolsRestOperations.cs @@ -6,725 +6,176 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - internal partial class StandbyContainerGroupPoolsRestOperations + internal partial class StandbyContainerGroupPools { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of StandbyContainerGroupPoolsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public StandbyContainerGroupPoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of StandbyContainerGroupPools for mocking. + protected StandbyContainerGroupPools() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// Get a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, CancellationToken cancellationToken = default) + /// Initializes a new instance of StandbyContainerGroupPools. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal StandbyContainerGroupPools(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyContainerGroupPoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Get a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyContainerGroupPoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, StandbyContainerGroupPoolData data) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); uri.AppendPath(standbyContainerGroupPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, StandbyContainerGroupPoolData data) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); uri.AppendPath(standbyContainerGroupPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; 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.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, StandbyContainerGroupPoolData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, 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 a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, StandbyContainerGroupPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); uri.AppendPath(standbyContainerGroupPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Delete a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, StandbyContainerGroupPoolPatch 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.StandbyPool/standbyContainerGroupPools/", false); - uri.AppendPath(standbyContainerGroupPoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, StandbyContainerGroupPoolPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools/", false); uri.AppendPath(standbyContainerGroupPoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; 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.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Update a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, StandbyContainerGroupPoolPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a StandbyContainerGroupPoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby container group pool. - /// 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 standbyContainerGroupPoolName, StandbyContainerGroupPoolPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, standbyContainerGroupPoolName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyContainerGroupPools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - 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(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyContainerGroupPoolResource resources by 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 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolResource resources by 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 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, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyContainerGroupPools", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List StandbyContainerGroupPoolResource resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolResource resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) - { - 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); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyContainerGroupPoolResource resources by resource group. - /// 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 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolResource resources by resource group. - /// 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 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, 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); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List StandbyContainerGroupPoolResource resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyContainerGroupPoolResource resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyContainerGroupPoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyContainerGroupPoolResourceListResult.DeserializeStandbyContainerGroupPoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolRuntimeViewsRestOperations.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolRuntimeViewsRestOperations.cs index 22107576bf1c..78b60f431af0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolRuntimeViewsRestOperations.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolRuntimeViewsRestOperations.cs @@ -6,61 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - internal partial class StandbyVirtualMachinePoolRuntimeViewsRestOperations + internal partial class StandbyVirtualMachinePoolRuntimeViews { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViewsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public StandbyVirtualMachinePoolRuntimeViewsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViews for mocking. + protected StandbyVirtualMachinePoolRuntimeViews() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string runtimeView) + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViews. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal StandbyVirtualMachinePoolRuntimeViews(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendPath("/runtimeViews/", false); - uri.AppendPath(runtimeView, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string runtimeView) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string runtimeView, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); @@ -68,254 +54,44 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/runtimeViews/", false); uri.AppendPath(runtimeView, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a StandbyVirtualMachinePoolRuntimeViewResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// 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 standbyVirtualMachinePoolName, string runtimeView, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByStandbyPoolRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, runtimeView); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolRuntimeViewData.DeserializeStandbyVirtualMachinePoolRuntimeViewData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a StandbyVirtualMachinePoolRuntimeViewResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// 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 standbyVirtualMachinePoolName, string runtimeView, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, runtimeView); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolRuntimeViewData.DeserializeStandbyVirtualMachinePoolRuntimeViewData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyPoolRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendPath("/runtimeViews", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByStandbyPoolRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - 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(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendPath("/runtimeViews", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyPoolAsync(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByStandbyPoolRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyPoolRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolRuntimeViewResourceListResult.DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyPool(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyPoolRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolRuntimeViewResourceListResult.DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyPoolNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByStandbyPoolNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource. - /// 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. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyPoolNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolRuntimeViewResourceListResult.DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource. - /// 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. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyPoolNextPage(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyPoolNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolRuntimeViewResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolRuntimeViewResourceListResult.DeserializeStandbyVirtualMachinePoolRuntimeViewResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolsRestOperations.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolsRestOperations.cs index 3be879500901..d36676474518 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolsRestOperations.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinePoolsRestOperations.cs @@ -6,725 +6,176 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - internal partial class StandbyVirtualMachinePoolsRestOperations + internal partial class StandbyVirtualMachinePools { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of StandbyVirtualMachinePoolsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public StandbyVirtualMachinePoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of StandbyVirtualMachinePools for mocking. + protected StandbyVirtualMachinePools() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// Get a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) + /// Initializes a new instance of StandbyVirtualMachinePools. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal StandbyVirtualMachinePools(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachinePoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Get a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachinePoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; 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.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, 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 a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Delete a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolPatch 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; 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.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Update a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, StandbyVirtualMachinePoolPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// 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 standbyVirtualMachinePoolName, StandbyVirtualMachinePoolPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyVirtualMachinePools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - 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(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyVirtualMachinePoolResource resources by 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 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolResource resources by 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 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, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List StandbyVirtualMachinePoolResource resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolResource resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) - { - 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); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyVirtualMachinePoolResource resources by resource group. - /// 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 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolResource resources by resource group. - /// 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 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, 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); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List StandbyVirtualMachinePoolResource resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachinePoolResource resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// 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) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachinePoolResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachinePoolResourceListResult.DeserializeStandbyVirtualMachinePoolResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinesRestOperations.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinesRestOperations.cs index c648606c2427..db226e050f6f 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinesRestOperations.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/RestOperations/StandbyVirtualMachinesRestOperations.cs @@ -6,61 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - internal partial class StandbyVirtualMachinesRestOperations + internal partial class StandbyVirtualMachines { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of StandbyVirtualMachinesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public StandbyVirtualMachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of StandbyVirtualMachines for mocking. + protected StandbyVirtualMachines() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-03-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string standbyVirtualMachineName) + /// Initializes a new instance of StandbyVirtualMachines. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal StandbyVirtualMachines(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendPath("/standbyVirtualMachines/", false); - uri.AppendPath(standbyVirtualMachineName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string standbyVirtualMachineName) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string standbyVirtualMachineName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); @@ -68,254 +54,44 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/standbyVirtualMachines/", false); uri.AppendPath(standbyVirtualMachineName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a StandbyVirtualMachineResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// Name of the standby virtual machine. - /// 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 standbyVirtualMachinePoolName, string standbyVirtualMachineName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByStandbyVirtualMachinePoolResourceRequest(Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, standbyVirtualMachineName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachineData.DeserializeStandbyVirtualMachineData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachineData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a StandbyVirtualMachineResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// Name of the standby virtual machine. - /// 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 standbyVirtualMachinePoolName, string standbyVirtualMachineName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName, standbyVirtualMachineName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachineData.DeserializeStandbyVirtualMachineData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((StandbyVirtualMachineData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyVirtualMachinePoolResourceRequestUri(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.StandbyPool/standbyVirtualMachinePools/", false); - uri.AppendPath(standbyVirtualMachinePoolName, true); - uri.AppendPath("/standbyVirtualMachines", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByStandbyVirtualMachinePoolResourceRequest(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - 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(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/", false); uri.AppendPath(standbyVirtualMachinePoolName, true); uri.AppendPath("/standbyVirtualMachines", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyVirtualMachinePoolResourceAsync(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByStandbyVirtualMachinePoolResourceRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyVirtualMachinePoolResourceRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachineResourceListResult.DeserializeStandbyVirtualMachineResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyVirtualMachinePoolResource(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyVirtualMachinePoolResourceRequest(subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachineResourceListResult.DeserializeStandbyVirtualMachineResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByStandbyVirtualMachinePoolResourceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByStandbyVirtualMachinePoolResourceNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource. - /// 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. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByStandbyVirtualMachinePoolResourceNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyVirtualMachinePoolResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StandbyVirtualMachineResourceListResult.DeserializeStandbyVirtualMachineResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource. - /// 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. - /// Name of the standby virtual machine pool. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByStandbyVirtualMachinePoolResourceNextPage(string nextLink, string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - - using var message = CreateListByStandbyVirtualMachinePoolResourceNextPageRequest(nextLink, subscriptionId, resourceGroupName, standbyVirtualMachinePoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - StandbyVirtualMachineResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StandbyVirtualMachineResourceListResult.DeserializeStandbyVirtualMachineResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolCollection.cs index 618fa91f123b..65c482c86e60 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.StandbyPool @@ -25,51 +26,49 @@ namespace Azure.ResourceManager.StandbyPool /// public partial class StandbyContainerGroupPoolCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _standbyContainerGroupPoolClientDiagnostics; - private readonly StandbyContainerGroupPoolsRestOperations _standbyContainerGroupPoolRestClient; + private readonly ClientDiagnostics _standbyContainerGroupPoolsClientDiagnostics; + private readonly StandbyContainerGroupPools _standbyContainerGroupPoolsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyContainerGroupPoolCollection for mocking. protected StandbyContainerGroupPoolCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal StandbyContainerGroupPoolCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyContainerGroupPoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyContainerGroupPoolResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(StandbyContainerGroupPoolResource.ResourceType, out string standbyContainerGroupPoolApiVersion); - _standbyContainerGroupPoolRestClient = new StandbyContainerGroupPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyContainerGroupPoolApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyContainerGroupPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyContainerGroupPoolResource.ResourceType.Namespace, Diagnostics); + _standbyContainerGroupPoolsRestClient = new StandbyContainerGroupPools(_standbyContainerGroupPoolsClientDiagnostics, Pipeline, Endpoint, standbyContainerGroupPoolApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -77,21 +76,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the standby container group pool. /// Resource create parameters. /// The cancellation token to use. - /// 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. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string standbyContainerGroupPoolName, StandbyContainerGroupPoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, data, cancellationToken).ConfigureAwait(false); - var operation = new StandbyPoolArmOperation(new StandbyContainerGroupPoolOperationSource(Client), _standbyContainerGroupPoolClientDiagnostics, Pipeline, _standbyContainerGroupPoolRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, StandbyContainerGroupPoolData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation( + new StandbyContainerGroupPoolOperationSource(Client), + _standbyContainerGroupPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +117,16 @@ public virtual async Task> Creat /// Create a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_CreateOrUpdate + /// Operation Id. + /// StandbyContainerGroupPools_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -126,21 +134,34 @@ public virtual async Task> Creat /// Name of the standby container group pool. /// Resource create parameters. /// The cancellation token to use. - /// 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. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string standbyContainerGroupPoolName, StandbyContainerGroupPoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, data, cancellationToken); - var operation = new StandbyPoolArmOperation(new StandbyContainerGroupPoolOperationSource(Client), _standbyContainerGroupPoolClientDiagnostics, Pipeline, _standbyContainerGroupPoolRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, StandbyContainerGroupPoolData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation( + new StandbyContainerGroupPoolOperationSource(Client), + _standbyContainerGroupPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +175,42 @@ public virtual ArmOperation CreateOrUpdate(Wa /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Get"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +224,42 @@ public virtual async Task> GetAsync( /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Get"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,50 +273,44 @@ public virtual Response Get(string standbyCon /// List StandbyContainerGroupPoolResource resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListByResourceGroup + /// Operation Id. + /// StandbyContainerGroupPools_ListByResourceGroup. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyContainerGroupPoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyContainerGroupPoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolResource(Client, StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(e)), _standbyContainerGroupPoolClientDiagnostics, Pipeline, "StandbyContainerGroupPoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyContainerGroupPoolsGetByResourceGroupAsyncCollectionResultOfT(_standbyContainerGroupPoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new StandbyContainerGroupPoolResource(Client, data)); } /// /// List StandbyContainerGroupPoolResource resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -295,45 +318,61 @@ public virtual AsyncPageable GetAllAsync(Canc /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyContainerGroupPoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyContainerGroupPoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolResource(Client, StandbyContainerGroupPoolData.DeserializeStandbyContainerGroupPoolData(e)), _standbyContainerGroupPoolClientDiagnostics, Pipeline, "StandbyContainerGroupPoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyContainerGroupPoolsGetByResourceGroupCollectionResultOfT(_standbyContainerGroupPoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new StandbyContainerGroupPoolResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Exists"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Exists"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -347,36 +386,50 @@ public virtual async Task> ExistsAsync(string standbyContainerGro /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Exists"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.Exists"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -390,38 +443,54 @@ public virtual Response Exists(string standbyContainerGroupPoolName, Cance /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetIfExists"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetIfExists"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -435,38 +504,54 @@ public virtual async Task> G /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby container group pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string standbyContainerGroupPoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyContainerGroupPoolName, nameof(standbyContainerGroupPoolName)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetIfExists"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolCollection.GetIfExists"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyContainerGroupPoolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyContainerGroupPoolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,6 +571,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.Serialization.cs index 946248444698..173d3d49ac0c 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - public partial class StandbyContainerGroupPoolData : IUtf8JsonSerializable, IJsonModel + /// A StandbyContainerGroupPoolResource. + public partial class StandbyContainerGroupPoolData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyContainerGroupPoolData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +38,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,110 +51,131 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - StandbyContainerGroupPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (StandbyContainerGroupPoolData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolData(document.RootElement, options); } - internal static StandbyContainerGroupPoolData DeserializeStandbyContainerGroupPoolData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolData DeserializeStandbyContainerGroupPoolData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - StandbyContainerGroupPoolProperties properties = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + StandbyContainerGroupPoolProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyContainerGroupPoolProperties.DeserializeStandbyContainerGroupPoolProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"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; + name = prop.Value.GetString(); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("type"u8)) { - location = new AzureLocation(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("systemData"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("tags"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); + properties = StandbyContainerGroupPoolProperties.DeserializeStandbyContainerGroupPoolProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new StandbyContainerGroupPoolData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - properties, - serializedAdditionalRawData); + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -158,15 +185,20 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - StandbyContainerGroupPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (StandbyContainerGroupPoolData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolData(document.RootElement, options); } default: @@ -174,6 +206,26 @@ StandbyContainerGroupPoolData IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(StandbyContainerGroupPoolData standbyContainerGroupPoolData) + { + if (standbyContainerGroupPoolData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(standbyContainerGroupPoolData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static StandbyContainerGroupPoolData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyContainerGroupPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.cs index e0534ea30ce0..77be8a788b1a 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolData.cs @@ -13,68 +13,31 @@ namespace Azure.ResourceManager.StandbyPool { - /// - /// A class representing the StandbyContainerGroupPool data model. - /// A StandbyContainerGroupPoolResource. - /// + /// A StandbyContainerGroupPoolResource. public partial class StandbyContainerGroupPoolData : TrackedResourceData { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. public StandbyContainerGroupPoolData(AzureLocation location) : base(location) { } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, StandbyContainerGroupPoolProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal StandbyContainerGroupPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, StandbyContainerGroupPoolProperties properties) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyContainerGroupPoolData() - { } /// The resource-specific properties for this resource. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.Serialization.cs index 3b5561867f92..36e6656ab782 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.StandbyPool { + /// public partial class StandbyContainerGroupPoolResource : IJsonModel { - private static StandbyContainerGroupPoolData s_dataDeserializationInstance; - private static StandbyContainerGroupPoolData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new StandbyContainerGroupPoolData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - StandbyContainerGroupPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + StandbyContainerGroupPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerStandbyPoolContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. StandbyContainerGroupPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerStandbyPoolContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.cs index 7923210b906b..97c26e6a81fc 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolResource.cs @@ -7,47 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { /// - /// A Class representing a StandbyContainerGroupPool 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 GetStandbyContainerGroupPoolResource method. - /// Otherwise you can get one from its parent resource using the GetStandbyContainerGroupPool method. + /// A class representing a StandbyContainerGroupPool 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetStandbyContainerGroupPools method. /// public partial class StandbyContainerGroupPoolResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The standbyContainerGroupPoolName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _standbyContainerGroupPoolClientDiagnostics; - private readonly StandbyContainerGroupPoolsRestOperations _standbyContainerGroupPoolRestClient; + private readonly ClientDiagnostics _standbyContainerGroupPoolsClientDiagnostics; + private readonly StandbyContainerGroupPools _standbyContainerGroupPoolsRestClient; private readonly StandbyContainerGroupPoolData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.StandbyPool/standbyContainerGroupPools"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyContainerGroupPoolResource for mocking. protected StandbyContainerGroupPoolResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal StandbyContainerGroupPoolResource(ArmClient client, StandbyContainerGroupPoolData data) : this(client, data.Id) @@ -56,140 +46,92 @@ internal StandbyContainerGroupPoolResource(ArmClient client, StandbyContainerGro _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal StandbyContainerGroupPoolResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyContainerGroupPoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string standbyContainerGroupPoolApiVersion); - _standbyContainerGroupPoolRestClient = new StandbyContainerGroupPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyContainerGroupPoolApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyContainerGroupPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); + _standbyContainerGroupPoolsRestClient = new StandbyContainerGroupPools(_standbyContainerGroupPoolsClientDiagnostics, Pipeline, Endpoint, standbyContainerGroupPoolApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } /// 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 StandbyContainerGroupPoolData 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)); - } - - /// Gets a collection of StandbyContainerGroupPoolRuntimeViewResources in the StandbyContainerGroupPool. - /// An object representing collection of StandbyContainerGroupPoolRuntimeViewResources and their operations over a StandbyContainerGroupPoolRuntimeViewResource. - public virtual StandbyContainerGroupPoolRuntimeViewCollection GetStandbyContainerGroupPoolRuntimeViews() - { - return GetCachedClient(client => new StandbyContainerGroupPoolRuntimeViewCollection(client, Id)); - } - - /// - /// Get a StandbyContainerGroupPoolRuntimeViewResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetStandbyContainerGroupPoolRuntimeViewAsync(string runtimeView, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The standbyContainerGroupPoolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName) { - return await GetStandbyContainerGroupPoolRuntimeViews().GetAsync(runtimeView, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get a StandbyContainerGroupPoolRuntimeViewResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetStandbyContainerGroupPoolRuntimeView(string runtimeView, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetStandbyContainerGroupPoolRuntimeViews().Get(runtimeView, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Get"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,33 +145,41 @@ public virtual async Task> GetAsync( /// Get a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get + /// Operation Id. + /// StandbyContainerGroupPools_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Get"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -243,20 +193,20 @@ public virtual Response Get(CancellationToken /// Delete a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Delete + /// Operation Id. + /// StandbyContainerGroupPools_Delete. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -264,14 +214,21 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Delete"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Delete"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new StandbyPoolArmOperation(_standbyContainerGroupPoolClientDiagnostics, Pipeline, _standbyContainerGroupPoolRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation(_standbyContainerGroupPoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -285,20 +242,20 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// Delete a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Delete + /// Operation Id. + /// StandbyContainerGroupPools_Delete. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -306,14 +263,21 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Delete"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Delete"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new StandbyPoolArmOperation(_standbyContainerGroupPoolClientDiagnostics, Pipeline, _standbyContainerGroupPoolRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation(_standbyContainerGroupPoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -327,20 +291,20 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Update a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Update + /// Operation Id. + /// StandbyContainerGroupPools_Update. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -351,11 +315,21 @@ public virtual async Task> UpdateAsy { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Update"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Update"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, StandbyContainerGroupPoolPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -369,20 +343,20 @@ public virtual async Task> UpdateAsy /// Update a StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Update + /// Operation Id. + /// StandbyContainerGroupPools_Update. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -393,11 +367,21 @@ public virtual Response Update(StandbyContain { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Update"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.Update"); scope.Start(); try { - var response = _standbyContainerGroupPoolRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, StandbyContainerGroupPoolPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -407,27 +391,7 @@ public virtual Response Update(StandbyContain } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -437,29 +401,35 @@ public virtual async Task> AddTagAsy Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.AddTag"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); - foreach (var tag in current.Tags) + StandbyContainerGroupPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -469,27 +439,7 @@ public virtual async Task> AddTagAsy } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -499,29 +449,35 @@ public virtual Response AddTag(string key, st Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.AddTag"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); - foreach (var tag in current.Tags) + StandbyContainerGroupPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -531,54 +487,40 @@ public virtual Response AddTag(string key, st } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// 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 = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.SetTags"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); + StandbyContainerGroupPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -588,54 +530,40 @@ public virtual async Task> SetTagsAs } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.SetTags"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); + StandbyContainerGroupPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -645,27 +573,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -673,29 +581,35 @@ public virtual async Task> RemoveTag { Argument.AssertNotNull(key, nameof(key)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.RemoveTag"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _standbyContainerGroupPoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); - foreach (var tag in current.Tags) + StandbyContainerGroupPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -705,27 +619,7 @@ public virtual async Task> RemoveTag } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -733,29 +627,35 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _standbyContainerGroupPoolClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.RemoveTag"); + using DiagnosticScope scope = _standbyContainerGroupPoolsClientDiagnostics.CreateScope("StandbyContainerGroupPoolResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyContainerGroupPoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyContainerGroupPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolData.FromResponse(result), result); + return Response.FromValue(new StandbyContainerGroupPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyContainerGroupPoolPatch(); - foreach (var tag in current.Tags) + StandbyContainerGroupPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -764,5 +664,38 @@ public virtual Response RemoveTag(string key, throw; } } + + /// Gets a collection of StandbyContainerGroupPoolRuntimeViews in the . + /// An object representing collection of StandbyContainerGroupPoolRuntimeViews and their operations over a StandbyContainerGroupPoolRuntimeViewResource. + public virtual StandbyContainerGroupPoolRuntimeViewCollection GetStandbyContainerGroupPoolRuntimeViews() + { + return GetCachedClient(client => new StandbyContainerGroupPoolRuntimeViewCollection(client, Id)); + } + + /// Get a StandbyContainerGroupPoolRuntimeViewResource. + /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStandbyContainerGroupPoolRuntimeViewAsync(string runtimeView, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); + + return await GetStandbyContainerGroupPoolRuntimeViews().GetAsync(runtimeView, cancellationToken).ConfigureAwait(false); + } + + /// Get a StandbyContainerGroupPoolRuntimeViewResource. + /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStandbyContainerGroupPoolRuntimeView(string runtimeView, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); + + return GetStandbyContainerGroupPoolRuntimeViews().Get(runtimeView, cancellationToken); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewCollection.cs index 9aee5aa6249d..960184fdb194 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { @@ -24,69 +25,75 @@ namespace Azure.ResourceManager.StandbyPool /// public partial class StandbyContainerGroupPoolRuntimeViewCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _standbyContainerGroupPoolRuntimeViewClientDiagnostics; - private readonly StandbyContainerGroupPoolRuntimeViewsRestOperations _standbyContainerGroupPoolRuntimeViewRestClient; + private readonly ClientDiagnostics _standbyContainerGroupPoolRuntimeViewsClientDiagnostics; + private readonly StandbyContainerGroupPoolRuntimeViews _standbyContainerGroupPoolRuntimeViewsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViewCollection for mocking. protected StandbyContainerGroupPoolRuntimeViewCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal StandbyContainerGroupPoolRuntimeViewCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyContainerGroupPoolRuntimeViewClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyContainerGroupPoolRuntimeViewResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(StandbyContainerGroupPoolRuntimeViewResource.ResourceType, out string standbyContainerGroupPoolRuntimeViewApiVersion); - _standbyContainerGroupPoolRuntimeViewRestClient = new StandbyContainerGroupPoolRuntimeViewsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyContainerGroupPoolRuntimeViewApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyContainerGroupPoolRuntimeViewsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyContainerGroupPoolRuntimeViewResource.ResourceType.Namespace, Diagnostics); + _standbyContainerGroupPoolRuntimeViewsRestClient = new StandbyContainerGroupPoolRuntimeViews(_standbyContainerGroupPoolRuntimeViewsClientDiagnostics, Pipeline, Endpoint, standbyContainerGroupPoolRuntimeViewApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != StandbyContainerGroupPoolResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, StandbyContainerGroupPoolResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, StandbyContainerGroupPoolResource.ResourceType), id); + } } /// /// Get a StandbyContainerGroupPoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Get"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -100,38 +107,42 @@ public virtual async Task /// Get a StandbyContainerGroupPoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Get"); scope.Start(); try { - var response = _standbyContainerGroupPoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -145,50 +156,44 @@ public virtual Response Get(string /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_ListByStandbyPool + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyContainerGroupPoolRuntimeViewRestClient.CreateListByStandbyPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyContainerGroupPoolRuntimeViewRestClient.CreateListByStandbyPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolRuntimeViewResource(Client, StandbyContainerGroupPoolRuntimeViewData.DeserializeStandbyContainerGroupPoolRuntimeViewData(e)), _standbyContainerGroupPoolRuntimeViewClientDiagnostics, Pipeline, "StandbyContainerGroupPoolRuntimeViewCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT(_standbyContainerGroupPoolRuntimeViewsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyContainerGroupPoolRuntimeViewResource(Client, data)); } /// /// List StandbyContainerGroupPoolRuntimeViewResource resources by StandbyContainerGroupPoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_ListByStandbyPool + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -196,45 +201,61 @@ public virtual AsyncPageable GetAl /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyContainerGroupPoolRuntimeViewRestClient.CreateListByStandbyPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyContainerGroupPoolRuntimeViewRestClient.CreateListByStandbyPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyContainerGroupPoolRuntimeViewResource(Client, StandbyContainerGroupPoolRuntimeViewData.DeserializeStandbyContainerGroupPoolRuntimeViewData(e)), _standbyContainerGroupPoolRuntimeViewClientDiagnostics, Pipeline, "StandbyContainerGroupPoolRuntimeViewCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyContainerGroupPoolRuntimeViewsGetByStandbyPoolCollectionResultOfT(_standbyContainerGroupPoolRuntimeViewsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyContainerGroupPoolRuntimeViewResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Exists"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Exists"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -248,36 +269,50 @@ public virtual async Task> ExistsAsync(string runtimeView, Cancel /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Exists"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.Exists"); scope.Start(); try { - var response = _standbyContainerGroupPoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -291,38 +326,54 @@ public virtual Response Exists(string runtimeView, CancellationToken cance /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetIfExists"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetIfExists"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -336,38 +387,54 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetIfExists"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewCollection.GetIfExists"); scope.Start(); try { - var response = _standbyContainerGroupPoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyContainerGroupPoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -387,6 +454,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.Serialization.cs index ef9eae8f7660..3f2e4825aa68 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - public partial class StandbyContainerGroupPoolRuntimeViewData : IUtf8JsonSerializable, IJsonModel + /// Contains information about a standby container group pool as last known by the StandbyPool resource provider. + public partial class StandbyContainerGroupPoolRuntimeViewData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter w /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,87 +46,101 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - StandbyContainerGroupPoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (StandbyContainerGroupPoolRuntimeViewData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyContainerGroupPoolRuntimeViewData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyContainerGroupPoolRuntimeViewData(document.RootElement, options); } - internal static StandbyContainerGroupPoolRuntimeViewData DeserializeStandbyContainerGroupPoolRuntimeViewData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyContainerGroupPoolRuntimeViewData DeserializeStandbyContainerGroupPoolRuntimeViewData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - StandbyContainerGroupPoolRuntimeViewProperties properties = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + StandbyContainerGroupPoolRuntimeViewProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyContainerGroupPoolRuntimeViewProperties.DeserializeStandbyContainerGroupPoolRuntimeViewProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("systemData"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); + properties = StandbyContainerGroupPoolRuntimeViewProperties.DeserializeStandbyContainerGroupPoolRuntimeViewProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new StandbyContainerGroupPoolRuntimeViewData( id, name, - type, + resourceType, systemData, - properties, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -135,15 +150,20 @@ BinaryData IPersistableModel.Write(Mod } } - StandbyContainerGroupPoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (StandbyContainerGroupPoolRuntimeViewData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyContainerGroupPoolRuntimeViewData(document.RootElement, options); } default: @@ -151,6 +171,14 @@ StandbyContainerGroupPoolRuntimeViewData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyContainerGroupPoolRuntimeViewData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyContainerGroupPoolRuntimeViewData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.cs index 940a3aaed2ec..55c45093e5ca 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.StandbyPool { - /// - /// A class representing the StandbyContainerGroupPoolRuntimeView data model. - /// Contains information about a standby container group pool as last known by the StandbyPool resource provider. - /// + /// Contains information about a standby container group pool as last known by the StandbyPool resource provider. public partial class StandbyContainerGroupPoolRuntimeViewData : 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal StandbyContainerGroupPoolRuntimeViewData() @@ -57,16 +25,16 @@ internal StandbyContainerGroupPoolRuntimeViewData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyContainerGroupPoolRuntimeViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StandbyContainerGroupPoolRuntimeViewProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal StandbyContainerGroupPoolRuntimeViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, StandbyContainerGroupPoolRuntimeViewProperties properties) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource-specific properties for this resource. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.Serialization.cs index aa70c0c00f20..82920dd70e63 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.StandbyPool { + /// public partial class StandbyContainerGroupPoolRuntimeViewResource : IJsonModel { - private static StandbyContainerGroupPoolRuntimeViewData s_dataDeserializationInstance; - private static StandbyContainerGroupPoolRuntimeViewData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new StandbyContainerGroupPoolRuntimeViewData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - StandbyContainerGroupPoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + StandbyContainerGroupPoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerStandbyPoolContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. StandbyContainerGroupPoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerStandbyPoolContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.cs index 35bc8e3cb629..ca8cd2807521 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyContainerGroupPoolRuntimeViewResource.cs @@ -6,46 +6,35 @@ #nullable disable using System; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { /// - /// A Class representing a StandbyContainerGroupPoolRuntimeView 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 GetStandbyContainerGroupPoolRuntimeViewResource method. - /// Otherwise you can get one from its parent resource using the GetStandbyContainerGroupPoolRuntimeView method. + /// A class representing a StandbyContainerGroupPoolRuntimeView 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetStandbyContainerGroupPoolRuntimeViews method. /// public partial class StandbyContainerGroupPoolRuntimeViewResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The standbyContainerGroupPoolName. - /// The runtimeView. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, string runtimeView) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _standbyContainerGroupPoolRuntimeViewClientDiagnostics; - private readonly StandbyContainerGroupPoolRuntimeViewsRestOperations _standbyContainerGroupPoolRuntimeViewRestClient; + private readonly ClientDiagnostics _standbyContainerGroupPoolRuntimeViewsClientDiagnostics; + private readonly StandbyContainerGroupPoolRuntimeViews _standbyContainerGroupPoolRuntimeViewsRestClient; private readonly StandbyContainerGroupPoolRuntimeViewData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.StandbyPool/standbyContainerGroupPools/runtimeViews"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyContainerGroupPoolRuntimeViewResource for mocking. protected StandbyContainerGroupPoolRuntimeViewResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal StandbyContainerGroupPoolRuntimeViewResource(ArmClient client, StandbyContainerGroupPoolRuntimeViewData data) : this(client, data.Id) @@ -54,71 +43,93 @@ internal StandbyContainerGroupPoolRuntimeViewResource(ArmClient client, StandbyC _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal StandbyContainerGroupPoolRuntimeViewResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyContainerGroupPoolRuntimeViewClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string standbyContainerGroupPoolRuntimeViewApiVersion); - _standbyContainerGroupPoolRuntimeViewRestClient = new StandbyContainerGroupPoolRuntimeViewsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyContainerGroupPoolRuntimeViewApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyContainerGroupPoolRuntimeViewsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); + _standbyContainerGroupPoolRuntimeViewsRestClient = new StandbyContainerGroupPoolRuntimeViews(_standbyContainerGroupPoolRuntimeViewsClientDiagnostics, Pipeline, Endpoint, standbyContainerGroupPoolRuntimeViewApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } /// 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 StandbyContainerGroupPoolRuntimeViewData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The standbyContainerGroupPoolName. + /// The runtimeView. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyContainerGroupPoolName, string runtimeView) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] 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)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a StandbyContainerGroupPoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewResource.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewResource.Get"); scope.Start(); try { - var response = await _standbyContainerGroupPoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -132,33 +143,41 @@ public virtual async Task /// Get a StandbyContainerGroupPoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyContainerGroupPools/{standbyContainerGroupPoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyContainerGroupPoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyContainerGroupPoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _standbyContainerGroupPoolRuntimeViewClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewResource.Get"); + using DiagnosticScope scope = _standbyContainerGroupPoolRuntimeViewsClientDiagnostics.CreateScope("StandbyContainerGroupPoolRuntimeViewResource.Get"); scope.Start(); try { - var response = _standbyContainerGroupPoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyContainerGroupPoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyContainerGroupPoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyContainerGroupPoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineCollection.cs index aa731197e3f0..53f8426d0a08 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { @@ -24,69 +25,75 @@ namespace Azure.ResourceManager.StandbyPool /// public partial class StandbyVirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _standbyVirtualMachineClientDiagnostics; - private readonly StandbyVirtualMachinesRestOperations _standbyVirtualMachineRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinesClientDiagnostics; + private readonly StandbyVirtualMachines _standbyVirtualMachinesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachineCollection for mocking. protected StandbyVirtualMachineCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachineCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachineResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(StandbyVirtualMachineResource.ResourceType, out string standbyVirtualMachineApiVersion); - _standbyVirtualMachineRestClient = new StandbyVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachineApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachineResource.ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinesRestClient = new StandbyVirtualMachines(_standbyVirtualMachinesClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachineApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != StandbyVirtualMachinePoolResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, StandbyVirtualMachinePoolResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, StandbyVirtualMachinePoolResource.ResourceType), id); + } } /// /// Get a StandbyVirtualMachineResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Get"); scope.Start(); try { - var response = await _standbyVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -100,38 +107,42 @@ public virtual async Task> GetAsync(stri /// Get a StandbyVirtualMachineResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Get"); scope.Start(); try { - var response = _standbyVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -145,50 +156,44 @@ public virtual Response Get(string standbyVirtual /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_ListByStandbyVirtualMachinePoolResource + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachineRestClient.CreateListByStandbyVirtualMachinePoolResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachineRestClient.CreateListByStandbyVirtualMachinePoolResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachineResource(Client, StandbyVirtualMachineData.DeserializeStandbyVirtualMachineData(e)), _standbyVirtualMachineClientDiagnostics, Pipeline, "StandbyVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceAsyncCollectionResultOfT(_standbyVirtualMachinesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyVirtualMachineResource(Client, data)); } /// /// List StandbyVirtualMachineResource resources by StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_ListByStandbyVirtualMachinePoolResource + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -196,45 +201,61 @@ public virtual AsyncPageable GetAllAsync(Cancella /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachineRestClient.CreateListByStandbyVirtualMachinePoolResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachineRestClient.CreateListByStandbyVirtualMachinePoolResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachineResource(Client, StandbyVirtualMachineData.DeserializeStandbyVirtualMachineData(e)), _standbyVirtualMachineClientDiagnostics, Pipeline, "StandbyVirtualMachineCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyVirtualMachinesGetByStandbyVirtualMachinePoolResourceCollectionResultOfT(_standbyVirtualMachinesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyVirtualMachineResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Exists"); scope.Start(); try { - var response = await _standbyVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachineData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -248,36 +269,50 @@ public virtual async Task> ExistsAsync(string standbyVirtualMachi /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.Exists"); scope.Start(); try { - var response = _standbyVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachineData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -291,38 +326,54 @@ public virtual Response Exists(string standbyVirtualMachineName, Cancellat /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetIfExists"); scope.Start(); try { - var response = await _standbyVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachineData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -336,38 +387,54 @@ public virtual async Task> GetIf /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string standbyVirtualMachineName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineCollection.GetIfExists"); scope.Start(); try { - var response = _standbyVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, standbyVirtualMachineName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachineData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -387,6 +454,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.Serialization.cs index 234720d23e1e..be20e1b44bda 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - public partial class StandbyVirtualMachineData : IUtf8JsonSerializable, IJsonModel + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + public partial class StandbyVirtualMachineData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,87 +46,101 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - StandbyVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (StandbyVirtualMachineData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachineData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachineData(document.RootElement, options); } - internal static StandbyVirtualMachineData DeserializeStandbyVirtualMachineData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachineData DeserializeStandbyVirtualMachineData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - StandbyVirtualMachineProperties properties = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + StandbyVirtualMachineProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyVirtualMachineProperties.DeserializeStandbyVirtualMachineProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("systemData"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); + properties = StandbyVirtualMachineProperties.DeserializeStandbyVirtualMachineProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new StandbyVirtualMachineData( id, name, - type, + resourceType, systemData, - properties, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -135,15 +150,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - StandbyVirtualMachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (StandbyVirtualMachineData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachineData(document.RootElement, options); } default: @@ -151,6 +171,14 @@ StandbyVirtualMachineData IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyVirtualMachineData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachineData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.cs index 276c7b2d92fb..907fc9dbfdca 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.StandbyPool { - /// - /// A class representing the StandbyVirtualMachine data model. - /// Concrete proxy resource types can be created by aliasing this type using a specific property type. - /// + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. public partial class StandbyVirtualMachineData : 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal StandbyVirtualMachineData() @@ -57,16 +25,16 @@ internal StandbyVirtualMachineData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StandbyVirtualMachineProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal StandbyVirtualMachineData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, StandbyVirtualMachineProperties properties) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource-specific properties for this resource. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolCollection.cs index 83759792dc35..6b65877f7b4f 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.StandbyPool @@ -25,51 +26,49 @@ namespace Azure.ResourceManager.StandbyPool /// public partial class StandbyVirtualMachinePoolCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _standbyVirtualMachinePoolClientDiagnostics; - private readonly StandbyVirtualMachinePoolsRestOperations _standbyVirtualMachinePoolRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinePoolsClientDiagnostics; + private readonly StandbyVirtualMachinePools _standbyVirtualMachinePoolsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachinePoolCollection for mocking. protected StandbyVirtualMachinePoolCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachinePoolCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachinePoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachinePoolResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(StandbyVirtualMachinePoolResource.ResourceType, out string standbyVirtualMachinePoolApiVersion); - _standbyVirtualMachinePoolRestClient = new StandbyVirtualMachinePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachinePoolApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinePoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachinePoolResource.ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinePoolsRestClient = new StandbyVirtualMachinePools(_standbyVirtualMachinePoolsClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachinePoolApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -77,21 +76,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the standby virtual machine pool. /// Resource create parameters. /// The cancellation token to use. - /// 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. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, data, cancellationToken).ConfigureAwait(false); - var operation = new StandbyPoolArmOperation(new StandbyVirtualMachinePoolOperationSource(Client), _standbyVirtualMachinePoolClientDiagnostics, Pipeline, _standbyVirtualMachinePoolRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation( + new StandbyVirtualMachinePoolOperationSource(Client), + _standbyVirtualMachinePoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +117,16 @@ public virtual async Task> Creat /// Create a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_CreateOrUpdate + /// Operation Id. + /// StandbyVirtualMachinePools_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -126,21 +134,34 @@ public virtual async Task> Creat /// Name of the standby virtual machine pool. /// Resource create parameters. /// The cancellation token to use. - /// 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. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, data, cancellationToken); - var operation = new StandbyPoolArmOperation(new StandbyVirtualMachinePoolOperationSource(Client), _standbyVirtualMachinePoolClientDiagnostics, Pipeline, _standbyVirtualMachinePoolRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, StandbyVirtualMachinePoolData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation( + new StandbyVirtualMachinePoolOperationSource(Client), + _standbyVirtualMachinePoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +175,42 @@ public virtual ArmOperation CreateOrUpdate(Wa /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Get"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +224,42 @@ public virtual async Task> GetAsync( /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Get"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,50 +273,44 @@ public virtual Response Get(string standbyVir /// List StandbyVirtualMachinePoolResource resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListByResourceGroup + /// Operation Id. + /// StandbyVirtualMachinePools_ListByResourceGroup. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachinePoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachinePoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolResource(Client, StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(e)), _standbyVirtualMachinePoolClientDiagnostics, Pipeline, "StandbyVirtualMachinePoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyVirtualMachinePoolsGetByResourceGroupAsyncCollectionResultOfT(_standbyVirtualMachinePoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new StandbyVirtualMachinePoolResource(Client, data)); } /// /// List StandbyVirtualMachinePoolResource resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -295,45 +318,61 @@ public virtual AsyncPageable GetAllAsync(Canc /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachinePoolRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachinePoolRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolResource(Client, StandbyVirtualMachinePoolData.DeserializeStandbyVirtualMachinePoolData(e)), _standbyVirtualMachinePoolClientDiagnostics, Pipeline, "StandbyVirtualMachinePoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyVirtualMachinePoolsGetByResourceGroupCollectionResultOfT(_standbyVirtualMachinePoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new StandbyVirtualMachinePoolResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Exists"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -347,36 +386,50 @@ public virtual async Task> ExistsAsync(string standbyVirtualMachi /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.Exists"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -390,38 +443,54 @@ public virtual Response Exists(string standbyVirtualMachinePoolName, Cance /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetIfExists"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -435,38 +504,54 @@ public virtual async Task> G /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// Name of the standby virtual machine pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string standbyVirtualMachinePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(standbyVirtualMachinePoolName, nameof(standbyVirtualMachinePoolName)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolCollection.GetIfExists"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, standbyVirtualMachinePoolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, standbyVirtualMachinePoolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,6 +571,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.Serialization.cs index c476cb7783a2..c07726c3ce9b 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - public partial class StandbyVirtualMachinePoolData : IUtf8JsonSerializable, IJsonModel + /// A StandbyVirtualMachinePoolResource. + public partial class StandbyVirtualMachinePoolData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal StandbyVirtualMachinePoolData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +38,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,110 +51,131 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - StandbyVirtualMachinePoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (StandbyVirtualMachinePoolData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolData(document.RootElement, options); } - internal static StandbyVirtualMachinePoolData DeserializeStandbyVirtualMachinePoolData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolData DeserializeStandbyVirtualMachinePoolData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - StandbyVirtualMachinePoolProperties properties = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + StandbyVirtualMachinePoolProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyVirtualMachinePoolProperties.DeserializeStandbyVirtualMachinePoolProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"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; + name = prop.Value.GetString(); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("type"u8)) { - location = new AzureLocation(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("systemData"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("tags"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); + properties = StandbyVirtualMachinePoolProperties.DeserializeStandbyVirtualMachinePoolProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new StandbyVirtualMachinePoolData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - properties, - serializedAdditionalRawData); + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -158,15 +185,20 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - StandbyVirtualMachinePoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (StandbyVirtualMachinePoolData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolData(document.RootElement, options); } default: @@ -174,6 +206,26 @@ StandbyVirtualMachinePoolData IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(StandbyVirtualMachinePoolData standbyVirtualMachinePoolData) + { + if (standbyVirtualMachinePoolData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(standbyVirtualMachinePoolData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static StandbyVirtualMachinePoolData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachinePoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.cs index 750974f4ff84..5c5b308563f0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolData.cs @@ -13,68 +13,31 @@ namespace Azure.ResourceManager.StandbyPool { - /// - /// A class representing the StandbyVirtualMachinePool data model. - /// A StandbyVirtualMachinePoolResource. - /// + /// A StandbyVirtualMachinePoolResource. public partial class StandbyVirtualMachinePoolData : TrackedResourceData { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. public StandbyVirtualMachinePoolData(AzureLocation location) : base(location) { } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, StandbyVirtualMachinePoolProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal StandbyVirtualMachinePoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, StandbyVirtualMachinePoolProperties properties) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal StandbyVirtualMachinePoolData() - { } /// The resource-specific properties for this resource. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.Serialization.cs index a4d25a11a787..8f1c617fa221 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.StandbyPool { + /// public partial class StandbyVirtualMachinePoolResource : IJsonModel { - private static StandbyVirtualMachinePoolData s_dataDeserializationInstance; - private static StandbyVirtualMachinePoolData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new StandbyVirtualMachinePoolData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - StandbyVirtualMachinePoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerStandbyPoolContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. StandbyVirtualMachinePoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerStandbyPoolContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.cs index 1b6ebe1199d0..2825af37eafb 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolResource.cs @@ -7,47 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { /// - /// A Class representing a StandbyVirtualMachinePool 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 GetStandbyVirtualMachinePoolResource method. - /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachinePool method. + /// A class representing a StandbyVirtualMachinePool 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachinePools method. /// public partial class StandbyVirtualMachinePoolResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The standbyVirtualMachinePoolName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _standbyVirtualMachinePoolClientDiagnostics; - private readonly StandbyVirtualMachinePoolsRestOperations _standbyVirtualMachinePoolRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinePoolsClientDiagnostics; + private readonly StandbyVirtualMachinePools _standbyVirtualMachinePoolsRestClient; private readonly StandbyVirtualMachinePoolData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.StandbyPool/standbyVirtualMachinePools"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachinePoolResource for mocking. protected StandbyVirtualMachinePoolResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal StandbyVirtualMachinePoolResource(ArmClient client, StandbyVirtualMachinePoolData data) : this(client, data.Id) @@ -56,209 +46,92 @@ internal StandbyVirtualMachinePoolResource(ArmClient client, StandbyVirtualMachi _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachinePoolResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachinePoolClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string standbyVirtualMachinePoolApiVersion); - _standbyVirtualMachinePoolRestClient = new StandbyVirtualMachinePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachinePoolApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinePoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinePoolsRestClient = new StandbyVirtualMachinePools(_standbyVirtualMachinePoolsClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachinePoolApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } /// 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 StandbyVirtualMachinePoolData 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)); - } - - /// Gets a collection of StandbyVirtualMachineResources in the StandbyVirtualMachinePool. - /// An object representing collection of StandbyVirtualMachineResources and their operations over a StandbyVirtualMachineResource. - public virtual StandbyVirtualMachineCollection GetStandbyVirtualMachines() - { - return GetCachedClient(client => new StandbyVirtualMachineCollection(client, Id)); - } - - /// - /// Get a StandbyVirtualMachineResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the standby virtual machine. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetStandbyVirtualMachineAsync(string standbyVirtualMachineName, CancellationToken cancellationToken = default) - { - return await GetStandbyVirtualMachines().GetAsync(standbyVirtualMachineName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a StandbyVirtualMachineResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} - /// - /// - /// Operation Id - /// StandbyVirtualMachineResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the standby virtual machine. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetStandbyVirtualMachine(string standbyVirtualMachineName, CancellationToken cancellationToken = default) - { - return GetStandbyVirtualMachines().Get(standbyVirtualMachineName, cancellationToken); - } - - /// Gets a collection of StandbyVirtualMachinePoolRuntimeViewResources in the StandbyVirtualMachinePool. - /// An object representing collection of StandbyVirtualMachinePoolRuntimeViewResources and their operations over a StandbyVirtualMachinePoolRuntimeViewResource. - public virtual StandbyVirtualMachinePoolRuntimeViewCollection GetStandbyVirtualMachinePoolRuntimeViews() - { - return GetCachedClient(client => new StandbyVirtualMachinePoolRuntimeViewCollection(client, Id)); - } - - /// - /// Get a StandbyVirtualMachinePoolRuntimeViewResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetStandbyVirtualMachinePoolRuntimeViewAsync(string runtimeView, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The standbyVirtualMachinePoolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName) { - return await GetStandbyVirtualMachinePoolRuntimeViews().GetAsync(runtimeView, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get a StandbyVirtualMachinePoolRuntimeViewResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetStandbyVirtualMachinePoolRuntimeView(string runtimeView, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetStandbyVirtualMachinePoolRuntimeViews().Get(runtimeView, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Get"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -272,33 +145,41 @@ public virtual async Task> GetAsync( /// Get a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get + /// Operation Id. + /// StandbyVirtualMachinePools_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Get"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -312,20 +193,20 @@ public virtual Response Get(CancellationToken /// Delete a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Delete + /// Operation Id. + /// StandbyVirtualMachinePools_Delete. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -333,14 +214,21 @@ public virtual Response Get(CancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Delete"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Delete"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new StandbyPoolArmOperation(_standbyVirtualMachinePoolClientDiagnostics, Pipeline, _standbyVirtualMachinePoolRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation(_standbyVirtualMachinePoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -354,20 +242,20 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// Delete a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Delete + /// Operation Id. + /// StandbyVirtualMachinePools_Delete. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -375,14 +263,21 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Delete"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Delete"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new StandbyPoolArmOperation(_standbyVirtualMachinePoolClientDiagnostics, Pipeline, _standbyVirtualMachinePoolRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + StandbyPoolArmOperation operation = new StandbyPoolArmOperation(_standbyVirtualMachinePoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -396,20 +291,20 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Update a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Update + /// Operation Id. + /// StandbyVirtualMachinePools_Update. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -420,11 +315,21 @@ public virtual async Task> UpdateAsy { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Update"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Update"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, StandbyVirtualMachinePoolPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -438,20 +343,20 @@ public virtual async Task> UpdateAsy /// Update a StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Update + /// Operation Id. + /// StandbyVirtualMachinePools_Update. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -462,11 +367,21 @@ public virtual Response Update(StandbyVirtual { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Update"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.Update"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, StandbyVirtualMachinePoolPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -476,27 +391,7 @@ public virtual Response Update(StandbyVirtual } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -506,29 +401,35 @@ public virtual async Task> AddTagAsy Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.AddTag"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); - foreach (var tag in current.Tags) + StandbyVirtualMachinePoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -538,27 +439,7 @@ public virtual async Task> AddTagAsy } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -568,29 +449,35 @@ public virtual Response AddTag(string key, st Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.AddTag"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); - foreach (var tag in current.Tags) + StandbyVirtualMachinePoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -600,54 +487,40 @@ public virtual Response AddTag(string key, st } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// 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 = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.SetTags"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); + StandbyVirtualMachinePoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -657,54 +530,40 @@ public virtual async Task> SetTagsAs } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.SetTags"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); + StandbyVirtualMachinePoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -714,27 +573,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -742,29 +581,35 @@ public virtual async Task> RemoveTag { Argument.AssertNotNull(key, nameof(key)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.RemoveTag"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _standbyVirtualMachinePoolRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); - foreach (var tag in current.Tags) + StandbyVirtualMachinePoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -774,27 +619,7 @@ public virtual async Task> RemoveTag } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolResource_Get - /// - /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -802,29 +627,35 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _standbyVirtualMachinePoolClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.RemoveTag"); + using DiagnosticScope scope = _standbyVirtualMachinePoolsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _standbyVirtualMachinePoolRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolData.FromResponse(result), result); + return Response.FromValue(new StandbyVirtualMachinePoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new StandbyVirtualMachinePoolPatch(); - foreach (var tag in current.Tags) + StandbyVirtualMachinePoolData current = Get(cancellationToken: cancellationToken).Value.Data; + StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -833,5 +664,71 @@ public virtual Response RemoveTag(string key, throw; } } + + /// Gets a collection of StandbyVirtualMachines in the . + /// An object representing collection of StandbyVirtualMachines and their operations over a StandbyVirtualMachineResource. + public virtual StandbyVirtualMachineCollection GetStandbyVirtualMachines() + { + return GetCachedClient(client => new StandbyVirtualMachineCollection(client, Id)); + } + + /// Get a StandbyVirtualMachineResource. + /// Name of the standby virtual machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStandbyVirtualMachineAsync(string standbyVirtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); + + return await GetStandbyVirtualMachines().GetAsync(standbyVirtualMachineName, cancellationToken).ConfigureAwait(false); + } + + /// Get a StandbyVirtualMachineResource. + /// Name of the standby virtual machine. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStandbyVirtualMachine(string standbyVirtualMachineName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(standbyVirtualMachineName, nameof(standbyVirtualMachineName)); + + return GetStandbyVirtualMachines().Get(standbyVirtualMachineName, cancellationToken); + } + + /// Gets a collection of StandbyVirtualMachinePoolRuntimeViews in the . + /// An object representing collection of StandbyVirtualMachinePoolRuntimeViews and their operations over a StandbyVirtualMachinePoolRuntimeViewResource. + public virtual StandbyVirtualMachinePoolRuntimeViewCollection GetStandbyVirtualMachinePoolRuntimeViews() + { + return GetCachedClient(client => new StandbyVirtualMachinePoolRuntimeViewCollection(client, Id)); + } + + /// Get a StandbyVirtualMachinePoolRuntimeViewResource. + /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetStandbyVirtualMachinePoolRuntimeViewAsync(string runtimeView, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); + + return await GetStandbyVirtualMachinePoolRuntimeViews().GetAsync(runtimeView, cancellationToken).ConfigureAwait(false); + } + + /// Get a StandbyVirtualMachinePoolRuntimeViewResource. + /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetStandbyVirtualMachinePoolRuntimeView(string runtimeView, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); + + return GetStandbyVirtualMachinePoolRuntimeViews().Get(runtimeView, cancellationToken); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewCollection.cs index 485b063f4692..5563402b2a0e 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewCollection.cs @@ -8,12 +8,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { @@ -24,69 +25,75 @@ namespace Azure.ResourceManager.StandbyPool /// public partial class StandbyVirtualMachinePoolRuntimeViewCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _standbyVirtualMachinePoolRuntimeViewClientDiagnostics; - private readonly StandbyVirtualMachinePoolRuntimeViewsRestOperations _standbyVirtualMachinePoolRuntimeViewRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics; + private readonly StandbyVirtualMachinePoolRuntimeViews _standbyVirtualMachinePoolRuntimeViewsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViewCollection for mocking. protected StandbyVirtualMachinePoolRuntimeViewCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachinePoolRuntimeViewCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachinePoolRuntimeViewClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachinePoolRuntimeViewResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(StandbyVirtualMachinePoolRuntimeViewResource.ResourceType, out string standbyVirtualMachinePoolRuntimeViewApiVersion); - _standbyVirtualMachinePoolRuntimeViewRestClient = new StandbyVirtualMachinePoolRuntimeViewsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachinePoolRuntimeViewApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", StandbyVirtualMachinePoolRuntimeViewResource.ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinePoolRuntimeViewsRestClient = new StandbyVirtualMachinePoolRuntimeViews(_standbyVirtualMachinePoolRuntimeViewsClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachinePoolRuntimeViewApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != StandbyVirtualMachinePoolResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, StandbyVirtualMachinePoolResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, StandbyVirtualMachinePoolResource.ResourceType), id); + } } /// /// Get a StandbyVirtualMachinePoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Get"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -100,38 +107,42 @@ public virtual async Task /// Get a StandbyVirtualMachinePoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Get"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -145,50 +156,44 @@ public virtual Response Get(string /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_ListByStandbyPool + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachinePoolRuntimeViewRestClient.CreateListByStandbyPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachinePoolRuntimeViewRestClient.CreateListByStandbyPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolRuntimeViewResource(Client, StandbyVirtualMachinePoolRuntimeViewData.DeserializeStandbyVirtualMachinePoolRuntimeViewData(e)), _standbyVirtualMachinePoolRuntimeViewClientDiagnostics, Pipeline, "StandbyVirtualMachinePoolRuntimeViewCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolAsyncCollectionResultOfT(_standbyVirtualMachinePoolRuntimeViewsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyVirtualMachinePoolRuntimeViewResource(Client, data)); } /// /// List StandbyVirtualMachinePoolRuntimeViewResource resources by StandbyVirtualMachinePoolResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_ListByStandbyPool + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// @@ -196,45 +201,61 @@ public virtual AsyncPageable GetAl /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _standbyVirtualMachinePoolRuntimeViewRestClient.CreateListByStandbyPoolRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _standbyVirtualMachinePoolRuntimeViewRestClient.CreateListByStandbyPoolNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StandbyVirtualMachinePoolRuntimeViewResource(Client, StandbyVirtualMachinePoolRuntimeViewData.DeserializeStandbyVirtualMachinePoolRuntimeViewData(e)), _standbyVirtualMachinePoolRuntimeViewClientDiagnostics, Pipeline, "StandbyVirtualMachinePoolRuntimeViewCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new StandbyVirtualMachinePoolRuntimeViewsGetByStandbyPoolCollectionResultOfT(_standbyVirtualMachinePoolRuntimeViewsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new StandbyVirtualMachinePoolRuntimeViewResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Exists"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -248,36 +269,50 @@ public virtual async Task> ExistsAsync(string runtimeView, Cancel /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Exists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.Exists"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -291,38 +326,54 @@ public virtual Response Exists(string runtimeView, CancellationToken cance /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetIfExists"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -336,38 +387,54 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} - /// - /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Default Api Version - /// 2025-03-01 + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-10-01. /// /// /// /// The unique identifier for the runtime view. The input string should be the word 'latest', which will get the latest runtime view of the pool, otherwise the request will fail with NotFound exception. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string runtimeView, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(runtimeView, nameof(runtimeView)); - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetIfExists"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewCollection.GetIfExists"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, runtimeView, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, runtimeView, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((StandbyVirtualMachinePoolRuntimeViewData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -387,6 +454,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.Serialization.cs index dfaad5d27646..40a7ca1c8ec0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.StandbyPool.Models; namespace Azure.ResourceManager.StandbyPool { - public partial class StandbyVirtualMachinePoolRuntimeViewData : IUtf8JsonSerializable, IJsonModel + /// Contains information about a standby virtual machine pool as last known by the StandbyPool resource provider. + public partial class StandbyVirtualMachinePoolRuntimeViewData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter w /// 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; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,87 +46,101 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - StandbyVirtualMachinePoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (StandbyVirtualMachinePoolRuntimeViewData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(StandbyVirtualMachinePoolRuntimeViewData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeStandbyVirtualMachinePoolRuntimeViewData(document.RootElement, options); } - internal static StandbyVirtualMachinePoolRuntimeViewData DeserializeStandbyVirtualMachinePoolRuntimeViewData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static StandbyVirtualMachinePoolRuntimeViewData DeserializeStandbyVirtualMachinePoolRuntimeViewData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - StandbyVirtualMachinePoolRuntimeViewProperties properties = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + StandbyVirtualMachinePoolRuntimeViewProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = StandbyVirtualMachinePoolRuntimeViewProperties.DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("systemData"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerStandbyPoolContext.Default); + properties = StandbyVirtualMachinePoolRuntimeViewProperties.DeserializeStandbyVirtualMachinePoolRuntimeViewProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new StandbyVirtualMachinePoolRuntimeViewData( id, name, - type, + resourceType, systemData, - properties, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -135,15 +150,20 @@ BinaryData IPersistableModel.Write(Mod } } - StandbyVirtualMachinePoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (StandbyVirtualMachinePoolRuntimeViewData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeStandbyVirtualMachinePoolRuntimeViewData(document.RootElement, options); } default: @@ -151,6 +171,14 @@ StandbyVirtualMachinePoolRuntimeViewData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static StandbyVirtualMachinePoolRuntimeViewData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStandbyVirtualMachinePoolRuntimeViewData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.cs index 2129645ae16b..7ad28e360d1e 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.StandbyPool { - /// - /// A class representing the StandbyVirtualMachinePoolRuntimeView data model. - /// Contains information about a standby virtual machine pool as last known by the StandbyPool resource provider. - /// + /// Contains information about a standby virtual machine pool as last known by the StandbyPool resource provider. public partial class StandbyVirtualMachinePoolRuntimeViewData : 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal StandbyVirtualMachinePoolRuntimeViewData() @@ -57,16 +25,16 @@ internal StandbyVirtualMachinePoolRuntimeViewData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal StandbyVirtualMachinePoolRuntimeViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, StandbyVirtualMachinePoolRuntimeViewProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal StandbyVirtualMachinePoolRuntimeViewData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, StandbyVirtualMachinePoolRuntimeViewProperties properties) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource-specific properties for this resource. diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.Serialization.cs index 00cc9c4f36d8..9e786660bf06 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.StandbyPool { + /// public partial class StandbyVirtualMachinePoolRuntimeViewResource : IJsonModel { - private static StandbyVirtualMachinePoolRuntimeViewData s_dataDeserializationInstance; - private static StandbyVirtualMachinePoolRuntimeViewData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new StandbyVirtualMachinePoolRuntimeViewData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - StandbyVirtualMachinePoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + StandbyVirtualMachinePoolRuntimeViewData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerStandbyPoolContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. StandbyVirtualMachinePoolRuntimeViewData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerStandbyPoolContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.cs index e9d6cdba3aad..2341df1103df 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachinePoolRuntimeViewResource.cs @@ -6,46 +6,35 @@ #nullable disable using System; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { /// - /// A Class representing a StandbyVirtualMachinePoolRuntimeView 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 GetStandbyVirtualMachinePoolRuntimeViewResource method. - /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachinePoolRuntimeView method. + /// A class representing a StandbyVirtualMachinePoolRuntimeView 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachinePoolRuntimeViews method. /// public partial class StandbyVirtualMachinePoolRuntimeViewResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The standbyVirtualMachinePoolName. - /// The runtimeView. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string runtimeView) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _standbyVirtualMachinePoolRuntimeViewClientDiagnostics; - private readonly StandbyVirtualMachinePoolRuntimeViewsRestOperations _standbyVirtualMachinePoolRuntimeViewRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics; + private readonly StandbyVirtualMachinePoolRuntimeViews _standbyVirtualMachinePoolRuntimeViewsRestClient; private readonly StandbyVirtualMachinePoolRuntimeViewData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.StandbyPool/standbyVirtualMachinePools/runtimeViews"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachinePoolRuntimeViewResource for mocking. protected StandbyVirtualMachinePoolRuntimeViewResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal StandbyVirtualMachinePoolRuntimeViewResource(ArmClient client, StandbyVirtualMachinePoolRuntimeViewData data) : this(client, data.Id) @@ -54,71 +43,93 @@ internal StandbyVirtualMachinePoolRuntimeViewResource(ArmClient client, StandbyV _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachinePoolRuntimeViewResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachinePoolRuntimeViewClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string standbyVirtualMachinePoolRuntimeViewApiVersion); - _standbyVirtualMachinePoolRuntimeViewRestClient = new StandbyVirtualMachinePoolRuntimeViewsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachinePoolRuntimeViewApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinePoolRuntimeViewsRestClient = new StandbyVirtualMachinePoolRuntimeViews(_standbyVirtualMachinePoolRuntimeViewsClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachinePoolRuntimeViewApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } /// 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 StandbyVirtualMachinePoolRuntimeViewData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The standbyVirtualMachinePoolName. + /// The runtimeView. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string runtimeView) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] 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)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a StandbyVirtualMachinePoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewResource.Get"); scope.Start(); try { - var response = await _standbyVirtualMachinePoolRuntimeViewRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -132,33 +143,41 @@ public virtual async Task /// Get a StandbyVirtualMachinePoolRuntimeViewResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/runtimeViews/{runtimeView}. /// /// - /// Operation Id - /// StandbyVirtualMachinePoolRuntimeViewResource_Get + /// Operation Id. + /// StandbyVirtualMachinePoolRuntimeViews_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachinePoolRuntimeViewClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinePoolRuntimeViewsClientDiagnostics.CreateScope("StandbyVirtualMachinePoolRuntimeViewResource.Get"); scope.Start(); try { - var response = _standbyVirtualMachinePoolRuntimeViewRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinePoolRuntimeViewsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachinePoolRuntimeViewData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachinePoolRuntimeViewResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.Serialization.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.Serialization.cs index 82f8e22a3b64..46cd6396b832 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.Serialization.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.StandbyPool { + /// public partial class StandbyVirtualMachineResource : IJsonModel { - private static StandbyVirtualMachineData s_dataDeserializationInstance; - private static StandbyVirtualMachineData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new StandbyVirtualMachineData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - StandbyVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + StandbyVirtualMachineData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerStandbyPoolContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. StandbyVirtualMachineData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerStandbyPoolContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.cs index 3692665f59bf..bcfba1f6e555 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/src/Generated/StandbyVirtualMachineResource.cs @@ -6,46 +6,35 @@ #nullable disable using System; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.StandbyPool { /// - /// A Class representing a StandbyVirtualMachine 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 GetStandbyVirtualMachineResource method. - /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachine method. + /// A class representing a StandbyVirtualMachine 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetStandbyVirtualMachines method. /// public partial class StandbyVirtualMachineResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The standbyVirtualMachinePoolName. - /// The standbyVirtualMachineName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string standbyVirtualMachineName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _standbyVirtualMachineClientDiagnostics; - private readonly StandbyVirtualMachinesRestOperations _standbyVirtualMachineRestClient; + private readonly ClientDiagnostics _standbyVirtualMachinesClientDiagnostics; + private readonly StandbyVirtualMachines _standbyVirtualMachinesRestClient; private readonly StandbyVirtualMachineData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.StandbyPool/standbyVirtualMachinePools/standbyVirtualMachines"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of StandbyVirtualMachineResource for mocking. protected StandbyVirtualMachineResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal StandbyVirtualMachineResource(ArmClient client, StandbyVirtualMachineData data) : this(client, data.Id) @@ -54,71 +43,93 @@ internal StandbyVirtualMachineResource(ArmClient client, StandbyVirtualMachineDa _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal StandbyVirtualMachineResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _standbyVirtualMachineClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string standbyVirtualMachineApiVersion); - _standbyVirtualMachineRestClient = new StandbyVirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, standbyVirtualMachineApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _standbyVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StandbyPool", ResourceType.Namespace, Diagnostics); + _standbyVirtualMachinesRestClient = new StandbyVirtualMachines(_standbyVirtualMachinesClientDiagnostics, Pipeline, Endpoint, standbyVirtualMachineApiVersion ?? "2025-10-01"); + ValidateResourceId(id); } /// 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 StandbyVirtualMachineData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The standbyVirtualMachinePoolName. + /// The standbyVirtualMachineName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string standbyVirtualMachinePoolName, string standbyVirtualMachineName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] 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)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a StandbyVirtualMachineResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineResource.Get"); scope.Start(); try { - var response = await _standbyVirtualMachineRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -132,33 +143,41 @@ public virtual async Task> GetAsync(Canc /// Get a StandbyVirtualMachineResource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/{standbyVirtualMachinePoolName}/standbyVirtualMachines/{standbyVirtualMachineName}. /// /// - /// Operation Id - /// StandbyVirtualMachineResource_Get + /// Operation Id. + /// StandbyVirtualMachines_Get. /// /// - /// Default Api Version - /// 2025-03-01 + /// Default Api Version. + /// 2025-10-01. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _standbyVirtualMachineClientDiagnostics.CreateScope("StandbyVirtualMachineResource.Get"); + using DiagnosticScope scope = _standbyVirtualMachinesClientDiagnostics.CreateScope("StandbyVirtualMachineResource.Get"); scope.Start(); try { - var response = _standbyVirtualMachineRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _standbyVirtualMachinesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(StandbyVirtualMachineData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new StandbyVirtualMachineResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolCollection.cs index 105efd8c919c..2cb49392c081 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_StandbyContainerGroupPoolCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StandbyContainerGroupPoolsCreateOrUpdate() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_CreateOrUpdate.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_CreateOrUpdate.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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 @@ -44,9 +44,10 @@ public async Task CreateOrUpdate_StandbyContainerGroupPoolsCreateOrUpdate() string standbyContainerGroupPoolName = "pool"; StandbyContainerGroupPoolData data = new StandbyContainerGroupPoolData(new AzureLocation("West US")) { - Properties = new StandbyContainerGroupPoolProperties(new StandbyContainerGroupPoolElasticityProfile(688L) + Properties = new StandbyContainerGroupPoolUpdateProperties(new StandbyContainerGroupPoolElasticityProfile(688L) { RefillPolicy = StandbyRefillPolicy.Always, + DynamicSizingEnabled = true, }, new StandbyContainerGroupProperties(new StandbyContainerGroupProfile(new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile")) { Revision = 1L, @@ -76,7 +77,7 @@ public async Task CreateOrUpdate_StandbyContainerGroupPoolsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_StandbyContainerGroupPoolsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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 @@ -109,7 +110,7 @@ public async Task Get_StandbyContainerGroupPoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_StandbyContainerGroupPoolsListByResourceGroup() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_ListByResourceGroup.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_ListByResourceGroup.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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 @@ -144,7 +145,7 @@ public async Task GetAll_StandbyContainerGroupPoolsListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_StandbyContainerGroupPoolsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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 @@ -173,7 +174,7 @@ public async Task Exists_StandbyContainerGroupPoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_StandbyContainerGroupPoolsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolResource.cs index e5e6964d6b72..d2b1b60d021b 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolResource.cs @@ -21,7 +21,7 @@ public partial class Sample_StandbyContainerGroupPoolResource [Ignore("Only validating compilation of examples")] public async Task Get_StandbyContainerGroupPoolsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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_StandbyContainerGroupPoolsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_StandbyContainerGroupPoolsDelete() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Delete.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Delete.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -77,7 +77,7 @@ public async Task Delete_StandbyContainerGroupPoolsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_StandbyContainerGroupPoolsUpdate() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_Update.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_Update.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_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 @@ -97,11 +97,12 @@ public async Task Update_StandbyContainerGroupPoolsUpdate() StandbyContainerGroupPoolPatch patch = new StandbyContainerGroupPoolPatch { Tags = { }, - Properties = new StandbyContainerGroupPoolUpdateProperties + Properties = new StandbyContainerGroupPoolResourceUpdateProperties { ElasticityProfile = new StandbyContainerGroupPoolElasticityProfile(1743L) { RefillPolicy = StandbyRefillPolicy.Always, + DynamicSizingEnabled = true, }, ContainerGroupProperties = new StandbyContainerGroupProperties(new StandbyContainerGroupProfile(new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.ContainerInstance/containerGroupProfiles/cgProfile")) { diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewCollection.cs index 749bd3d57875..d712e800752d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyContainerGroupPoolRuntimeViewCollection [Ignore("Only validating compilation of examples")] public async Task Get_StandbyContainerGroupPoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolRuntimeViewResource_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_StandbyContainerGroupPoolRuntimeViewsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_StandbyContainerGroupPoolRuntimeViewsListByStandbyPool() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPoolRuntimeViews_ListByStandbyPool.json // this example is just showing the usage of "StandbyContainerGroupPoolRuntimeViewResource_ListByStandbyPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task GetAll_StandbyContainerGroupPoolRuntimeViewsListByStandbyPool( [Ignore("Only validating compilation of examples")] public async Task Exists_StandbyContainerGroupPoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolRuntimeViewResource_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 @@ -119,7 +119,7 @@ public async Task Exists_StandbyContainerGroupPoolRuntimeViewsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_StandbyContainerGroupPoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolRuntimeViewResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewResource.cs index b6f79ef30726..04e2abc457f0 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyContainerGroupPoolRuntimeViewResource.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyContainerGroupPoolRuntimeViewResource [Ignore("Only validating compilation of examples")] public async Task Get_StandbyContainerGroupPoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyContainerGroupPoolRuntimeViewResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineCollection.cs index 627dc6ec70fc..0d66783d193d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyVirtualMachineCollection [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinesGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachines_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachines_Get.json // this example is just showing the usage of "StandbyVirtualMachineResource_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_StandbyVirtualMachinesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_StandbyVirtualMachinesListByStandbyVirtualMachinePoolResource() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachines_ListByStandbyVirtualMachinePoolResource.json // this example is just showing the usage of "StandbyVirtualMachineResource_ListByStandbyVirtualMachinePoolResource" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task GetAll_StandbyVirtualMachinesListByStandbyVirtualMachinePoolRe [Ignore("Only validating compilation of examples")] public async Task Exists_StandbyVirtualMachinesGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachines_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachines_Get.json // this example is just showing the usage of "StandbyVirtualMachineResource_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 @@ -119,7 +119,7 @@ public async Task Exists_StandbyVirtualMachinesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_StandbyVirtualMachinesGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachines_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachines_Get.json // this example is just showing the usage of "StandbyVirtualMachineResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolCollection.cs index 1faf71e9f2ab..92e9531abd3f 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_StandbyVirtualMachinePoolCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_StandbyVirtualMachinePoolsCreateOrUpdate() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_CreateOrUpdate.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_CreateOrUpdate.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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 @@ -43,11 +43,13 @@ public async Task CreateOrUpdate_StandbyVirtualMachinePoolsCreateOrUpdate() string standbyVirtualMachinePoolName = "pool"; StandbyVirtualMachinePoolData data = new StandbyVirtualMachinePoolData(new AzureLocation("West US")) { - Properties = new StandbyVirtualMachinePoolProperties(StandbyVirtualMachineState.Running) + Properties = new StandbyVirtualMachinePoolUpdateProperties(StandbyVirtualMachineState.Running) { ElasticityProfile = new StandbyVirtualMachinePoolElasticityProfile(304L) { MinReadyCapacity = 300L, + PostProvisioningDelay = "PT2S", + DynamicSizingEnabled = true, }, AttachedVirtualMachineScaleSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), }, @@ -67,7 +69,7 @@ public async Task CreateOrUpdate_StandbyVirtualMachinePoolsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinePoolsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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 @@ -100,7 +102,7 @@ public async Task Get_StandbyVirtualMachinePoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_StandbyVirtualMachinePoolsListByResourceGroup() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_ListByResourceGroup.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_ListByResourceGroup.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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 +137,7 @@ public async Task GetAll_StandbyVirtualMachinePoolsListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_StandbyVirtualMachinePoolsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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 +166,7 @@ public async Task Exists_StandbyVirtualMachinePoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_StandbyVirtualMachinePoolsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolResource.cs index 310f9053f444..8c65d0c3c248 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolResource.cs @@ -20,7 +20,7 @@ public partial class Sample_StandbyVirtualMachinePoolResource [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinePoolsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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_StandbyVirtualMachinePoolsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_StandbyVirtualMachinePoolsDelete() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Delete.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Delete.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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_StandbyVirtualMachinePoolsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_StandbyVirtualMachinePoolsUpdate() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_Update.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_Update.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_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 @@ -96,11 +96,13 @@ public async Task Update_StandbyVirtualMachinePoolsUpdate() StandbyVirtualMachinePoolPatch patch = new StandbyVirtualMachinePoolPatch { Tags = { }, - Properties = new StandbyVirtualMachinePoolUpdateProperties + Properties = new StandbyVirtualMachinePoolResourceUpdateProperties { ElasticityProfile = new StandbyVirtualMachinePoolElasticityProfile(304L) { MinReadyCapacity = 300L, + PostProvisioningDelay = "PT2S", + DynamicSizingEnabled = true, }, VirtualMachineState = StandbyVirtualMachineState.Running, AttachedVirtualMachineScaleSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"), diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewCollection.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewCollection.cs index 4b3c5ddfcf90..0d8b98a003dd 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewCollection.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyVirtualMachinePoolRuntimeViewCollection [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinePoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolRuntimeViewResource_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_StandbyVirtualMachinePoolRuntimeViewsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_StandbyVirtualMachinePoolRuntimeViewsListByStandbyPool() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePoolRuntimeViews_ListByStandbyPool.json // this example is just showing the usage of "StandbyVirtualMachinePoolRuntimeViewResource_ListByStandbyPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task GetAll_StandbyVirtualMachinePoolRuntimeViewsListByStandbyPool( [Ignore("Only validating compilation of examples")] public async Task Exists_StandbyVirtualMachinePoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolRuntimeViewResource_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 @@ -119,7 +119,7 @@ public async Task Exists_StandbyVirtualMachinePoolRuntimeViewsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_StandbyVirtualMachinePoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolRuntimeViewResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewResource.cs index 8bf537d37e7e..0c4b52f6b29e 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachinePoolRuntimeViewResource.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyVirtualMachinePoolRuntimeViewResource [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinePoolRuntimeViewsGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePoolRuntimeViews_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePoolRuntimeViews_Get.json // this example is just showing the usage of "StandbyVirtualMachinePoolRuntimeViewResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineResource.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineResource.cs index 27201dbd972b..069320b180ea 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineResource.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_StandbyVirtualMachineResource.cs @@ -19,7 +19,7 @@ public partial class Sample_StandbyVirtualMachineResource [Ignore("Only validating compilation of examples")] public async Task Get_StandbyVirtualMachinesGet() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachines_Get.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachines_Get.json // this example is just showing the usage of "StandbyVirtualMachineResource_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/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index b6cf98b1bc36..20e2d17c795d 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetStandbyVirtualMachinePools_StandbyVirtualMachinePoolsListBySubscription() { - // Generated from example definition: 2025-03-01/StandbyVirtualMachinePools_ListBySubscription.json + // Generated from example definition: 2025-10-01/StandbyVirtualMachinePools_ListBySubscription.json // this example is just showing the usage of "StandbyVirtualMachinePoolResource_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task GetStandbyVirtualMachinePools_StandbyVirtualMachinePoolsListBy [Ignore("Only validating compilation of examples")] public async Task GetStandbyContainerGroupPools_StandbyContainerGroupPoolsListBySubscription() { - // Generated from example definition: 2025-03-01/StandbyContainerGroupPools_ListBySubscription.json + // Generated from example definition: 2025-10-01/StandbyContainerGroupPools_ListBySubscription.json // this example is just showing the usage of "StandbyContainerGroupPoolResource_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml index 71722f3a9080..8603be158f14 100644 --- a/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml +++ b/sdk/standbypool/Azure.ResourceManager.StandbyPool/tsp-location.yaml @@ -1,4 +1,5 @@ directory: specification\standbypool\StandbyPool.Management commit: 6267b64842af3d744c5b092a3f3beef49729ad6d repo: Azure/azure-rest-api-specs -emitterPackageJsonPath: eng/legacy-emitter-package.json +# emitterPackageJsonPath: eng/legacy-emitter-package.json +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json"